diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-04 00:36:57 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-02-04 00:36:57 +0100 |
commit | 2c2bdb8b66e386e14b5cc1a35abfbf242dcf2018 (patch) | |
tree | 7f640c7845bd26823b8d6108b4f554bf5b6c9d97 /trie.inc.h | |
parent | Add linked list generic type. (diff) | |
download | calp-2c2bdb8b66e386e14b5cc1a35abfbf242dcf2018.tar.gz calp-2c2bdb8b66e386e14b5cc1a35abfbf242dcf2018.tar.xz |
Work on propper memmory management for linked lists.
Diffstat (limited to '')
-rw-r--r-- | trie.inc.h | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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 */ |