2 * UCW Library -- Universal Hash Table
4 * (c) 2002--2004 Martin Mares <mj@ucw.cz>
5 * (c) 2002--2005 Robert Spalek <robert@ucw.cz>
6 * (c) 2010 Pavel Charvat <pchar@ucw.cz>
7 * (c) 2012 Tomas Valla <tom@ucw.cz>
9 * This software may be freely distributed and used according to the terms
10 * of the GNU Lesser General Public License.
14 * This is not a normal header file, it's a generator of hash tables.
15 * Each time you include it with parameters set in the corresponding
16 * preprocessor macros, it generates a hash table with the parameters
19 * You need to specify:
21 * HASH_NODE data type where a node dwells (usually a struct).
22 * HASH_PREFIX(x) macro to add a name prefix (used on all global names
23 * defined by the hash table generator).
25 * Then decide on type of keys:
27 * HASH_KEY_ATOMIC=f use node->f as a key of an atomic type (i.e.,
28 * a type which can be compared using `==')
29 * HASH_ATOMIC_TYPE (defaults to int).
30 * | HASH_KEY_STRING=f use node->f as a string key, allocated
31 * separately from the rest of the node.
32 * | HASH_KEY_ENDSTRING=f use node->f as a string key, allocated
33 * automatically at the end of the node struct
34 * (to be declared as "char f[1]" at the end).
35 * | HASH_KEY_COMPLEX use a multi-component key; as the name suggests,
36 * the passing of parameters is a bit complex then.
37 * The HASH_KEY_COMPLEX(x) macro should expand to
38 * `x k1, x k2, ... x kn' and you should also define:
39 * HASH_KEY_DECL declaration of function parameters in which key
40 * should be passed to all hash table operations.
41 * That is, `type1 k1, type2 k2, ... typen kn'.
42 * With complex keys, HASH_GIVE_HASHFN and HASH_GIVE_EQ
44 * | HASH_KEY_MEMORY=f use node->f as a raw data key, compared using
46 * HASH_KEY_SIZE the length of the key block
48 * Then specify what operations you request (all names are automatically
49 * prefixed by calling HASH_PREFIX):
51 * <always defined> init() -- initialize the hash table.
52 * HASH_WANT_CLEANUP cleanup() -- deallocate the hash table.
53 * HASH_WANT_FIND node *find(key) -- find first node with the specified
54 * key, return NULL if no such node exists.
55 * HASH_WANT_FIND_NEXT node *find(node *start) -- find next node with the
56 * specified key, return NULL if no such node exists.
57 * HASH_WANT_NEW node *new(key) -- create new node with given key.
58 * Doesn't check whether it already exists.
59 * HASH_WANT_LOOKUP node *lookup(key) -- find node with given key,
60 * if it doesn't exist, create it. Defining
61 * HASH_GIVE_INIT_DATA is strongly recommended.
62 * HASH_LOOKUP_DETECT_NEW
63 * the prototype for lookup is changed to node *lookup(key, int *new_item)
64 * new_item must not be NULL and returns 1 whether lookup
65 * just created a new item in the hashtable or 0 otherwise
66 * HASH_WANT_DELETE int delete(key) -- delete and deallocate node
67 * with given key. Returns success.
68 * HASH_WANT_REMOVE remove(node *) -- delete and deallocate given node.
70 * You can also supply several functions:
72 * HASH_GIVE_HASHFN unsigned int hash(key) -- calculate hash value of key.
73 * We have sensible default hash functions for strings
75 * HASH_GIVE_EQ int eq(key1, key2) -- return whether keys are equal.
76 * By default, we use == for atomic types and either
77 * strcmp or strcasecmp for strings.
78 * HASH_GIVE_EXTRA_SIZE int extra_size(key) -- returns how many bytes after the
79 * node should be allocated for dynamic data. Default=0
80 * or length of the string with HASH_KEY_ENDSTRING.
81 * HASH_GIVE_INIT_KEY void init_key(node *,key) -- initialize key in a newly
82 * created node. Defaults: assignment for atomic keys
83 * and static strings, strcpy for end-allocated strings.
84 * HASH_GIVE_INIT_DATA void init_data(node *) -- initialize data fields in a
85 * newly created node. Very useful for lookup operations.
86 * HASH_GIVE_ALLOC void *alloc(unsigned int size) -- allocate space for
87 * a node. Default is xmalloc() or pooled allocation, depending
88 * on HASH_USE_POOL, HASH_AUTO_POOL, HASH_USE_ELTPOOL
89 * and HASH_AUTO_ELTPOOL switches. void free(void *) -- the converse.
90 * HASH_GIVE_TABLE_ALLOC void *table_alloc(unsigned int size), void *table_free(void *)
91 * Allocate or free space for the table itself. Default is xmalloc()
92 * or the functions defined by HASH_GIVE_ALLOC if HASH_TABLE_ALLOC is set.
94 * ... and a couple of extra parameters:
96 * HASH_NOCASE String comparisons should be case-insensitive.
97 * HASH_DEFAULT_SIZE=n Initially, use hash table of approx. `n' entries.
98 * HASH_CONSERVE_SPACE Use as little space as possible.
99 * HASH_FN_BITS=n The hash function gives only `n' significant bits.
100 * HASH_ATOMIC_TYPE=t Atomic values are of type `t' instead of int.
101 * HASH_USE_POOL=pool Allocate all nodes from given mempool. Note, however, that
102 * deallocation is not supported by mempools, so delete/remove
103 * will leak pool memory.
104 * HASH_AUTO_POOL=size Create a pool of the given block size automatically.
105 * HASH_USE_ELTPOOL=pool Allocate all nodes from given eltpool.
106 * HASH_AUTO_ELTPOOL=count Create an eltpool of the given number of elements in each chunk.
107 * HASH_ZERO_FILL New entries should be initialized to all zeroes.
108 * HASH_TABLE_ALLOC The hash table itself will be allocated and freed using
109 * the same allocation functions as the nodes instead of
110 * the default xmalloc().
111 * HASH_TABLE_GROWING Never decrease the size of the hash table itself
112 * HASH_TABLE_DYNAMIC Support multiple hash tables; the first parameter of all
113 * hash table operations is struct HASH_PREFIX(table) *.
114 * HASH_TABLE_VARS Extra variables to be defined in table structure
116 * You also get a iterator macro at no extra charge:
118 * HASH_FOR_ALL(hash_prefix, variable)
120 * // node *variable gets declared automatically
121 * do_something_with_node(variable);
122 * // use HASH_BREAK and HASH_CONTINUE instead of break and continue
123 * // you must not alter contents of the hash table here
127 * (For dynamic tables, use HASH_FOR_ALL_DYNAMIC(hash_prefix, hash_table, variable) instead.)
129 * Then include <ucw/hashtable.h> and voila, you have a hash table
130 * suiting all your needs (at least those which you've revealed :) ).
132 * After including this file, all parameter macros are automatically
136 #ifndef _UCW_HASHFUNC_H
137 #include <ucw/hashfunc.h>
140 #include <ucw/prime.h>
144 /* Initial setup of parameters */
146 #if !defined(HASH_NODE) || !defined(HASH_PREFIX)
147 #error Some of the mandatory configuration macros are missing.
150 #if defined(HASH_KEY_ATOMIC) && !defined(HASH_CONSERVE_SPACE)
151 #define HASH_CONSERVE_SPACE
154 #define P(x) HASH_PREFIX(x)
156 /* Declare buckets and the hash table */
158 typedef HASH_NODE P(node);
160 typedef struct P(bucket) {
161 struct P(bucket) *next;
162 #ifndef HASH_CONSERVE_SPACE
169 #ifdef HASH_TABLE_VARS
173 uns hash_count, hash_max, hash_min, hash_hard_max;
175 #ifdef HASH_AUTO_POOL
176 struct mempool *pool;
178 #ifdef HASH_AUTO_ELTPOOL
179 struct eltpool *eltpool;
183 #ifdef HASH_TABLE_DYNAMIC
185 #define TA struct P(table) *table
187 #define TAU TA UNUSED
188 #define TAUC TA UNUSED,
192 struct P(table) P(table);
202 /* Preset parameters */
204 #if defined(HASH_KEY_ATOMIC)
206 #define HASH_KEY(x) x HASH_KEY_ATOMIC
208 #ifndef HASH_ATOMIC_TYPE
209 # define HASH_ATOMIC_TYPE int
211 #define HASH_KEY_DECL HASH_ATOMIC_TYPE HASH_KEY( )
213 #ifndef HASH_GIVE_HASHFN
214 # define HASH_GIVE_HASHFN
215 static inline int P(hash) (TAUC HASH_ATOMIC_TYPE x)
216 { return ((sizeof(x) <= 4) ? hash_u32(x) : hash_u64(x)); }
220 # define HASH_GIVE_EQ
221 static inline int P(eq) (TAUC HASH_ATOMIC_TYPE x, HASH_ATOMIC_TYPE y)
225 #ifndef HASH_GIVE_INIT_KEY
226 # define HASH_GIVE_INIT_KEY
227 static inline void P(init_key) (TAUC P(node) *n, HASH_ATOMIC_TYPE k)
228 { HASH_KEY(n->) = k; }
231 #elif defined(HASH_KEY_MEMORY)
233 #define HASH_KEY(x) x HASH_KEY_MEMORY
235 #define HASH_KEY_DECL byte HASH_KEY( )[HASH_KEY_SIZE]
237 #ifndef HASH_GIVE_HASHFN
238 # define HASH_GIVE_HASHFN
239 static inline int P(hash) (TAUC byte *x)
240 { return hash_block(x, HASH_KEY_SIZE); }
244 # define HASH_GIVE_EQ
245 static inline int P(eq) (TAUC byte *x, byte *y)
246 { return !memcmp(x, y, HASH_KEY_SIZE); }
249 #ifndef HASH_GIVE_INIT_KEY
250 # define HASH_GIVE_INIT_KEY
251 static inline void P(init_key) (TAUC P(node) *n, byte *k)
252 { memcpy(HASH_KEY(n->), k, HASH_KEY_SIZE); }
255 #elif defined(HASH_KEY_STRING) || defined(HASH_KEY_ENDSTRING)
257 #ifdef HASH_KEY_STRING
258 # define HASH_KEY(x) x HASH_KEY_STRING
259 # ifndef HASH_GIVE_INIT_KEY
260 # define HASH_GIVE_INIT_KEY
261 static inline void P(init_key) (TAUC P(node) *n, char *k)
262 { HASH_KEY(n->) = k; }
265 # define HASH_KEY(x) x HASH_KEY_ENDSTRING
266 # define HASH_GIVE_EXTRA_SIZE
267 static inline int P(extra_size) (TAUC char *k)
268 { return strlen(k); }
269 # ifndef HASH_GIVE_INIT_KEY
270 # define HASH_GIVE_INIT_KEY
271 static inline void P(init_key) (TAUC P(node) *n, char *k)
272 { strcpy(HASH_KEY(n->), k); }
275 #define HASH_KEY_DECL char *HASH_KEY( )
277 #ifndef HASH_GIVE_HASHFN
278 #define HASH_GIVE_HASHFN
279 static inline uns P(hash) (TAUC char *k)
282 return hash_string_nocase(k);
284 return hash_string(k);
290 # define HASH_GIVE_EQ
291 static inline int P(eq) (TAUC char *x, char *y)
294 return !strcasecmp(x,y);
301 #elif defined(HASH_KEY_COMPLEX)
303 #define HASH_KEY(x) HASH_KEY_COMPLEX(x)
306 #error You forgot to set the hash key type.
309 /* Defaults for missing parameters */
311 #ifndef HASH_GIVE_HASHFN
312 #error Unable to determine which hash function to use.
316 #error Unable to determine how to compare two keys.
319 #ifdef HASH_GIVE_EXTRA_SIZE
320 /* This trickery is needed to avoid `unused parameter' warnings */
321 #define HASH_EXTRA_SIZE(x) P(extra_size)(TTC x)
324 * Beware, C macros are expanded iteratively, not recursively,
325 * hence we get only a _single_ argument, although the expansion
326 * of HASH_KEY contains commas.
328 #define HASH_EXTRA_SIZE(x) 0
331 #ifndef HASH_GIVE_INIT_KEY
332 #error Unable to determine how to initialize keys.
335 #ifndef HASH_GIVE_INIT_DATA
336 static inline void P(init_data) (TAUC P(node) *n UNUSED)
341 #ifdef HASH_GIVE_ALLOC
342 /* If the caller has requested to use his own allocation functions, do so */
343 static inline void P(init_alloc) (TAU) { }
344 static inline void P(cleanup_alloc) (TAU) { }
346 #elif defined(HASH_USE_POOL)
347 /* If the caller has requested to use his mempool, do so */
348 #include <ucw/mempool.h>
349 static inline void * P(alloc) (TAUC unsigned int size) { return mp_alloc_fast(HASH_USE_POOL, size); }
350 static inline void P(free) (TAUC void *x UNUSED) { }
351 static inline void P(init_alloc) (TAU) { }
352 static inline void P(cleanup_alloc) (TAU) { }
354 #elif defined(HASH_AUTO_POOL)
355 /* Use our own pools */
356 #include <ucw/mempool.h>
357 static inline void * P(alloc) (TAUC unsigned int size) { return mp_alloc_fast(T.pool, size); }
358 static inline void P(free) (TAUC void *x UNUSED) { }
359 static inline void P(init_alloc) (TAU) { T.pool = mp_new(HASH_AUTO_POOL); }
360 static inline void P(cleanup_alloc) (TAU) { mp_delete(T.pool); }
361 #define HASH_USE_POOL
363 #elif defined(HASH_USE_ELTPOOL)
364 /* If the caller has requested to use his eltpool, do so */
365 #include <ucw/eltpool.h>
366 static inline void * P(alloc) (TAUC unsigned int size UNUSED) { ASSERT(size <= (HASH_USE_ELTPOOL)->elt_size); return ep_alloc(HASH_USE_ELTPOOL); }
367 static inline void P(free) (TAUC void *x) { ep_free(HASH_USE_ELTPOOL, x); }
368 static inline void P(init_alloc) (TAU) { }
369 static inline void P(cleanup_alloc) (TAU) { }
371 #elif defined(HASH_AUTO_ELTPOOL)
372 /* Use our own eltpools */
373 #include <ucw/eltpool.h>
374 static inline void * P(alloc) (TAUC unsigned int size UNUSED) { return ep_alloc(T.eltpool); }
375 static inline void P(free) (TAUC void *x) { ep_free(T.eltpool, x); }
376 static inline void P(init_alloc) (TAU) { T.eltpool = ep_new(sizeof(P(bucket)), HASH_AUTO_ELTPOOL); }
377 static inline void P(cleanup_alloc) (TAU) { ep_delete(T.eltpool); }
378 #define HASH_USE_ELTPOOL
381 /* The default allocation method */
382 static inline void * P(alloc) (TAUC unsigned int size) { return xmalloc(size); }
383 static inline void P(free) (TAUC void *x) { xfree(x); }
384 static inline void P(init_alloc) (TAU) { }
385 static inline void P(cleanup_alloc) (TAU) { }
389 #if defined(HASH_USE_ELTPOOL) && defined(HASH_GIVE_EXTRA_SIZE)
390 #error Eltpools not supported in combination with variable-sized nodes
393 #ifdef HASH_GIVE_TABLE_ALLOC
394 /* If the caller has requested to use his own allocation functions, do so */
395 #elif defined(HASH_TABLE_ALLOC)
396 #ifdef HASH_USE_ELTPOOL
397 #error HASH_TABLE_ALLOC not supported in combination with eltpools
399 static inline void * P(table_alloc) (TAUC unsigned int size) { return P(alloc)(TTC size); }
400 static inline void P(table_free) (TAUC void *x) { P(free)(TTC x); }
402 static inline void * P(table_alloc) (TAUC unsigned int size) { return xmalloc(size); }
403 static inline void P(table_free) (TAUC void *x) { xfree(x); }
406 #if defined(HASH_USE_POOL) && defined(HASH_TABLE_ALLOC) && !defined(HASH_TABLE_GROWING)
407 #define HASH_TABLE_GROWING
410 #ifndef HASH_DEFAULT_SIZE
411 #define HASH_DEFAULT_SIZE 32
415 #define HASH_FN_BITS 32
418 #ifdef HASH_ZERO_FILL
419 static inline void * P(new_bucket)(TAUC uns size)
421 byte *buck = P(alloc)(TTC size);
426 static inline void * P(new_bucket)(TAUC uns size) { return P(alloc)(TTC size); }
429 /* Now the operations */
431 static void P(alloc_table) (TAU)
433 T.hash_size = next_table_prime(T.hash_size);
434 T.ht = P(table_alloc)(TTC sizeof(void *) * T.hash_size);
435 bzero(T.ht, sizeof(void *) * T.hash_size);
436 if (2*T.hash_size < T.hash_hard_max)
437 T.hash_max = 2*T.hash_size;
440 #ifndef HASH_TABLE_GROWING
441 if (T.hash_size/2 > HASH_DEFAULT_SIZE)
442 T.hash_min = T.hash_size/4;
449 * Initializes the hash table.
450 * This one is available no matter what `HASH_WANT_` macros you defined or not.
452 static void HASH_PREFIX(init)(TA)
455 T.hash_size = HASH_DEFAULT_SIZE;
456 #if HASH_FN_BITS < 28
457 T.hash_hard_max = 1 << HASH_FN_BITS;
459 T.hash_hard_max = 1 << 28;
465 #ifdef HASH_WANT_CLEANUP
467 * Deallocates the hash table, including the nodes.
468 * It is available if you defined <<want_cleanup,`HASH_WANT_CLEANUP`>>.
470 static void HASH_PREFIX(cleanup)(TA)
472 #ifndef HASH_USE_POOL
476 for (i=0; i<T.hash_size; i++)
477 for (b=T.ht[i]; b; b=bb)
483 P(cleanup_alloc)(TT);
484 P(table_free)(TTC T.ht);
488 static inline uns P(bucket_hash) (TAUC P(bucket) *b)
490 #ifdef HASH_CONSERVE_SPACE
491 return P(hash)(TTC HASH_KEY(b->n.));
497 static void P(rehash) (TAC uns size)
500 P(bucket) **oldt = T.ht, **newt;
501 uns oldsize = T.hash_size;
504 DBG("Rehashing %d->%d at count %d", oldsize, size, T.hash_count);
508 for (i=0; i<oldsize; i++)
514 h = P(bucket_hash)(TTC b) % T.hash_size;
520 P(table_free)(TTC oldt);
523 #ifdef HASH_WANT_FIND
525 * Finds a node with given key (specified in the @HAS_KEY_DECL parameter).
526 * If it does not exist, NULL is returned.
528 * Enabled by the <<want_find,`HASH_WANT_FIND`>> macro.
530 static HASH_NODE* HASH_PREFIX(find)(TAC HASH_KEY_DECL)
532 uns h0 = P(hash) (TTC HASH_KEY( ));
533 uns h = h0 % T.hash_size;
536 for (b=T.ht[h]; b; b=b->next)
539 #ifndef HASH_CONSERVE_SPACE
542 P(eq)(TTC HASH_KEY( ), HASH_KEY(b->n.)))
549 #ifdef HASH_WANT_FIND_NEXT
551 * Finds next node with the same key. Returns NULL if it does not exist.
553 * Enabled by the <<want_find_next,`HASH_WANT_FIND_NEXT`>> macro.
555 static HASH_NODE* HASH_PREFIX(find_next)(TAC P(node) *start)
557 #ifndef HASH_CONSERVE_SPACE
558 uns h0 = P(hash) (TTC HASH_KEY(start->));
560 P(bucket) *b = SKIP_BACK(P(bucket), n, start);
562 for (b=b->next; b; b=b->next)
565 #ifndef HASH_CONSERVE_SPACE
568 P(eq)(TTC HASH_KEY(start->), HASH_KEY(b->n.)))
577 * Generates a new node with a given key.
579 * Enabled by the <<want_new,`HASH_WANT_NEW`>> macro.
581 static HASH_NODE * HASH_PREFIX(new)(TAC HASH_KEY_DECL)
586 h0 = P(hash) (TTC HASH_KEY( ));
587 h = h0 % T.hash_size;
588 b = P(new_bucket) (TTC sizeof(struct P(bucket)) + HASH_EXTRA_SIZE(HASH_KEY( )));
591 #ifndef HASH_CONSERVE_SPACE
594 P(init_key)(TTC &b->n, HASH_KEY( ));
595 P(init_data)(TTC &b->n);
596 if (T.hash_count++ >= T.hash_max)
597 P(rehash)(TTC 2*T.hash_size);
602 #ifdef HASH_WANT_LOOKUP
604 * Finds a node with a given key. If it does not exist, a new one is created.
605 * It is strongly recommended to use <<give_init_data,`HASH_GIVE_INIT_DATA`>>.
607 * This one is enabled by the <<want_lookup,`HASH_WANT_LOOKUP`>> macro.
609 #ifdef HASH_LOOKUP_DETECT_NEW
610 static HASH_NODE* HASH_PREFIX(lookup)(TAC HASH_KEY_DECL, int *new_item)
612 static HASH_NODE* HASH_PREFIX(lookup)(TAC HASH_KEY_DECL)
615 uns h0 = P(hash) (TTC HASH_KEY( ));
616 uns h = h0 % T.hash_size;
619 for (b=T.ht[h]; b; b=b->next)
622 #ifndef HASH_CONSERVE_SPACE
625 P(eq)(TTC HASH_KEY( ), HASH_KEY(b->n.))) {
626 #ifdef HASH_LOOKUP_DETECT_NEW
633 b = P(new_bucket) (TTC sizeof(struct P(bucket)) + HASH_EXTRA_SIZE(HASH_KEY( )));
636 #ifndef HASH_CONSERVE_SPACE
639 P(init_key)(TTC &b->n, HASH_KEY( ));
640 P(init_data)(TTC &b->n);
641 if (T.hash_count++ >= T.hash_max)
642 P(rehash)(TTC 2*T.hash_size);
643 #ifdef HASH_LOOKUP_DETECT_NEW
650 #ifdef HASH_WANT_DELETE
652 * Removes a node with the given key from hash table and deallocates it.
654 * Success is returned.
656 * This one is enabled by <<want_delete,`HASH_WANT_DELETE`>> macro.
658 static int HASH_PREFIX(delete)(TAC HASH_KEY_DECL)
660 uns h0 = P(hash) (TTC HASH_KEY( ));
661 uns h = h0 % T.hash_size;
664 for (bb=&T.ht[h]; b=*bb; bb=&b->next)
667 #ifndef HASH_CONSERVE_SPACE
670 P(eq)(TTC HASH_KEY( ), HASH_KEY(b->n.)))
675 #ifndef HASH_TABLE_GROWING
676 if (T.hash_count < T.hash_min)
677 P(rehash)(TTC T.hash_size/2);
686 #ifdef HASH_WANT_REMOVE
688 * Removes a given node and deallocates it.
689 * It differs from <<fun__GENERIC_LINK|HASH_PREFIX|delete,`HASH_PREFIX(delete)()`>>
690 * in its type of parameter -- this one deletes a specific node, that one looks for it by a key.
692 * Enabled by <<want_remove,`HASH_WANT_REMOVE`>> macro.
694 static void HASH_PREFIX(remove)(TAC HASH_NODE *n)
696 P(bucket) *x = SKIP_BACK(struct P(bucket), n, n);
697 uns h0 = P(bucket_hash)(TTC x);
698 uns h = h0 % T.hash_size;
701 for (bb=&T.ht[h]; (b=*bb) && b != x; bb=&b->next)
707 #ifndef HASH_TABLE_GROWING
708 if (T.hash_count < T.hash_min)
709 P(rehash)(TTC T.hash_size/2);
714 /* And the iterator */
718 #define HASH_FOR_ALL_DYNAMIC(h_px, h_table, h_var) \
721 struct GLUE_(h_px,bucket) *h_buck; \
722 for (h_slot=0; h_slot < (h_table)->hash_size; h_slot++) \
723 for (h_buck = (h_table)->ht[h_slot]; h_buck; h_buck = h_buck->next) \
725 GLUE_(h_px,node) *h_var = &h_buck->n;
726 #define HASH_FOR_ALL(h_px, h_var) HASH_FOR_ALL_DYNAMIC(h_px, &GLUE_(h_px,table), h_var)
727 #define HASH_END_FOR } } while(0)
729 #define HASH_CONTINUE continue
733 /* Finally, undefine all the parameters */
744 #undef HASH_ATOMIC_TYPE
745 #undef HASH_CONSERVE_SPACE
746 #undef HASH_DEFAULT_SIZE
747 #undef HASH_EXTRA_SIZE
749 #undef HASH_GIVE_ALLOC
750 #undef HASH_GIVE_TABLE_ALLOC
752 #undef HASH_GIVE_EXTRA_SIZE
753 #undef HASH_GIVE_HASHFN
754 #undef HASH_GIVE_INIT_DATA
755 #undef HASH_GIVE_INIT_KEY
757 #undef HASH_KEY_ATOMIC
758 #undef HASH_KEY_COMPLEX
760 #undef HASH_KEY_ENDSTRING
761 #undef HASH_KEY_STRING
762 #undef HASH_KEY_MEMORY
768 #undef HASH_AUTO_POOL
769 #undef HASH_USE_ELTPOOL
770 #undef HASH_AUTO_ELTPOOL
771 #undef HASH_WANT_CLEANUP
772 #undef HASH_WANT_DELETE
773 #undef HASH_WANT_FIND
774 #undef HASH_WANT_FIND_NEXT
775 #undef HASH_WANT_LOOKUP
777 #undef HASH_WANT_REMOVE
778 #undef HASH_TABLE_ALLOC
779 #undef HASH_TABLE_GROWING
780 #undef HASH_TABLE_DYNAMIC
781 #undef HASH_TABLE_VARS
782 #undef HASH_ZERO_FILL
783 #undef HASH_LOOKUP_DETECT_NEW