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>
8 * This software may be freely distributed and used according to the terms
9 * of the GNU Lesser General Public License.
13 * This is not a normal header file, it's a generator of hash tables.
14 * Each time you include it with parameters set in the corresponding
15 * preprocessor macros, it generates a hash table with the parameters
18 * You need to specify:
20 * HASH_NODE data type where a node dwells (usually a struct).
21 * HASH_PREFIX(x) macro to add a name prefix (used on all global names
22 * defined by the hash table generator).
24 * Then decide on type of keys:
26 * HASH_KEY_ATOMIC=f use node->f as a key of an atomic type (i.e.,
27 * a type which can be compared using `==')
28 * HASH_ATOMIC_TYPE (defaults to int).
29 * | HASH_KEY_STRING=f use node->f as a string key, allocated
30 * separately from the rest of the node.
31 * | HASH_KEY_ENDSTRING=f use node->f as a string key, allocated
32 * automatically at the end of the node struct
33 * (to be declared as "char f[1]" at the end).
34 * | HASH_KEY_COMPLEX use a multi-component key; as the name suggests,
35 * the passing of parameters is a bit complex then.
36 * The HASH_KEY_COMPLEX(x) macro should expand to
37 * `x k1, x k2, ... x kn' and you should also define:
38 * HASH_KEY_DECL declaration of function parameters in which key
39 * should be passed to all hash table operations.
40 * That is, `type1 k1, type2 k2, ... typen kn'.
41 * With complex keys, HASH_GIVE_HASHFN and HASH_GIVE_EQ
43 * | HASH_KEY_MEMORY=f use node->f as a raw data key, compared using
45 * HASH_KEY_SIZE the length of the key block
47 * Then specify what operations you request (all names are automatically
48 * prefixed by calling HASH_PREFIX):
50 * <always defined> init() -- initialize the hash table.
51 * HASH_WANT_CLEANUP cleanup() -- deallocate the hash table.
52 * HASH_WANT_FIND node *find(key) -- find first node with the specified
53 * key, return NULL if no such node exists.
54 * HASH_WANT_FIND_NEXT node *find(node *start) -- find next node with the
55 * specified key, return NULL if no such node exists.
56 * HASH_WANT_NEW node *new(key) -- create new node with given key.
57 * Doesn't check whether it already exists.
58 * HASH_WANT_LOOKUP node *lookup(key) -- find node with given key,
59 * if it doesn't exist, create it. Defining
60 * HASH_GIVE_INIT_DATA is strongly recommended.
61 * HASH_WANT_DELETE int delete(key) -- delete and deallocate node
62 * with given key. Returns success.
63 * HASH_WANT_REMOVE remove(node *) -- delete and deallocate given node.
65 * You can also supply several functions:
67 * HASH_GIVE_HASHFN unsigned int hash(key) -- calculate hash value of key.
68 * We have sensible default hash functions for strings
70 * HASH_GIVE_EQ int eq(key1, key2) -- return whether keys are equal.
71 * By default, we use == for atomic types and either
72 * strcmp or strcasecmp for strings.
73 * HASH_GIVE_EXTRA_SIZE int extra_size(key) -- returns how many bytes after the
74 * node should be allocated for dynamic data. Default=0
75 * or length of the string with HASH_KEY_ENDSTRING.
76 * HASH_GIVE_INIT_KEY void init_key(node *,key) -- initialize key in a newly
77 * created node. Defaults: assignment for atomic keys
78 * and static strings, strcpy for end-allocated strings.
79 * HASH_GIVE_INIT_DATA void init_data(node *) -- initialize data fields in a
80 * newly created node. Very useful for lookup operations.
81 * HASH_GIVE_ALLOC void *alloc(unsigned int size) -- allocate space for
82 * a node. Default is xmalloc() or pooled allocation, depending
83 * on HASH_USE_POOL, HASH_AUTO_POOL, HASH_USE_ELTPOOL
84 * and HASH_AUTO_ELTPOOL switches. void free(void *) -- the converse.
85 * HASH_GIVE_TABLE_ALLOC void *table_alloc(unsigned int size), void *table_free(void *)
86 * Allocate or free space for the table itself. Default is xmalloc()
87 * or the functions defined by HASH_GIVE_ALLOC if HASH_TABLE_ALLOC is set.
89 * ... and a couple of extra parameters:
91 * HASH_NOCASE String comparisons should be case-insensitive.
92 * HASH_DEFAULT_SIZE=n Initially, use hash table of approx. `n' entries.
93 * HASH_CONSERVE_SPACE Use as little space as possible.
94 * HASH_FN_BITS=n The hash function gives only `n' significant bits.
95 * HASH_ATOMIC_TYPE=t Atomic values are of type `t' instead of int.
96 * HASH_USE_POOL=pool Allocate all nodes from given mempool. Note, however, that
97 * deallocation is not supported by mempools, so delete/remove
98 * will leak pool memory.
99 * HASH_AUTO_POOL=size Create a pool of the given block size automatically.
100 * HASH_USE_ELTPOOL=pool Allocate all nodes from given eltpool.
101 * HASH_AUTO_ELTPOOL=count Create an eltpool of the given number of elements in each chunk.
102 * HASH_ZERO_FILL New entries should be initialized to all zeroes.
103 * HASH_TABLE_ALLOC The hash table itself will be allocated and freed using
104 * the same allocation functions as the nodes instead of
105 * the default xmalloc().
106 * HASH_TABLE_GROWING Never decrease the size of the hash table itself
107 * HASH_TABLE_DYNAMIC Support multiple hash tables; the first parameter of all
108 * hash table operations is struct HASH_PREFIX(table) *.
109 * HASH_TABLE_VARS Extra variables to be defined in table structure
111 * You also get a iterator macro at no extra charge:
113 * HASH_FOR_ALL(hash_prefix, variable)
115 * // node *variable gets declared automatically
116 * do_something_with_node(variable);
117 * // use HASH_BREAK and HASH_CONTINUE instead of break and continue
118 * // you must not alter contents of the hash table here
122 * (For dynamic tables, use HASH_FOR_ALL_DYNAMIC(hash_prefix, hash_table, variable) instead.)
124 * Then include "ucw/hashtable.h" and voila, you have a hash table
125 * suiting all your needs (at least those which you've revealed :) ).
127 * After including this file, all parameter macros are automatically
131 #ifndef _UCW_HASHFUNC_H
132 #include "ucw/hashfunc.h"
135 #include "ucw/prime.h"
139 /* Initial setup of parameters */
141 #if !defined(HASH_NODE) || !defined(HASH_PREFIX)
142 #error Some of the mandatory configuration macros are missing.
145 #if defined(HASH_KEY_ATOMIC) && !defined(HASH_CONSERVE_SPACE)
146 #define HASH_CONSERVE_SPACE
149 #define P(x) HASH_PREFIX(x)
151 /* Declare buckets and the hash table */
153 typedef HASH_NODE P(node);
155 typedef struct P(bucket) {
156 struct P(bucket) *next;
157 #ifndef HASH_CONSERVE_SPACE
164 #ifdef HASH_TABLE_VARS
168 uns hash_count, hash_max, hash_min, hash_hard_max;
170 #ifdef HASH_AUTO_POOL
171 struct mempool *pool;
173 #ifdef HASH_AUTO_ELTPOOL
174 struct eltpool *eltpool;
178 #ifdef HASH_TABLE_DYNAMIC
180 #define TA struct P(table) *table
182 #define TAU TA UNUSED
183 #define TAUC TA UNUSED,
187 struct P(table) P(table);
197 /* Preset parameters */
199 #if defined(HASH_KEY_ATOMIC)
201 #define HASH_KEY(x) x HASH_KEY_ATOMIC
203 #ifndef HASH_ATOMIC_TYPE
204 # define HASH_ATOMIC_TYPE int
206 #define HASH_KEY_DECL HASH_ATOMIC_TYPE HASH_KEY( )
208 #ifndef HASH_GIVE_HASHFN
209 # define HASH_GIVE_HASHFN
210 static inline int P(hash) (TAUC HASH_ATOMIC_TYPE x)
211 { return ((sizeof(x) <= 4) ? hash_u32(x) : hash_u64(x)); }
215 # define HASH_GIVE_EQ
216 static inline int P(eq) (TAUC HASH_ATOMIC_TYPE x, HASH_ATOMIC_TYPE y)
220 #ifndef HASH_GIVE_INIT_KEY
221 # define HASH_GIVE_INIT_KEY
222 static inline void P(init_key) (TAUC P(node) *n, HASH_ATOMIC_TYPE k)
223 { HASH_KEY(n->) = k; }
226 #elif defined(HASH_KEY_MEMORY)
228 #define HASH_KEY(x) x HASH_KEY_MEMORY
230 #define HASH_KEY_DECL byte HASH_KEY( )[HASH_KEY_SIZE]
232 #ifndef HASH_GIVE_HASHFN
233 # define HASH_GIVE_HASHFN
234 static inline int P(hash) (TAUC byte *x)
235 { return hash_block(x, HASH_KEY_SIZE); }
239 # define HASH_GIVE_EQ
240 static inline int P(eq) (TAUC byte *x, byte *y)
241 { return !memcmp(x, y, HASH_KEY_SIZE); }
244 #ifndef HASH_GIVE_INIT_KEY
245 # define HASH_GIVE_INIT_KEY
246 static inline void P(init_key) (TAUC P(node) *n, byte *k)
247 { memcpy(HASH_KEY(n->), k, HASH_KEY_SIZE); }
250 #elif defined(HASH_KEY_STRING) || defined(HASH_KEY_ENDSTRING)
252 #ifdef HASH_KEY_STRING
253 # define HASH_KEY(x) x HASH_KEY_STRING
254 # ifndef HASH_GIVE_INIT_KEY
255 # define HASH_GIVE_INIT_KEY
256 static inline void P(init_key) (TAUC P(node) *n, char *k)
257 { HASH_KEY(n->) = k; }
260 # define HASH_KEY(x) x HASH_KEY_ENDSTRING
261 # define HASH_GIVE_EXTRA_SIZE
262 static inline int P(extra_size) (TAUC char *k)
263 { return strlen(k); }
264 # ifndef HASH_GIVE_INIT_KEY
265 # define HASH_GIVE_INIT_KEY
266 static inline void P(init_key) (TAUC P(node) *n, char *k)
267 { strcpy(HASH_KEY(n->), k); }
270 #define HASH_KEY_DECL char *HASH_KEY( )
272 #ifndef HASH_GIVE_HASHFN
273 #define HASH_GIVE_HASHFN
274 static inline uns P(hash) (TAUC char *k)
277 return hash_string_nocase(k);
279 return hash_string(k);
285 # define HASH_GIVE_EQ
286 static inline int P(eq) (TAUC char *x, char *y)
289 return !strcasecmp(x,y);
296 #elif defined(HASH_KEY_COMPLEX)
298 #define HASH_KEY(x) HASH_KEY_COMPLEX(x)
301 #error You forgot to set the hash key type.
304 /* Defaults for missing parameters */
306 #ifndef HASH_GIVE_HASHFN
307 #error Unable to determine which hash function to use.
311 #error Unable to determine how to compare two keys.
314 #ifdef HASH_GIVE_EXTRA_SIZE
315 /* This trickery is needed to avoid `unused parameter' warnings */
316 #define HASH_EXTRA_SIZE(x) P(extra_size)(TTC x)
319 * Beware, C macros are expanded iteratively, not recursively,
320 * hence we get only a _single_ argument, although the expansion
321 * of HASH_KEY contains commas.
323 #define HASH_EXTRA_SIZE(x) 0
326 #ifndef HASH_GIVE_INIT_KEY
327 #error Unable to determine how to initialize keys.
330 #ifndef HASH_GIVE_INIT_DATA
331 static inline void P(init_data) (TAUC P(node) *n UNUSED)
336 #ifdef HASH_GIVE_ALLOC
337 /* If the caller has requested to use his own allocation functions, do so */
338 static inline void P(init_alloc) (TAU) { }
339 static inline void P(cleanup_alloc) (TAU) { }
341 #elif defined(HASH_USE_POOL)
342 /* If the caller has requested to use his mempool, do so */
343 #include "ucw/mempool.h"
344 static inline void * P(alloc) (TAUC unsigned int size) { return mp_alloc_fast(HASH_USE_POOL, size); }
345 static inline void P(free) (TAUC void *x UNUSED) { }
346 static inline void P(init_alloc) (TAU) { }
347 static inline void P(cleanup_alloc) (TAU) { }
349 #elif defined(HASH_AUTO_POOL)
350 /* Use our own pools */
351 #include "ucw/mempool.h"
352 static inline void * P(alloc) (TAUC unsigned int size) { return mp_alloc_fast(T.pool, size); }
353 static inline void P(free) (TAUC void *x UNUSED) { }
354 static inline void P(init_alloc) (TAU) { T.pool = mp_new(HASH_AUTO_POOL); }
355 static inline void P(cleanup_alloc) (TAU) { mp_delete(T.pool); }
356 #define HASH_USE_POOL
358 #elif defined(HASH_USE_ELTPOOL)
359 /* If the caller has requested to use his eltpool, do so */
360 #include "ucw/eltpool.h"
361 static inline void * P(alloc) (TAUC unsigned int size UNUSED) { ASSERT(size <= (HASH_USE_ELTPOOL)->elt_size); return ep_alloc(HASH_USE_ELTPOOL); }
362 static inline void P(free) (TAUC void *x) { ep_free(HASH_USE_ELTPOOL, x); }
363 static inline void P(init_alloc) (TAU) { }
364 static inline void P(cleanup_alloc) (TAU) { }
366 #elif defined(HASH_AUTO_ELTPOOL)
367 /* Use our own eltpools */
368 #include "ucw/eltpool.h"
369 static inline void * P(alloc) (TAUC unsigned int size UNUSED) { return ep_alloc(T.eltpool); }
370 static inline void P(free) (TAUC void *x) { ep_free(T.eltpool, x); }
371 static inline void P(init_alloc) (TAU) { T.eltpool = ep_new(sizeof(P(bucket)), HASH_AUTO_ELTPOOL); }
372 static inline void P(cleanup_alloc) (TAU) { ep_delete(T.eltpool); }
373 #define HASH_USE_ELTPOOL
376 /* The default allocation method */
377 static inline void * P(alloc) (TAUC unsigned int size) { return xmalloc(size); }
378 static inline void P(free) (TAUC void *x) { xfree(x); }
379 static inline void P(init_alloc) (TAU) { }
380 static inline void P(cleanup_alloc) (TAU) { }
384 #if defined(HASH_USE_ELTPOOL) && defined(HASH_GIVE_EXTRA_SIZE)
385 #error Eltpools not supported in combination with variable-sized nodes
388 #ifdef HASH_GIVE_TABLE_ALLOC
389 /* If the caller has requested to use his own allocation functions, do so */
390 #elif defined(HASH_TABLE_ALLOC)
391 #ifdef HASH_USE_ELTPOOL
392 #error HASH_TABLE_ALLOC not supported in combination with eltpools
394 static inline void * P(table_alloc) (TAUC unsigned int size) { return P(alloc)(TTC size); }
395 static inline void P(table_free) (TAUC void *x) { P(free)(TTC x); }
397 static inline void * P(table_alloc) (TAUC unsigned int size) { return xmalloc(size); }
398 static inline void P(table_free) (TAUC void *x) { xfree(x); }
401 #if defined(HASH_USE_POOL) && defined(HASH_TABLE_ALLOC) && !defined(HASH_TABLE_GROWING)
402 #define HASH_TABLE_GROWING
405 #ifndef HASH_DEFAULT_SIZE
406 #define HASH_DEFAULT_SIZE 32
410 #define HASH_FN_BITS 32
413 #ifdef HASH_ZERO_FILL
414 static inline void * P(new_bucket)(TAUC uns size)
416 byte *buck = P(alloc)(TTC size);
421 static inline void * P(new_bucket)(TAUC uns size) { return P(alloc)(TTC size); }
424 /* Now the operations */
426 static void P(alloc_table) (TAU)
428 T.hash_size = next_table_prime(T.hash_size);
429 T.ht = P(table_alloc)(TTC sizeof(void *) * T.hash_size);
430 bzero(T.ht, sizeof(void *) * T.hash_size);
431 if (2*T.hash_size < T.hash_hard_max)
432 T.hash_max = 2*T.hash_size;
435 #ifndef HASH_TABLE_GROWING
436 if (T.hash_size/2 > HASH_DEFAULT_SIZE)
437 T.hash_min = T.hash_size/4;
444 * Initializes the hash table.
445 * This one is available no matter what `HASH_WANT_` macros you defined or not.
447 static void HASH_PREFIX(init)(TA)
450 T.hash_size = HASH_DEFAULT_SIZE;
451 #if HASH_FN_BITS < 28
452 T.hash_hard_max = 1 << HASH_FN_BITS;
454 T.hash_hard_max = 1 << 28;
460 #ifdef HASH_WANT_CLEANUP
462 * Deallocates the hash table, including the nodes.
463 * It is available if you defined <<want_cleanup,`HASH_WANT_CLEANUP`>>.
465 static void HASH_PREFIX(cleanup)(TA)
467 #ifndef HASH_USE_POOL
471 for (i=0; i<T.hash_size; i++)
472 for (b=T.ht[i]; b; b=bb)
478 P(cleanup_alloc)(TT);
479 P(table_free)(TTC T.ht);
483 static inline uns P(bucket_hash) (TAUC P(bucket) *b)
485 #ifdef HASH_CONSERVE_SPACE
486 return P(hash)(TTC HASH_KEY(b->n.));
492 static void P(rehash) (TAC uns size)
495 P(bucket) **oldt = T.ht, **newt;
496 uns oldsize = T.hash_size;
499 DBG("Rehashing %d->%d at count %d", oldsize, size, T.hash_count);
503 for (i=0; i<oldsize; i++)
509 h = P(bucket_hash)(TTC b) % T.hash_size;
515 P(table_free)(TTC oldt);
518 #ifdef HASH_WANT_FIND
520 * Finds a node with given key (specified in the @HAS_KEY_DECL parameter).
521 * If it does not exist, NULL is returned.
523 * Enabled by the <<want_find,`HASH_WANT_FIND`>> macro.
525 static HASH_NODE* HASH_PREFIX(find)(TAC HASH_KEY_DECL)
527 uns h0 = P(hash) (TTC HASH_KEY( ));
528 uns h = h0 % T.hash_size;
531 for (b=T.ht[h]; b; b=b->next)
534 #ifndef HASH_CONSERVE_SPACE
537 P(eq)(TTC HASH_KEY( ), HASH_KEY(b->n.)))
544 #ifdef HASH_WANT_FIND_NEXT
546 * Finds next node with the same key. Returns NULL if it does not exist.
548 * Enabled by the <<want_find_next,`HASH_WANT_FIND_NEXT`>> macro.
550 static HASH_NODE* HASH_PREFIX(find_next)(TAC P(node) *start)
552 #ifndef HASH_CONSERVE_SPACE
553 uns h0 = P(hash) (TTC HASH_KEY(start->));
555 P(bucket) *b = SKIP_BACK(P(bucket), n, start);
557 for (b=b->next; b; b=b->next)
560 #ifndef HASH_CONSERVE_SPACE
563 P(eq)(TTC HASH_KEY(start->), HASH_KEY(b->n.)))
572 * Generates a new node with a given key.
574 * Enabled by the <<want_new,`HASH_WANT_NEW`>> macro.
576 static HASH_NODE * HASH_PREFIX(new)(TAC HASH_KEY_DECL)
581 h0 = P(hash) (TTC HASH_KEY( ));
582 h = h0 % T.hash_size;
583 b = P(new_bucket) (TTC sizeof(struct P(bucket)) + HASH_EXTRA_SIZE(HASH_KEY( )));
586 #ifndef HASH_CONSERVE_SPACE
589 P(init_key)(TTC &b->n, HASH_KEY( ));
590 P(init_data)(TTC &b->n);
591 if (T.hash_count++ >= T.hash_max)
592 P(rehash)(TTC 2*T.hash_size);
597 #ifdef HASH_WANT_LOOKUP
599 * Finds a node with a given key. If it does not exist, a new one is created.
600 * It is strongly recommended to use <<give_init_data,`HASH_GIVE_INIT_DATA`>>.
602 * This one is enabled by the <<want_lookup,`HASH_WANT_LOOKUP`>> macro.
604 static HASH_NODE* HASH_PREFIX(lookup)(TAC HASH_KEY_DECL)
606 uns h0 = P(hash) (TTC HASH_KEY( ));
607 uns h = h0 % T.hash_size;
610 for (b=T.ht[h]; b; b=b->next)
613 #ifndef HASH_CONSERVE_SPACE
616 P(eq)(TTC HASH_KEY( ), HASH_KEY(b->n.)))
620 b = P(new_bucket) (TTC sizeof(struct P(bucket)) + HASH_EXTRA_SIZE(HASH_KEY( )));
623 #ifndef HASH_CONSERVE_SPACE
626 P(init_key)(TTC &b->n, HASH_KEY( ));
627 P(init_data)(TTC &b->n);
628 if (T.hash_count++ >= T.hash_max)
629 P(rehash)(TTC 2*T.hash_size);
634 #ifdef HASH_WANT_DELETE
636 * Removes a node with the given key from hash table and deallocates it.
638 * Success is returned.
640 * This one is enabled by <<want_delete,`HASH_WANT_DELETE`>> macro.
642 static int HASH_PREFIX(delete)(TAC HASH_KEY_DECL)
644 uns h0 = P(hash) (TTC HASH_KEY( ));
645 uns h = h0 % T.hash_size;
648 for (bb=&T.ht[h]; b=*bb; bb=&b->next)
651 #ifndef HASH_CONSERVE_SPACE
654 P(eq)(TTC HASH_KEY( ), HASH_KEY(b->n.)))
659 #ifndef HASH_TABLE_GROWING
660 if (T.hash_count < T.hash_min)
661 P(rehash)(TTC T.hash_size/2);
670 #ifdef HASH_WANT_REMOVE
672 * Removes a given node and deallocates it.
673 * It differs from <<fun__GENERIC_LINK|HASH_PREFIX|delete,`HASH_PREFIX(delete)()`>>
674 * in its type of parameter -- this one deletes a specific node, that one looks for it by a key.
676 * Enabled by <<want_remove,`HASH_WANT_REMOVE`>> macro.
678 static void HASH_PREFIX(remove)(TAC HASH_NODE *n)
680 P(bucket) *x = SKIP_BACK(struct P(bucket), n, n);
681 uns h0 = P(bucket_hash)(TTC x);
682 uns h = h0 % T.hash_size;
685 for (bb=&T.ht[h]; (b=*bb) && b != x; bb=&b->next)
691 #ifndef HASH_TABLE_GROWING
692 if (T.hash_count < T.hash_min)
693 P(rehash)(TTC T.hash_size/2);
698 /* And the iterator */
702 #define HASH_FOR_ALL_DYNAMIC(h_px, h_table, h_var) \
705 struct GLUE_(h_px,bucket) *h_buck; \
706 for (h_slot=0; h_slot < (h_table)->hash_size; h_slot++) \
707 for (h_buck = (h_table)->ht[h_slot]; h_buck; h_buck = h_buck->next) \
709 GLUE_(h_px,node) *h_var = &h_buck->n;
710 #define HASH_FOR_ALL(h_px, h_var) HASH_FOR_ALL_DYNAMIC(h_px, &GLUE_(h_px,table), h_var)
711 #define HASH_END_FOR } } while(0)
713 #define HASH_CONTINUE continue
717 /* Finally, undefine all the parameters */
728 #undef HASH_ATOMIC_TYPE
729 #undef HASH_CONSERVE_SPACE
730 #undef HASH_DEFAULT_SIZE
731 #undef HASH_EXTRA_SIZE
733 #undef HASH_GIVE_ALLOC
734 #undef HASH_GIVE_TABLE_ALLOC
736 #undef HASH_GIVE_EXTRA_SIZE
737 #undef HASH_GIVE_HASHFN
738 #undef HASH_GIVE_INIT_DATA
739 #undef HASH_GIVE_INIT_KEY
741 #undef HASH_KEY_ATOMIC
742 #undef HASH_KEY_COMPLEX
744 #undef HASH_KEY_ENDSTRING
745 #undef HASH_KEY_STRING
746 #undef HASH_KEY_MEMORY
752 #undef HASH_AUTO_POOL
753 #undef HASH_USE_ELTPOOL
754 #undef HASH_AUTO_ELTPOOL
755 #undef HASH_WANT_CLEANUP
756 #undef HASH_WANT_DELETE
757 #undef HASH_WANT_FIND
758 #undef HASH_WANT_FIND_NEXT
759 #undef HASH_WANT_LOOKUP
761 #undef HASH_WANT_REMOVE
762 #undef HASH_TABLE_ALLOC
763 #undef HASH_TABLE_GROWING
764 #undef HASH_TABLE_DYNAMIC
765 #undef HASH_TABLE_VARS
766 #undef HASH_ZERO_FILL