diff options
Diffstat (limited to 'src/hashmap.c')
-rw-r--r-- | src/hashmap.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/hashmap.c b/src/hashmap.c index cc7f2db..d4d6358 100644 --- a/src/hashmap.c +++ b/src/hashmap.c @@ -46,16 +46,18 @@ hashmap_add(struct hashmap map, struct hashmap_entry *entry) struct hashmap_entry * hashmap_find(struct hashmap map, hash_t hash) { - struct hashmap_entry *head, *entry; + struct list *list; + struct hashmap_entry *entry; - entry = head = (struct hashmap_entry *)map.rows[hash % map.row_count].head; - do { + list = &map.rows[hash % map.row_count]; + entry = (struct hashmap_entry *)list->head; + while (entry != (struct hashmap_entry *)list) { if (entry->hash == hash) { return entry; } entry = (struct hashmap_entry *)entry->list_entry.next; - } while (entry != head); + } return NULL; } |