diff options
Diffstat (limited to 'src/gehashmap.h')
-rw-r--r-- | src/gehashmap.h | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/gehashmap.h b/src/gehashmap.h index 2fc9ffb..9415589 100644 --- a/src/gehashmap.h +++ b/src/gehashmap.h @@ -87,14 +87,9 @@ void \ n##_free(n##_t *map) \ { \ - for (size_t i = 0; i < map->capacity; i++) { \ - struct n##_entry *entry = map->entries[i]; \ - while (entry != NULL) { \ - struct n##_entry *next = entry->next; \ - free(entry); \ - entry = next; \ - } \ - } \ + struct n##_entry *entry, *tmp; \ + GEHASHMAP_FOREACH_SAFE(entry, tmp, map) \ + free(entry); \ free(map->entries); \ } \ \ |