]> mj.ucw.cz Git - libucw.git/blobdiff - lib/hashtable.h
obj_add_attr_ref() with an on-stack buffer is not advisable, better
[libucw.git] / lib / hashtable.h
index 49d45ba7322da0c912340815c914cdf890e2e30f..1c40ea9d6729f3f7b61a75838fd9015d5e5852f1 100644 (file)
@@ -263,19 +263,19 @@ static inline void P(init_data) (P(node) *n UNUSED)
 
 #ifdef HASH_GIVE_ALLOC
 /* If the caller has requested to use his own allocation functions, do so */
-static inline void P(init_alloc) (void) { }
-static inline void P(cleanup_alloc) (void) { }
+static inline void P(init_alloc) (void) { }
+static inline void P(cleanup_alloc) (void) { }
 
 #elif defined(HASH_USE_POOL)
 /* If the caller has requested to use his mempool, do so */
-#include "lib/pools.h"
+#include "lib/mempool.h"
 static inline void * P(alloc) (unsigned int size) { return mp_alloc_fast(HASH_USE_POOL, size); }
-static inline void P(init_alloc) (void) { }
-static inline void P(cleanup_alloc) (void) { }
+static inline void P(init_alloc) (void) { }
+static inline void P(cleanup_alloc) (void) { }
 
 #elif defined(HASH_AUTO_POOL)
 /* Use our own pools */
-#include "lib/pools.h"
+#include "lib/mempool.h"
 static struct mempool *P(pool);
 static inline void * P(alloc) (unsigned int size) { return mp_alloc_fast(P(pool), size); }
 static inline void P(init_alloc) (void) { P(pool) = mp_new(HASH_AUTO_POOL); }
@@ -285,8 +285,8 @@ static inline void P(cleanup_alloc) (void) { mp_delete(P(pool)); }
 /* The default allocation method */
 static inline void * P(alloc) (unsigned int size) { return xmalloc(size); }
 static inline void P(free) (void *x) { xfree(x); }
-static inline void P(init_alloc) (void) { }
-static inline void P(cleanup_alloc) (void) { }
+static inline void P(init_alloc) (void) { }
+static inline void P(cleanup_alloc) (void) { }
 
 #endif
 
@@ -527,15 +527,14 @@ static void P(remove) (P(node) *n)
 #define HASH_FOR_ALL(h_px, h_var)                                                      \
 do {                                                                                   \
   uns h_slot;                                                                          \
-  struct HASH_GLUE(h_px,bucket) *h_buck;                                               \
-  for (h_slot=0; h_slot < HASH_GLUE(h_px,table).hash_size; h_slot++)                   \
-    for (h_buck = HASH_GLUE(h_px,table).ht[h_slot]; h_buck; h_buck = h_buck->next)     \
+  struct GLUE_(h_px,bucket) *h_buck;                                                   \
+  for (h_slot=0; h_slot < GLUE_(h_px,table).hash_size; h_slot++)                       \
+    for (h_buck = GLUE_(h_px,table).ht[h_slot]; h_buck; h_buck = h_buck->next) \
       {                                                                                        \
-       HASH_GLUE(h_px,node) *h_var = &h_buck->n;
+       GLUE_(h_px,node) *h_var = &h_buck->n;
 #define HASH_END_FOR } } while(0)
 #define HASH_BREAK 
 #define HASH_CONTINUE continue
-#define HASH_GLUE(x,y) x##_##y
 
 #endif