diff options
Diffstat (limited to 'src/hashtable.c')
| -rw-r--r-- | src/hashtable.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/hashtable.c b/src/hashtable.c index 08ff934..3568f3c 100644 --- a/src/hashtable.c +++ b/src/hashtable.c | |||
| @@ -24,7 +24,7 @@ hashtable_t* hash_table_new(hash_func_t hash_func, compare_func_t compare_func) | |||
| 24 | { | 24 | { |
| 25 | hashtable_t* ht = (hashtable_t*)malloc(sizeof(hashtable_t)); | 25 | hashtable_t* ht = (hashtable_t*)malloc(sizeof(hashtable_t)); |
| 26 | int i; | 26 | int i; |
| 27 | for (i = 0; i < 256; i++) { | 27 | for (i = 0; i < 4096; i++) { |
| 28 | ht->entries[i] = NULL; | 28 | ht->entries[i] = NULL; |
| 29 | } | 29 | } |
| 30 | ht->count = 0; | 30 | ht->count = 0; |
| @@ -38,7 +38,7 @@ void hash_table_destroy(hashtable_t *ht) | |||
| 38 | if (!ht) return; | 38 | if (!ht) return; |
| 39 | 39 | ||
| 40 | int i = 0; | 40 | int i = 0; |
| 41 | for (i = 0; i < 256; i++) { | 41 | for (i = 0; i < 4096; i++) { |
| 42 | if (ht->entries[i]) { | 42 | if (ht->entries[i]) { |
| 43 | hashentry_t* e = ht->entries[i]; | 43 | hashentry_t* e = ht->entries[i]; |
| 44 | while (e) { | 44 | while (e) { |
| @@ -58,7 +58,7 @@ void hash_table_insert(hashtable_t* ht, void *key, void *value) | |||
| 58 | 58 | ||
| 59 | unsigned int hash = ht->hash_func(key); | 59 | unsigned int hash = ht->hash_func(key); |
| 60 | 60 | ||
| 61 | int idx0 = hash & 0xFF; | 61 | int idx0 = hash & 0xFFF; |
| 62 | 62 | ||
| 63 | // get the idx0 list | 63 | // get the idx0 list |
| 64 | hashentry_t* e = ht->entries[idx0]; | 64 | hashentry_t* e = ht->entries[idx0]; |
| @@ -93,7 +93,7 @@ void* hash_table_lookup(hashtable_t* ht, void *key) | |||
| 93 | if (!ht || !key) return NULL; | 93 | if (!ht || !key) return NULL; |
| 94 | unsigned int hash = ht->hash_func(key); | 94 | unsigned int hash = ht->hash_func(key); |
| 95 | 95 | ||
| 96 | int idx0 = hash & 0xFF; | 96 | int idx0 = hash & 0xFFF; |
| 97 | 97 | ||
| 98 | hashentry_t* e = ht->entries[idx0]; | 98 | hashentry_t* e = ht->entries[idx0]; |
| 99 | while (e) { | 99 | while (e) { |
