diff options
Diffstat (limited to 'src/gehashmap.h')
-rw-r--r-- | src/gehashmap.h | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/gehashmap.h b/src/gehashmap.h index 0a3d7c1..311c2c3 100644 --- a/src/gehashmap.h +++ b/src/gehashmap.h @@ -1,5 +1,5 @@ -#ifndef GEHASHMAP_H -#define GEHASHMAP_H +#ifndef LIBGE_GEHASHMAP_H +#define LIBGE_GEHASHMAP_H #include <stdbool.h> #include <stdlib.h> @@ -32,7 +32,6 @@ int n##_remove(n##_t *, k); \ int n##_resize(n##_t *, size_t); \ bool n##_key_iseq(k, k); \ - void n##_key_free(k); \ size_t n##_key_hash(k); #define GEHASHMAP_IMPL(k, v, n) \ @@ -60,7 +59,6 @@ struct n##_entry *entry = map->entries[i]; \ while (entry != NULL) { \ struct n##_entry *next = entry->next; \ - n##_key_free(entry->key); \ free(entry); \ entry = next; \ } \ @@ -171,9 +169,8 @@ } \ \ /* Function to remove an element with a given key from a hashmap. If - * the value was dynamically allocated it will not be freed. The key - * will be freed however as per n##_key_free(). On error -1 is - * returned, otherwise 0 is returned. + * the key or value were dynamically allocated they will not be freed. + * On error -1 is returned, otherwise 0 is returned. */ \ int \ n##_remove(n##_t *map, k key) \ @@ -186,7 +183,6 @@ \ if (n##_key_iseq(entry->key, key)) { \ map->entries[hash] = entry->next; \ - n##_key_free(entry->key); \ free(entry); \ map->size--; \ return 0; \ @@ -196,7 +192,6 @@ if (n##_key_iseq(entry->next->key, key)) { \ struct n##_entry *next = entry->next; \ entry->next = next->next; \ - n##_key_free(next->key); \ free(next); \ map->size--; \ return 0; \ @@ -207,4 +202,4 @@ return -1; \ } -#endif /* !GEHASHMAP_H */ +#endif /* !LIBGE_GEHASHMAP_H */ |