Deleted Added
full compact
ucl_hash.h (275223) ucl_hash.h (279549)
1/* Copyright (c) 2013, Vsevolod Stakhov
2 * All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 * * Redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer.
8 * * Redistributions in binary form must reproduce the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
21 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 */
23
24#ifndef __UCL_HASH_H
25#define __UCL_HASH_H
26
27#include "ucl.h"
1/* Copyright (c) 2013, Vsevolod Stakhov
2 * All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 * * Redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer.
8 * * Redistributions in binary form must reproduce the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
21 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 */
23
24#ifndef __UCL_HASH_H
25#define __UCL_HASH_H
26
27#include "ucl.h"
28#include "uthash.h"
29
30/******************************************************************************/
31
28
29/******************************************************************************/
30
32typedef struct ucl_hash_node_s
33{
34 const ucl_object_t *data;
35 UT_hash_handle hh;
36} ucl_hash_node_t;
31struct ucl_hash_node_s;
32typedef struct ucl_hash_node_s ucl_hash_node_t;
37
38typedef int ucl_hash_cmp_func (const void* void_a, const void* void_b);
39typedef void ucl_hash_free_func (void *ptr);
40typedef void* ucl_hash_iter_t;
41
42
43/**
44 * Linear chained hashtable.
45 */
33
34typedef int ucl_hash_cmp_func (const void* void_a, const void* void_b);
35typedef void ucl_hash_free_func (void *ptr);
36typedef void* ucl_hash_iter_t;
37
38
39/**
40 * Linear chained hashtable.
41 */
46typedef struct ucl_hash_struct
47{
48 ucl_hash_node_t *buckets; /**< array of hash buckets. One list for each hash modulus. */
49} ucl_hash_t;
42struct ucl_hash_struct;
43typedef struct ucl_hash_struct ucl_hash_t;
50
51
52/**
53 * Initializes the hashtable.
54 */
44
45
46/**
47 * Initializes the hashtable.
48 */
55ucl_hash_t* ucl_hash_create (void);
49ucl_hash_t* ucl_hash_create (bool ignore_case);
56
57/**
58 * Deinitializes the hashtable.
59 */
60void ucl_hash_destroy (ucl_hash_t* hashlin, ucl_hash_free_func *func);
61
62/**
63 * Inserts an element in the the hashtable.

--- 25 unchanged lines hidden (view full) ---

89 * @param iter iterator (must be NULL on first iteration)
90 * @return the next object
91 */
92const void* ucl_hash_iterate (ucl_hash_t *hashlin, ucl_hash_iter_t *iter);
93
94/**
95 * Check whether an iterator has next element
96 */
50
51/**
52 * Deinitializes the hashtable.
53 */
54void ucl_hash_destroy (ucl_hash_t* hashlin, ucl_hash_free_func *func);
55
56/**
57 * Inserts an element in the the hashtable.

--- 25 unchanged lines hidden (view full) ---

83 * @param iter iterator (must be NULL on first iteration)
84 * @return the next object
85 */
86const void* ucl_hash_iterate (ucl_hash_t *hashlin, ucl_hash_iter_t *iter);
87
88/**
89 * Check whether an iterator has next element
90 */
97bool ucl_hash_iter_has_next (ucl_hash_iter_t iter);
91bool ucl_hash_iter_has_next (ucl_hash_t *hashlin, ucl_hash_iter_t iter);
98
99#endif
92
93#endif