hashtab: allow override max fill
authorMarko Kreen <markokr@gmail.com>
Tue, 8 Dec 2009 12:02:27 +0000 (14:02 +0200)
committerMarko Kreen <markokr@gmail.com>
Tue, 8 Dec 2009 12:03:18 +0000 (14:03 +0200)
usual/hashtab-impl.h

index de5cdf33c0559190006d1d1820abee5bb2139a7e..a9482a6ab82b850c70fc8b732f8df6ce2bf9da1f 100644 (file)
@@ -57,10 +57,14 @@ struct HashItem {
 
 typedef bool (*hash_cmp_fn)(const htab_val_t curval, const void *arg);
 
+#ifndef HTAB_MAX_FILL
+#define HTAB_MAX_FILL 75
+#endif
+
 #define MASK(h) ((h)->size - 1)
 #define CALC_POS(h, key) (key & MASK(h))
 #define NEXT_POS(h, pos) (((pos) * 5 + 1) & MASK(h))
-#define MAX_USED(h) ((h)->size * 75 / 100)
+#define MAX_USED(h) ((h)->size * HTAB_MAX_FILL / 100)
 
 struct HashTab {
        struct HashTab *next;