aboutsummaryrefslogtreecommitdiff
path: root/trie.inc.h
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-02-04 00:36:57 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-02-04 00:36:57 +0100
commit2c2bdb8b66e386e14b5cc1a35abfbf242dcf2018 (patch)
tree7f640c7845bd26823b8d6108b4f554bf5b6c9d97 /trie.inc.h
parentAdd linked list generic type. (diff)
downloadcalp-2c2bdb8b66e386e14b5cc1a35abfbf242dcf2018.tar.gz
calp-2c2bdb8b66e386e14b5cc1a35abfbf242dcf2018.tar.xz
Work on propper memmory management for linked lists.
Diffstat (limited to 'trie.inc.h')
-rw-r--r--trie.inc.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/trie.inc.h b/trie.inc.h
index b839a7e8..61dc3701 100644
--- a/trie.inc.h
+++ b/trie.inc.h
@@ -46,7 +46,8 @@ int TRIE_PUT(TYPE) ( TRIE(TYPE)* trie, char* key, TYPE* val ) {
last->child = t;
last = t;
}
- last->value = val;
+ RESOLVE(TYPE)(&last->value, val);
+ // last->value = val;
return 0;
} else if (cur->c == subkey[0]) {
/* This node belongs to the key,
@@ -56,7 +57,8 @@ int TRIE_PUT(TYPE) ( TRIE(TYPE)* trie, char* key, TYPE* val ) {
subkey++;
} else if (subkey[0] == '\0') {
/* Key finished */
- last->value = val;
+ // last->value = val;
+ RESOLVE(TYPE)(&last->value, val);
return 0;
} else if (cur->next != NULL) {
/* This node was not part of the set, but it's sibling might */