aboutsummaryrefslogtreecommitdiff
path: root/src/hashtbl.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/hashtbl.h')
-rw-r--r--src/hashtbl.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/hashtbl.h b/src/hashtbl.h
new file mode 100644
index 0000000..a6cfa10
--- /dev/null
+++ b/src/hashtbl.h
@@ -0,0 +1,23 @@
+#ifndef HASHTBL_H
+#define HASHTBL_H
+
+typedef struct hash_table *hashtbl_t;
+
+struct hash_table {
+ struct hash_item {
+ struct hash_item *next;
+ char *key;
+ void *data;
+ } **items;
+
+ size_t cap;
+};
+
+hashtbl_t hashtbl_create(size_t cap);
+void hashtbl_destroy(hashtbl_t hashtbl);
+void hashtbl_reset(hashtbl_t hashtbl);
+
+int hashtbl_insert(hashtbl_t hashtbl, char *key, void *data, size_t data_sz);
+int hashtbl_query(hashtbl_t hashtbl, char *key, void **dest);
+
+#endif