From 447e42b4fbf5567b3cf96ddee0186f76f0c7ebe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 5 Feb 2019 15:38:03 +0100 Subject: Improve templating macros. --- hash.inc.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'hash.inc.h') diff --git a/hash.inc.h b/hash.inc.h index 6ded0628..0aee8ef4 100644 --- a/hash.inc.h +++ b/hash.inc.h @@ -4,7 +4,7 @@ #include "err.h" -int HASH_PUT(TYPE) ( TABLE(TYPE)* table, TYPE* value) { +int PUT(HASHT(TYPE)) ( HASHT(TYPE)* table, TYPE* value) { // TODO genicify the hash function unsigned long h = hash(value->key.mem) % table->size; TYPE* mem = table->values[h]; @@ -17,7 +17,7 @@ int HASH_PUT(TYPE) ( TABLE(TYPE)* table, TYPE* value) { return 0; } -INIT_F(HASH(TYPE), int init_size ) { +INIT_F(HASHT(TYPE), int init_size ) { /* * TODO parts of table might not get properly initialized to 0 */ @@ -27,7 +27,7 @@ INIT_F(HASH(TYPE), int init_size ) { return 0; } -TYPE* HASH_GET(TYPE) ( TABLE(TYPE)* table, char* key ) { +TYPE* GET(HASHT(TYPE)) ( HASHT(TYPE)* table, char* key ) { unsigned long h = hash(key) % table->size; TYPE* mem = table->values[h]; if (mem == NULL) { @@ -43,7 +43,7 @@ TYPE* HASH_GET(TYPE) ( TABLE(TYPE)* table, char* key ) { } } -FREE(HASH(TYPE)) { +FREE(HASHT(TYPE)) { /* * TODO an early return is possible by checking if all items have * been found. table->item_count -- cgit v1.2.3