diff options
Diffstat (limited to 'src/hash.h')
| -rw-r--r-- | src/hash.h | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -1,3 +1,4 @@ +#include <stdbool.h> #include <stddef.h> /* simple, generic chained hash map implementation */ @@ -17,6 +18,12 @@ void *hash_insert(void*, const void *key, const void *data); /* returns NULL if not found */ void *hash_lookup(void*, const void *key); +bool hash_remove(void *ptr, void *key); + +/* use like you would strtok_r */ +/* allocates a buffer that's freed once all elements are processed */ +void *hash_iterate(void *map, void **saved, void **keyptr); + struct hash_pair { void *key; unsigned char value[0]; @@ -25,6 +32,9 @@ struct hash_pair { /* insert n key->pair members of size pairsize */ void hash_insert_pairs(void*, const struct hash_pair*, size_t pairsize, size_t n); +/* gets the original pointer used to store the tuple */ +void *hash_getkeyptr(void*, const void *key); + #define SIMP_HASH(TYPE, NAME) \ unsigned NAME (const void *key) \ { \ |