aboutsummaryrefslogtreecommitdiff
path: root/hash.h
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-02-04 11:25:37 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-02-05 18:06:13 +0100
commitdc8474d9034d9281463bb69f7f7a922e3ea713ee (patch)
treec3b870ada88f7aaa48918c4eb8b5d865f2f82019 /hash.h
parentWork on propper memmory management for linked lists. (diff)
downloadcalp-dc8474d9034d9281463bb69f7f7a922e3ea713ee.tar.gz
calp-dc8474d9034d9281463bb69f7f7a922e3ea713ee.tar.xz
Normalize and improve INIT & FREE macros.
Diffstat (limited to 'hash.h')
-rw-r--r--hash.h9
1 files changed, 2 insertions, 7 deletions
diff --git a/hash.h b/hash.h
index 07c31460..02741642 100644
--- a/hash.h
+++ b/hash.h
@@ -10,11 +10,6 @@ unsigned long hash(char*);
#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
@@ -31,7 +26,7 @@ typedef struct {
int HASH_PUT(TYPE) ( TABLE(TYPE)* table, TYPE* value );
-int HASH_INIT(TYPE) ( TABLE(TYPE)* table, int init_size );
+INIT_F(HASH(TYPE), int init_size );
TYPE* HASH_GET(TYPE) ( TABLE(TYPE)* table, char* key );
@@ -39,6 +34,6 @@ 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 );
+FREE_F(HASH(TYPE));
#endif /* HASH_H */