diff options
Diffstat (limited to 'compiler/hashmap.c')
-rw-r--r-- | compiler/hashmap.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/hashmap.c b/compiler/hashmap.c index e5aed7b..e567224 100644 --- a/compiler/hashmap.c +++ b/compiler/hashmap.c @@ -17,16 +17,16 @@ 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 hashmap_entry *entry; - entry = head = (struct hashmap_entry*)(map->rows[hash % map->n_rows].head); - do { + entry = (struct hashmap_entry*)map->rows[hash % map->n_rows].head; + while (entry != (struct hashmap_entry*)&map->rows[hash % map->n_rows]) { if (entry->hash == hash) { return entry; } - entry = (struct hashmap_entry*)(entry->list_entry.next); - } while (entry != head); + entry = (struct hashmap_entry*)entry->list_entry.next; + } return NULL; } |