summaryrefslogtreecommitdiffstats
path: root/list.c
diff options
context:
space:
mode:
Diffstat (limited to 'list.c')
-rw-r--r--list.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/list.c b/list.c
index 8849957..4fe7479 100644
--- a/list.c
+++ b/list.c
@@ -33,6 +33,7 @@
struct hash *
hash_init (const int n_buckets,
+ const uint32_t iv,
uint32_t (*hash_function)(const void *key, uint32_t iv),
bool (*compare_function)(const void *key1, const void *key2))
{
@@ -45,7 +46,7 @@ hash_init (const int n_buckets,
h->mask = h->n_buckets - 1;
h->hash_function = hash_function;
h->compare_function = compare_function;
- h->iv = get_random ();
+ h->iv = iv;
ALLOC_ARRAY (h->buckets, struct hash_bucket, h->n_buckets);
for (i = 0; i < h->n_buckets; ++i)
{
@@ -398,8 +399,8 @@ list_test (void)
{
struct gc_arena gc = gc_new ();
- struct hash *hash = hash_init (10000, word_hash_function, word_compare_function);
- struct hash *nhash = hash_init (256, word_hash_function, word_compare_function);
+ struct hash *hash = hash_init (10000, get_random (), word_hash_function, word_compare_function);
+ struct hash *nhash = hash_init (256, get_random (), word_hash_function, word_compare_function);
printf ("hash_init n_buckets=%d mask=0x%08x\n", hash->n_buckets, hash->mask);