aboutsummaryrefslogtreecommitdiff
path: root/src/hash.h
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2015-12-24 19:18:45 -0500
committerFranklin Wei <git@fwei.tk>2015-12-24 19:18:45 -0500
commit53c15b0461ee39a4c32e61ff484389efb1e91d84 (patch)
treec26e64930e1d73960eebc26b02d9d2185d2e1aef /src/hash.h
parent28f94a54984fa7aa46fcb25e7991c1136329670f (diff)
downloadnetcosm-53c15b0461ee39a4c32e61ff484389efb1e91d84.zip
netcosm-53c15b0461ee39a4c32e61ff484389efb1e91d84.tar.gz
netcosm-53c15b0461ee39a4c32e61ff484389efb1e91d84.tar.bz2
netcosm-53c15b0461ee39a4c32e61ff484389efb1e91d84.tar.xz
stuff
Diffstat (limited to 'src/hash.h')
-rw-r--r--src/hash.h18
1 files changed, 18 insertions, 0 deletions
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 <stddef.h>
+#include <stdlib.h>
+
+/* 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);