summaryrefslogtreecommitdiff
path: root/map.h
diff options
context:
space:
mode:
authornirav <nirav@teisuu.com>2020-11-29 21:26:59 +0000
committernirav <nirav@teisuu.com>2020-11-29 21:26:59 +0000
commitd19ca52b210fc41c013569762a2d7ae8167674aa (patch)
treead6b158d251a9dee9074f37510af83e24d1ec08a /map.h
downloadhashmap-d19ca52b210fc41c013569762a2d7ae8167674aa.tar.gz
hashmap-d19ca52b210fc41c013569762a2d7ae8167674aa.zip
Initial commitHEADmaster
Diffstat (limited to 'map.h')
-rw-r--r--map.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/map.h b/map.h
new file mode 100644
index 0000000..e3a51ab
--- /dev/null
+++ b/map.h
@@ -0,0 +1,20 @@
+#ifndef __HASH_H
+#define __HASH_H
+
+typedef struct node {
+ void *key, *val;
+ size_t ksize, vsize;
+ struct node *next;
+} NODE;
+
+typedef struct {
+ NODE **list;
+ size_t cap;
+ size_t len;
+} MAP;
+
+void map_init(MAP *m);
+void map_set(MAP *m, const void *key, size_t ksize, const void *val, size_t vsize);
+int map_get(MAP *m, const void *key, size_t ksize, void **val, size_t *vsize);
+
+#endif