From 53c15b0461ee39a4c32e61ff484389efb1e91d84 Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Thu, 24 Dec 2015 19:18:45 -0500 Subject: stuff --- src/hash.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/hash.h (limited to 'src/hash.h') diff --git a/src/hash.h b/src/hash.h new file mode 100644 index 0000000..7713885 --- /dev/null +++ b/src/hash.h @@ -0,0 +1,18 @@ +#include +#include + +/* simple, generic hash map implementation */ + +unsigned hash_djb(const char*); + +void *hash_init(size_t tabsz, unsigned (*hash_fn)(const void*), + int (*compare_key)(const void*, const void*)); + +void hash_free(void*); + +/* insert a pair, returns null if not already found, otherwise + return the existing data pointer */ +void *hash_insert(void*, const void *key, const void *data); + +/* returns NULL if not found */ +void *hash_lookup(void*, const void *key); -- cgit v1.1