From 97a214db20684ef192478799b9ae050beebdfe60 Mon Sep 17 00:00:00 2001 From: Fabrice Date: Tue, 10 Feb 2026 10:26:50 +0100 Subject: fork --- src/hashm.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/hashm.h') diff --git a/src/hashm.h b/src/hashm.h index e1ed720..5e5e802 100644 --- a/src/hashm.h +++ b/src/hashm.h @@ -62,15 +62,17 @@ inline void wayc_hashmap_deinit(hashmap_s *map) { } template -inline V *wayc_hashmap_insert(hashmap_s *map, const K *key) { +inline V *wayc_hashmap_insert(hashmap_s *map, const K *key, + const V *value) { wayc_notnull(map); wayc_notnull(key); + wayc_notnull(value); hashentry_s entry{}; entry.key = *key; - auto *stored = (hashentry_s *)hashmap_set(map->inner, &entry); + entry.value = *value; + auto *stored = (hashentry_s *)hashmap_insert(map->inner, &entry); - wayc_notnull(stored); return &stored->value; } @@ -87,3 +89,13 @@ inline V *wayc_hashmap_get(hashmap_s *map, const K *key) { return &stored->value; } + +template +inline void wayc_hashmap_remove(hashmap_s *map, const K *key) { + wayc_notnull(map); + wayc_notnull(key); + + hashentry_s entry{}; + entry.key = *key; + hashmap_remove(map->inner, &entry); +} \ No newline at end of file -- cgit v1.2.3