]> mj.ucw.cz Git - libucw.git/blob - lib/hashtable.h
install sorter-globals.h header
[libucw.git] / lib / hashtable.h
1 /*
2  *      UCW Library -- Universal Hash Table
3  *
4  *      (c) 2002--2004 Martin Mares <mj@ucw.cz>
5  *      (c) 2002--2005 Robert Spalek <robert@ucw.cz>
6  *
7  *      This software may be freely distributed and used according to the terms
8  *      of the GNU Lesser General Public License.
9  */
10
11 /*
12  *  This is not a normal header file, it's a generator of hash tables.
13  *  Each time you include it with parameters set in the corresponding
14  *  preprocessor macros, it generates a hash table with the parameters
15  *  given.
16  *
17  *  You need to specify:
18  *
19  *  HASH_NODE           data type where a node dwells (usually a struct).
20  *  HASH_PREFIX(x)      macro to add a name prefix (used on all global names
21  *                      defined by the hash table generator).
22  *
23  *  Then decide on type of keys:
24  *
25  *  HASH_KEY_ATOMIC=f   use node->f as a key of an atomic type (i.e.,
26  *                      a type which can be compared using `==')
27  *                      HASH_ATOMIC_TYPE (defaults to int).
28  *  | HASH_KEY_STRING=f use node->f as a string key, allocated
29  *                      separately from the rest of the node.
30  *  | HASH_KEY_ENDSTRING=f use node->f as a string key, allocated
31  *                      automatically at the end of the node struct
32  *                      (to be declared as "char f[1]" at the end).
33  *  | HASH_KEY_COMPLEX  use a multi-component key; as the name suggests,
34  *                      the passing of parameters is a bit complex then.
35  *                      The HASH_KEY_COMPLEX(x) macro should expand to
36  *                      `x k1, x k2, ... x kn' and you should also define:
37  *    HASH_KEY_DECL     declaration of function parameters in which key
38  *                      should be passed to all hash table operations.
39  *                      That is, `type1 k1, type2 k2, ... typen kn'.
40  *                      With complex keys, HASH_GIVE_HASHFN and HASH_GIVE_EQ
41  *                      are mandatory.
42  *  | HASH_KEY_MEMORY=f use node->f as a raw data key, compared using
43  *                      memcmp
44  *    HASH_KEY_SIZE     the length of the key block
45  *
46  *  Then specify what operations you request (all names are automatically
47  *  prefixed by calling HASH_PREFIX):
48  *
49  *  <always defined>    init() -- initialize the hash table.
50  *  HASH_WANT_CLEANUP   cleanup() -- deallocate the hash table.
51  *  HASH_WANT_FIND      node *find(key) -- find first node with the specified
52  *                      key, return NULL if no such node exists.
53  *  HASH_WANT_FIND_NEXT node *find(node *start) -- find next node with the
54  *                      specified key, return NULL if no such node exists.
55  *  HASH_WANT_NEW       node *new(key) -- create new node with given key.
56  *                      Doesn't check whether it already exists.
57  *  HASH_WANT_LOOKUP    node *lookup(key) -- find node with given key,
58  *                      if it doesn't exist, create it. Defining
59  *                      HASH_GIVE_INIT_DATA is strongly recommended.
60  *  HASH_WANT_DELETE    int delete(key) -- delete and deallocate node
61  *                      with given key. Returns success.
62  *  HASH_WANT_REMOVE    remove(node *) -- delete and deallocate given node.
63  *
64  *  You can also supply several functions:
65  *
66  *  HASH_GIVE_HASHFN    unsigned int hash(key) -- calculate hash value of key.
67  *                      We have sensible default hash functions for strings
68  *                      and integers.
69  *  HASH_GIVE_EQ        int eq(key1, key2) -- return whether keys are equal.
70  *                      By default, we use == for atomic types and either
71  *                      strcmp or strcasecmp for strings.
72  *  HASH_GIVE_EXTRA_SIZE int extra_size(key) -- returns how many bytes after the
73  *                      node should be allocated for dynamic data. Default=0
74  *                      or length of the string with HASH_KEY_ENDSTRING.
75  *  HASH_GIVE_INIT_KEY  void init_key(node *,key) -- initialize key in a newly
76  *                      created node. Defaults: assignment for atomic keys
77  *                      and static strings, strcpy for end-allocated strings.
78  *  HASH_GIVE_INIT_DATA void init_data(node *) -- initialize data fields in a
79  *                      newly created node. Very useful for lookup operations.
80  *  HASH_GIVE_ALLOC     void *alloc(unsigned int size) -- allocate space for
81  *                      a node. Default is xmalloc() or pooled allocation, depending
82  *                      on HASH_USE_POOL and HASH_AUTO_POOL switches.
83  *                      void free(void *) -- the converse.
84  *
85  *  ... and a couple of extra parameters:
86  *
87  *  HASH_NOCASE         String comparisons should be case-insensitive.
88  *  HASH_DEFAULT_SIZE=n Initially, use hash table of approx. `n' entries.
89  *  HASH_CONSERVE_SPACE Use as little space as possible.
90  *  HASH_FN_BITS=n      The hash function gives only `n' significant bits.
91  *  HASH_ATOMIC_TYPE=t  Atomic values are of type `t' instead of int.
92  *  HASH_USE_POOL=pool  Allocate all nodes from given mempool. Note, however, that
93  *                      deallocation is not supported by mempools, so delete/remove
94  *                      will leak pool memory.
95  *  HASH_AUTO_POOL=size Create a pool of the given block size automatically.
96  *  HASH_ZERO_FILL      New entries should be initialized to all zeroes.
97  *  HASH_TABLE_ALLOC    The hash table itself will be allocated and freed using
98  *                      the same allocation functions as the nodes instead of
99  *                      the default xmalloc().
100  *  HASH_TABLE_DYNAMIC  Support multiple hash tables; the first parameter of all
101  *                      hash table operations is struct HASH_PREFIX(table) *.
102  *
103  *  You also get a iterator macro at no extra charge:
104  *
105  *  HASH_FOR_ALL(hash_prefix, variable)
106  *    {
107  *      // node *variable gets declared automatically
108  *      do_something_with_node(variable);
109  *      // use HASH_BREAK and HASH_CONTINUE instead of break and continue
110  *      // you must not alter contents of the hash table here
111  *    }
112  *  HASH_END_FOR;
113  *
114  *  (For dynamic tables, use HASH_FOR_ALL_DYNAMIC(hash_prefix, hash_table, variable) instead.)
115  *
116  *  Then include "lib/hashtable.h" and voila, you have a hash table
117  *  suiting all your needs (at least those which you've revealed :) ).
118  *
119  *  After including this file, all parameter macros are automatically
120  *  undef'd.
121  */
122
123 #ifndef _UCW_HASHFUNC_H
124 #include "lib/hashfunc.h"
125 #endif
126
127 #include <string.h>
128
129 /* Initial setup of parameters */
130
131 #if !defined(HASH_NODE) || !defined(HASH_PREFIX)
132 #error Some of the mandatory configuration macros are missing.
133 #endif
134
135 #if defined(HASH_KEY_ATOMIC) && !defined(HASH_CONSERVE_SPACE)
136 #define HASH_CONSERVE_SPACE
137 #endif
138
139 #define P(x) HASH_PREFIX(x)
140
141 /* Declare buckets and the hash table */
142
143 typedef HASH_NODE P(node);
144
145 typedef struct P(bucket) {
146   struct P(bucket) *next;
147 #ifndef HASH_CONSERVE_SPACE
148   uns hash;
149 #endif
150   P(node) n;
151 } P(bucket);
152
153 struct P(table) {
154   uns hash_size;
155   uns hash_count, hash_max, hash_min, hash_hard_max;
156   P(bucket) **ht;
157 #ifdef HASH_AUTO_POOL
158   struct mempool *pool;
159 #endif
160 };
161
162 #ifdef HASH_TABLE_DYNAMIC
163 #define T (*table)
164 #define TA struct P(table) *table
165 #define TAC TA,
166 #define TAU TA UNUSED
167 #define TAUC TA UNUSED,
168 #define TT table
169 #define TTC table,
170 #else
171 struct P(table) P(table);
172 #define T P(table)
173 #define TA void
174 #define TAC
175 #define TAU void
176 #define TAUC
177 #define TT
178 #define TTC
179 #endif
180
181 /* Preset parameters */
182
183 #if defined(HASH_KEY_ATOMIC)
184
185 #define HASH_KEY(x) x HASH_KEY_ATOMIC
186
187 #ifndef HASH_ATOMIC_TYPE
188 #  define HASH_ATOMIC_TYPE int
189 #endif
190 #define HASH_KEY_DECL HASH_ATOMIC_TYPE HASH_KEY( )
191
192 #ifndef HASH_GIVE_HASHFN
193 #  define HASH_GIVE_HASHFN
194    static inline int P(hash) (TAUC HASH_ATOMIC_TYPE x)
195    { return ((sizeof(x) <= 4) ? hash_u32(x) : hash_u64(x)); }
196 #endif
197
198 #ifndef HASH_GIVE_EQ
199 #  define HASH_GIVE_EQ
200    static inline int P(eq) (TAUC HASH_ATOMIC_TYPE x, HASH_ATOMIC_TYPE y)
201    { return x == y; }
202 #endif
203
204 #ifndef HASH_GIVE_INIT_KEY
205 #  define HASH_GIVE_INIT_KEY
206    static inline void P(init_key) (TAUC P(node) *n, HASH_ATOMIC_TYPE k)
207    { HASH_KEY(n->) = k; }
208 #endif
209
210 #elif defined(HASH_KEY_MEMORY)
211
212 #define HASH_KEY(x) x HASH_KEY_MEMORY
213
214 #define HASH_KEY_DECL byte HASH_KEY( )[HASH_KEY_SIZE]
215
216 #ifndef HASH_GIVE_HASHFN
217 #  define HASH_GIVE_HASHFN
218    static inline int P(hash) (TAUC byte *x)
219    { return hash_block(x, HASH_KEY_SIZE); }
220 #endif
221
222 #ifndef HASH_GIVE_EQ
223 #  define HASH_GIVE_EQ
224    static inline int P(eq) (TAUC byte *x, byte *y)
225    { return !memcmp(x, y, HASH_KEY_SIZE); }
226 #endif
227
228 #ifndef HASH_GIVE_INIT_KEY
229 #  define HASH_GIVE_INIT_KEY
230    static inline void P(init_key) (TAUC P(node) *n, byte *k)
231    { memcpy(HASH_KEY(n->), k, HASH_KEY_SIZE); }
232 #endif
233
234 #elif defined(HASH_KEY_STRING) || defined(HASH_KEY_ENDSTRING)
235
236 #ifdef HASH_KEY_STRING
237 #  define HASH_KEY(x) x HASH_KEY_STRING
238 #  ifndef HASH_GIVE_INIT_KEY
239 #    define HASH_GIVE_INIT_KEY
240      static inline void P(init_key) (TAUC P(node) *n, char *k)
241      { HASH_KEY(n->) = k; }
242 #  endif
243 #else
244 #  define HASH_KEY(x) x HASH_KEY_ENDSTRING
245 #  define HASH_GIVE_EXTRA_SIZE
246    static inline int P(extra_size) (TAUC char *k)
247    { return strlen(k); }
248 #  ifndef HASH_GIVE_INIT_KEY
249 #    define HASH_GIVE_INIT_KEY
250      static inline void P(init_key) (TAUC P(node) *n, char *k)
251      { strcpy(HASH_KEY(n->), k); }
252 #  endif
253 #endif
254 #define HASH_KEY_DECL char *HASH_KEY( )
255
256 #ifndef HASH_GIVE_HASHFN
257 #define HASH_GIVE_HASHFN
258   static inline uns P(hash) (TAUC char *k)
259    {
260 #    ifdef HASH_NOCASE
261        return hash_string_nocase(k);
262 #    else
263        return hash_string(k);
264 #    endif
265    }
266 #endif
267
268 #ifndef HASH_GIVE_EQ
269 #  define HASH_GIVE_EQ
270    static inline int P(eq) (TAUC char *x, char *y)
271    {
272 #    ifdef HASH_NOCASE
273        return !strcasecmp(x,y);
274 #    else
275        return !strcmp(x,y);
276 #    endif
277    }
278 #endif
279
280 #elif defined(HASH_KEY_COMPLEX)
281
282 #define HASH_KEY(x) HASH_KEY_COMPLEX(x)
283
284 #else
285 #error You forgot to set the hash key type.
286 #endif
287
288 /* Defaults for missing parameters */
289
290 #ifndef HASH_GIVE_HASHFN
291 #error Unable to determine which hash function to use.
292 #endif
293
294 #ifndef HASH_GIVE_EQ
295 #error Unable to determine how to compare two keys.
296 #endif
297
298 #ifdef HASH_GIVE_EXTRA_SIZE
299 /* This trickery is needed to avoid `unused parameter' warnings */
300 #define HASH_EXTRA_SIZE(x) P(extra_size)(TTC x)
301 #else
302 /*
303  *  Beware, C macros are expanded iteratively, not recursively,
304  *  hence we get only a _single_ argument, although the expansion
305  *  of HASH_KEY contains commas.
306  */
307 #define HASH_EXTRA_SIZE(x) 0
308 #endif
309
310 #ifndef HASH_GIVE_INIT_KEY
311 #error Unable to determine how to initialize keys.
312 #endif
313
314 #ifndef HASH_GIVE_INIT_DATA
315 static inline void P(init_data) (TAUC P(node) *n UNUSED)
316 {
317 }
318 #endif
319
320 #ifdef HASH_GIVE_ALLOC
321 /* If the caller has requested to use his own allocation functions, do so */
322 static inline void P(init_alloc) (TAU) { }
323 static inline void P(cleanup_alloc) (TAU) { }
324
325 #elif defined(HASH_USE_POOL)
326 /* If the caller has requested to use his mempool, do so */
327 #include "lib/mempool.h"
328 static inline void * P(alloc) (TAUC unsigned int size) { return mp_alloc_fast(HASH_USE_POOL, size); }
329 static inline void P(free) (TAUC void *x UNUSED) { }
330 static inline void P(init_alloc) (TAU) { }
331 static inline void P(cleanup_alloc) (TAU) { }
332
333 #elif defined(HASH_AUTO_POOL)
334 /* Use our own pools */
335 #include "lib/mempool.h"
336 static inline void * P(alloc) (TAUC unsigned int size) { return mp_alloc_fast(T.pool, size); }
337 static inline void P(free) (TAUC void *x UNUSED) { }
338 static inline void P(init_alloc) (TAU) { T.pool = mp_new(HASH_AUTO_POOL); }
339 static inline void P(cleanup_alloc) (TAU) { mp_delete(T.pool); }
340 #define HASH_USE_POOL
341
342 #else
343 /* The default allocation method */
344 static inline void * P(alloc) (TAUC unsigned int size) { return xmalloc(size); }
345 static inline void P(free) (TAUC void *x) { xfree(x); }
346 static inline void P(init_alloc) (TAU) { }
347 static inline void P(cleanup_alloc) (TAU) { }
348
349 #endif
350
351 #ifdef HASH_TABLE_ALLOC
352 static inline void * P(table_alloc) (TAUC unsigned int size) { return P(alloc)(TTC size); }
353 static inline void P(table_free) (TAUC void *x) { P(free)(TTC x); }
354 #else
355 static inline void * P(table_alloc) (TAUC unsigned int size) { return xmalloc(size); }
356 static inline void P(table_free) (TAUC void *x) { xfree(x); }
357 #endif
358
359 #ifndef HASH_DEFAULT_SIZE
360 #define HASH_DEFAULT_SIZE 32
361 #endif
362
363 #ifndef HASH_FN_BITS
364 #define HASH_FN_BITS 32
365 #endif
366
367 #ifdef HASH_ZERO_FILL
368 static inline void * P(new_bucket)(TAUC uns size)
369 {
370   byte *buck = P(alloc)(TTC size);
371   bzero(buck, size);
372   return buck;
373 }
374 #else
375 static inline void * P(new_bucket)(TAUC uns size) { return P(alloc)(TTC size); }
376 #endif
377
378 /* Now the operations */
379
380 static void P(alloc_table) (TAU)
381 {
382   T.hash_size = next_table_prime(T.hash_size);
383   T.ht = P(table_alloc)(TTC sizeof(void *) * T.hash_size);
384   bzero(T.ht, sizeof(void *) * T.hash_size);
385   if (2*T.hash_size < T.hash_hard_max)
386     T.hash_max = 2*T.hash_size;
387   else
388     T.hash_max = ~0U;
389   if (T.hash_size/2 > HASH_DEFAULT_SIZE)
390     T.hash_min = T.hash_size/4;
391   else
392     T.hash_min = 0;
393 }
394
395 static void P(init) (TA)
396 {
397   T.hash_count = 0;
398   T.hash_size = HASH_DEFAULT_SIZE;
399 #if HASH_FN_BITS < 28
400   T.hash_hard_max = 1 << HASH_FN_BITS;
401 #else
402   T.hash_hard_max = 1 << 28;
403 #endif
404   P(alloc_table)(TT);
405   P(init_alloc)(TT);
406 }
407
408 #ifdef HASH_WANT_CLEANUP
409 static void P(cleanup) (TA)
410 {
411 #ifndef HASH_USE_POOL
412   uns i;
413   P(bucket) *b, *bb;
414
415   for (i=0; i<T.hash_size; i++)
416     for (b=T.ht[i]; b; b=bb)
417       {
418         bb = b->next;
419         P(free)(TTC b);
420       }
421 #endif
422   P(cleanup_alloc)(TT);
423   P(table_free)(TTC T.ht);
424 }
425 #endif
426
427 static inline uns P(bucket_hash) (TAUC P(bucket) *b)
428 {
429 #ifdef HASH_CONSERVE_SPACE
430   return P(hash)(TTC HASH_KEY(b->n.));
431 #else
432   return b->hash;
433 #endif
434 }
435
436 static void P(rehash) (TAC uns size)
437 {
438   P(bucket) *b, *nb;
439   P(bucket) **oldt = T.ht, **newt;
440   uns oldsize = T.hash_size;
441   uns i, h;
442
443   DBG("Rehashing %d->%d at count %d", oldsize, size, T.hash_count);
444   T.hash_size = size;
445   P(alloc_table)(TT);
446   newt = T.ht;
447   for (i=0; i<oldsize; i++)
448     {
449       b = oldt[i];
450       while (b)
451         {
452           nb = b->next;
453           h = P(bucket_hash)(TTC b) % T.hash_size;
454           b->next = newt[h];
455           newt[h] = b;
456           b = nb;
457         }
458     }
459   P(table_free)(TTC oldt);
460 }
461
462 #ifdef HASH_WANT_FIND
463 static P(node) * P(find) (TAC HASH_KEY_DECL)
464 {
465   uns h0 = P(hash) (TTC HASH_KEY( ));
466   uns h = h0 % T.hash_size;
467   P(bucket) *b;
468
469   for (b=T.ht[h]; b; b=b->next)
470     {
471       if (
472 #ifndef HASH_CONSERVE_SPACE
473           b->hash == h0 &&
474 #endif
475           P(eq)(TTC HASH_KEY( ), HASH_KEY(b->n.)))
476         return &b->n;
477     }
478   return NULL;
479 }
480 #endif
481
482 #ifdef HASH_WANT_FIND_NEXT
483 static P(node) * P(find_next) (TAC P(node) *start)
484 {
485 #ifndef HASH_CONSERVE_SPACE
486   uns h0 = P(hash) (TTC HASH_KEY(start->));
487 #endif
488   P(bucket) *b = SKIP_BACK(P(bucket), n, start);
489
490   for (b=b->next; b; b=b->next)
491     {
492       if (
493 #ifndef HASH_CONSERVE_SPACE
494           b->hash == h0 &&
495 #endif
496           P(eq)(TTC HASH_KEY(start->), HASH_KEY(b->n.)))
497         return &b->n;
498     }
499   return NULL;
500 }
501 #endif
502
503 #ifdef HASH_WANT_NEW
504 static P(node) * P(new) (TAC HASH_KEY_DECL)
505 {
506   uns h0, h;
507   P(bucket) *b;
508
509   h0 = P(hash) (TTC HASH_KEY( ));
510   h = h0 % T.hash_size;
511   b = P(new_bucket) (TTC sizeof(struct P(bucket)) + HASH_EXTRA_SIZE(HASH_KEY( )));
512   b->next = T.ht[h];
513   T.ht[h] = b;
514 #ifndef HASH_CONSERVE_SPACE
515   b->hash = h0;
516 #endif
517   P(init_key)(TTC &b->n, HASH_KEY( ));
518   P(init_data)(TTC &b->n);
519   if (T.hash_count++ >= T.hash_max)
520     P(rehash)(TTC 2*T.hash_size);
521   return &b->n;
522 }
523 #endif
524
525 #ifdef HASH_WANT_LOOKUP
526 static P(node) * P(lookup) (TAC HASH_KEY_DECL)
527 {
528   uns h0 = P(hash) (TTC HASH_KEY( ));
529   uns h = h0 % T.hash_size;
530   P(bucket) *b;
531
532   for (b=T.ht[h]; b; b=b->next)
533     {
534       if (
535 #ifndef HASH_CONSERVE_SPACE
536           b->hash == h0 &&
537 #endif
538           P(eq)(TTC HASH_KEY( ), HASH_KEY(b->n.)))
539         return &b->n;
540     }
541
542   b = P(new_bucket) (TTC sizeof(struct P(bucket)) + HASH_EXTRA_SIZE(HASH_KEY( )));
543   b->next = T.ht[h];
544   T.ht[h] = b;
545 #ifndef HASH_CONSERVE_SPACE
546   b->hash = h0;
547 #endif
548   P(init_key)(TTC &b->n, HASH_KEY( ));
549   P(init_data)(TTC &b->n);
550   if (T.hash_count++ >= T.hash_max)
551     P(rehash)(TTC 2*T.hash_size);
552   return &b->n;
553 }
554 #endif
555
556 #ifdef HASH_WANT_DELETE
557 static int P(delete) (TAC HASH_KEY_DECL)
558 {
559   uns h0 = P(hash) (TTC HASH_KEY( ));
560   uns h = h0 % T.hash_size;
561   P(bucket) *b, **bb;
562
563   for (bb=&T.ht[h]; b=*bb; bb=&b->next)
564     {
565       if (
566 #ifndef HASH_CONSERVE_SPACE
567           b->hash == h0 &&
568 #endif
569           P(eq)(TTC HASH_KEY( ), HASH_KEY(b->n.)))
570         {
571           *bb = b->next;
572           P(free)(TTC b);
573           if (--T.hash_count < T.hash_min)
574             P(rehash)(TTC T.hash_size/2);
575           return 1;
576         }
577     }
578   return 0;
579 }
580 #endif
581
582 #ifdef HASH_WANT_REMOVE
583 static void P(remove) (TAC P(node) *n)
584 {
585   P(bucket) *x = SKIP_BACK(struct P(bucket), n, n);
586   uns h0 = P(bucket_hash)(TTC x);
587   uns h = h0 % T.hash_size;
588   P(bucket) *b, **bb;
589
590   for (bb=&T.ht[h]; (b=*bb) && b != x; bb=&b->next)
591     ;
592   ASSERT(b);
593   *bb = b->next;
594   P(free)(TTC b);
595   if (--T.hash_count < T.hash_min)
596     P(rehash)(TTC T.hash_size/2);
597 }
598 #endif
599
600 /* And the iterator */
601
602 #ifndef HASH_FOR_ALL
603
604 #define HASH_FOR_ALL_DYNAMIC(h_px, h_table, h_var)                                      \
605 do {                                                                                    \
606   uns h_slot;                                                                           \
607   struct GLUE_(h_px,bucket) *h_buck;                                                    \
608   for (h_slot=0; h_slot < (h_table)->hash_size; h_slot++)                               \
609     for (h_buck = (h_table)->ht[h_slot]; h_buck; h_buck = h_buck->next)                 \
610       {                                                                                 \
611         GLUE_(h_px,node) *h_var = &h_buck->n;
612 #define HASH_FOR_ALL(h_px, h_var) HASH_FOR_ALL_DYNAMIC(h_px, &GLUE_(h_px,table), h_var)
613 #define HASH_END_FOR } } while(0)
614 #define HASH_BREAK
615 #define HASH_CONTINUE continue
616
617 #endif
618
619 /* Finally, undefine all the parameters */
620
621 #undef P
622 #undef T
623 #undef TA
624 #undef TAC
625 #undef TAU
626 #undef TAUC
627 #undef TT
628 #undef TTC
629
630 #undef HASH_ATOMIC_TYPE
631 #undef HASH_CONSERVE_SPACE
632 #undef HASH_DEFAULT_SIZE
633 #undef HASH_EXTRA_SIZE
634 #undef HASH_FN_BITS
635 #undef HASH_GIVE_ALLOC
636 #undef HASH_GIVE_EQ
637 #undef HASH_GIVE_EXTRA_SIZE
638 #undef HASH_GIVE_HASHFN
639 #undef HASH_GIVE_INIT_DATA
640 #undef HASH_GIVE_INIT_KEY
641 #undef HASH_KEY
642 #undef HASH_KEY_ATOMIC
643 #undef HASH_KEY_COMPLEX
644 #undef HASH_KEY_DECL
645 #undef HASH_KEY_ENDSTRING
646 #undef HASH_KEY_STRING
647 #undef HASH_NOCASE
648 #undef HASH_NODE
649 #undef HASH_PREFIX
650 #undef HASH_USE_POOL
651 #undef HASH_AUTO_POOL
652 #undef HASH_WANT_CLEANUP
653 #undef HASH_WANT_DELETE
654 #undef HASH_WANT_FIND
655 #undef HASH_WANT_FIND_NEXT
656 #undef HASH_WANT_LOOKUP
657 #undef HASH_WANT_NEW
658 #undef HASH_WANT_REMOVE
659 #undef HASH_TABLE_ALLOC
660 #undef HASH_TABLE_DYNAMIC
661 #undef HASH_ZERO_FILL