projects
/
libusual.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0870ac3
)
hashtab: allow override max fill
author
Marko Kreen
<markokr@gmail.com>
Tue, 8 Dec 2009 12:02:27 +0000
(14:02 +0200)
committer
Marko Kreen
<markokr@gmail.com>
Tue, 8 Dec 2009 12:03:18 +0000
(14:03 +0200)
usual/hashtab-impl.h
patch
|
blob
|
blame
|
history
diff --git
a/usual/hashtab-impl.h
b/usual/hashtab-impl.h
index de5cdf33c0559190006d1d1820abee5bb2139a7e..a9482a6ab82b850c70fc8b732f8df6ce2bf9da1f 100644
(file)
--- a/
usual/hashtab-impl.h
+++ b/
usual/hashtab-impl.h
@@
-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;