aboutsummaryrefslogtreecommitdiff
path: root/hash_help.inc
diff options
context:
space:
mode:
Diffstat (limited to 'hash_help.inc')
-rw-r--r--hash_help.inc5
1 files changed, 3 insertions, 2 deletions
diff --git a/hash_help.inc b/hash_help.inc
index 19463be4..ddaf4ae0 100644
--- a/hash_help.inc
+++ b/hash_help.inc
@@ -5,7 +5,7 @@
int HASH_PUT(TYPE) ( TABLE(TYPE)* table, TYPE* value) {
// TODO genicify the hash function
unsigned long h = hash(value->key.mem) % table->size;
- table->values[h] = *value;
+ table->values[h] = value;
/* TODO conflict resolution */
@@ -25,7 +25,8 @@ int HASH_INIT(TYPE) ( TABLE(TYPE)* table, int init_size ) {
TYPE* HASH_GET(TYPE) ( TABLE(TYPE)* table, char* key ) {
unsigned long h = hash(key) % table->size;
- TYPE* mem = (table->values + h);
+ // TYPE* mem = (table->values + h);
+ TYPE* mem = table->values[h];
if (mem == NULL) {
return 0;
} else if (strcmp(mem->key.mem, key) == 0) {