aboutsummaryrefslogtreecommitdiff
path: root/hash.h
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-01-22 11:42:58 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-01-22 11:42:58 +0100
commitebe5c7e428b57dca758b1b3a1d8b7d4b423b19a9 (patch)
treebf97a4ba3a05c24ae1ec176f42656ce1608ee8d1 /hash.h
parentAdd very simple err header. (diff)
downloadcalp-ebe5c7e428b57dca758b1b3a1d8b7d4b423b19a9.tar.gz
calp-ebe5c7e428b57dca758b1b3a1d8b7d4b423b19a9.tar.xz
Start using trie's instead of hash-maps.
Diffstat (limited to 'hash.h')
-rw-r--r--hash.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/hash.h b/hash.h
index 7706f089..07c31460 100644
--- a/hash.h
+++ b/hash.h
@@ -7,13 +7,15 @@
unsigned long hash(char*);
-#define TABLE(T) TP(table_, T)
+#define TABLE(T) TP(table__, T)
#define HASH_PUT(T) TP(hash_put_, T)
#define HASH_GET(T) TP(hash_get_, T)
// #define HASH_INIT(T) TP(hash_init_, T)
// #define HASH_INIT(T) CONSTRUCTOR_T(hash_ ## T, 1)
#define HASH_INIT(T) CONSTRUCTOR_GEN(hash, T, 1)
+#define HASH_FREE(T) TP(hash_free_, T)
+
#endif /* HASH_H */
#ifdef TYPE
@@ -33,4 +35,10 @@ int HASH_INIT(TYPE) ( TABLE(TYPE)* table, int init_size );
TYPE* HASH_GET(TYPE) ( TABLE(TYPE)* table, char* key );
+/*
+ * Free's all item's stored in table.
+ * And finally frees table.
+ */
+int HASH_FREE(TYPE) ( TABLE(TYPE)* table );
+
#endif /* HASH_H */