summaryrefslogtreecommitdiff
path: root/compiler/hashmap.c
diff options
context:
space:
mode:
authorQuinn Stephens <quinn@osmora.org>2024-11-03 19:12:47 -0500
committerQuinn Stephens <quinn@osmora.org>2024-11-03 19:12:47 -0500
commit063c40584ae78a396b558a5e2a08e3d871450c0b (patch)
tree1acca2d57ba421530b1cfd2a23f0658e35e7ebae /compiler/hashmap.c
parent71b10c1c765196a771ce05216395d6b78892a735 (diff)
[compiler] Parse and print procedure declarations
Signed-off-by: Quinn Stephens <quinn@osmora.org>
Diffstat (limited to 'compiler/hashmap.c')
-rw-r--r--compiler/hashmap.c10
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;
}