From 26d8457a5da5d70226fdbba5ed92fda8cac735f6 Mon Sep 17 00:00:00 2001 From: Mosder Date: Fri, 10 Jul 2026 12:55:39 +0200 Subject: feat: added functions for iterating over a hashmap --- analyzer/utils/hashmap.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'analyzer/utils/hashmap.h') diff --git a/analyzer/utils/hashmap.h b/analyzer/utils/hashmap.h index 96e8b58..22c71c6 100644 --- a/analyzer/utils/hashmap.h +++ b/analyzer/utils/hashmap.h @@ -72,6 +72,21 @@ extern void *hashmap_get(HashMap *map, void *key); // - key - pointer to the key of the entry to delete extern void hashmap_delete(HashMap *map, void *key); +// get first node in the hashmap, use with hashmap_next to iterate over hashmap +// params: +// - map - hash map to get the first node from +// returns: +// pointer to the first node in the hashmap or NULL if there's no entries in it +extern HashMapNode *hashmap_first(HashMap *map); + +// get next node in the hashmap, use with hashmap_first to iterate over hashmap +// params: +// - map - hash map to get the next node from +// - node - the node preceeding the one we search for +// returns: +// pointer to the next node in the hashmap or NULL if there's no next +extern HashMapNode *hashmap_next(HashMap *map, HashMapNode *node); + // free the hash map // - map - hash map to free extern void hashmap_free(HashMap *map); -- cgit v1.2.3