From 2c2bdb8b66e386e14b5cc1a35abfbf242dcf2018 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 4 Feb 2019 00:36:57 +0100 Subject: Work on propper memmory management for linked lists. --- trie.inc.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'trie.inc.h') 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 */ -- cgit v1.2.3