From 063c40584ae78a396b558a5e2a08e3d871450c0b Mon Sep 17 00:00:00 2001 From: Quinn Stephens Date: Sun, 3 Nov 2024 19:12:47 -0500 Subject: [compiler] Parse and print procedure declarations Signed-off-by: Quinn Stephens --- compiler/hashmap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'compiler/hashmap.c') 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; } -- cgit v1.2.3