]> mj.ucw.cz Git - libucw.git/blobdiff - lib/hashtable.h
Setting of LIBS is no longer necessary.
[libucw.git] / lib / hashtable.h
index aa73ad8f8f69732bfbc07183d355b8fa7d839e77..4dc223fec61b4c0f31adbdfb310d11dfb2dde8c2 100644 (file)
@@ -317,8 +317,6 @@ static inline void P(init_data) (TAUC P(node) *n UNUSED)
 }
 #endif
 
-#include <stdlib.h>
-
 #ifdef HASH_GIVE_ALLOC
 /* If the caller has requested to use his own allocation functions, do so */
 static inline void P(init_alloc) (TAU) { }
@@ -351,8 +349,8 @@ static inline void P(cleanup_alloc) (TAU) { }
 #endif
 
 #ifdef HASH_TABLE_ALLOC
-static inline void * P(table_alloc) (TAUC unsigned int size) { return P(alloc)(size); }
-static inline void P(table_free) (TAUC void *x) { P(free)(x); }
+static inline void * P(table_alloc) (TAUC unsigned int size) { return P(alloc)(TTC size); }
+static inline void P(table_free) (TAUC void *x) { P(free)(TTC x); }
 #else
 static inline void * P(table_alloc) (TAUC unsigned int size) { return xmalloc(size); }
 static inline void P(table_free) (TAUC void *x) { xfree(x); }
@@ -381,7 +379,7 @@ static inline void * P(new_bucket)(TAUC uns size) { return P(alloc)(TTC size); }
 
 static void P(alloc_table) (TAU)
 {
-  T.hash_size = nextprime(T.hash_size);
+  T.hash_size = next_table_prime(T.hash_size);
   T.ht = P(table_alloc)(TTC sizeof(void *) * T.hash_size);
   bzero(T.ht, sizeof(void *) * T.hash_size);
   if (2*T.hash_size < T.hash_hard_max)
@@ -613,7 +611,7 @@ do {                                                                                        \
        GLUE_(h_px,node) *h_var = &h_buck->n;
 #define HASH_FOR_ALL(h_px, h_var) HASH_FOR_ALL_DYNAMIC(h_px, &GLUE_(h_px,table), h_var)
 #define HASH_END_FOR } } while(0)
-#define HASH_BREAK 
+#define HASH_BREAK
 #define HASH_CONTINUE continue
 
 #endif