aboutsummaryrefslogtreecommitdiff
path: root/src/types/map.h
diff options
context:
space:
mode:
authorame <[email protected]>2024-03-08 14:14:39 -0600
committerame <[email protected]>2024-03-08 14:14:39 -0600
commit05ae1fc2fef778138bb3a136340dd923ca9687a0 (patch)
tree0aae88a063da581c90b2eec987c77a53dda986ef /src/types/map.h
parent580c39bb8d128b4f66d1c5d87a98ab7fb44a686b (diff)
fixed hashes and net stuff
Diffstat (limited to 'src/types/map.h')
-rw-r--r--src/types/map.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/types/map.h b/src/types/map.h
new file mode 100644
index 0000000..cb8fed2
--- /dev/null
+++ b/src/types/map.h
@@ -0,0 +1,29 @@
+
+#ifndef _MAP_H
+#define _MAP_H
+
+#include <stdint.h>
+#include "str.h"
+#include "parray.h"
+
+typedef struct {
+ void* value;
+ str* key;
+ uint64_t hash;
+} melem_t;
+
+typedef struct {
+ melem_t* M;
+ int len;
+ int mod;
+} map_t;
+
+map_t* map_init();
+void map_set(map_t*, char*, void*);
+void* map_get(map_t* , char*);
+int map_geti(map_t* , char*);
+void map_remove(map_t* p, char* key, enum free_type free);
+void map_clear(map_t*, enum free_type);
+void map_lclear(map_t*);
+
+#endif //_MAP_H \ No newline at end of file