summaryrefslogtreecommitdiffstats
path: root/src/trie.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2023-03-31 16:19:45 -0400
committerTavian Barnes <tavianator@tavianator.com>2023-03-31 16:39:56 -0400
commit86f4b4f7180bca73a734249e67dada708f8275ff (patch)
tree408bdffc5001ce8180dc46f10d4cc04ea7c17d82 /src/trie.c
parentf75f3de63888702f29f48bcf2691291403720b9d (diff)
downloadbfs-86f4b4f7180bca73a734249e67dada708f8275ff.tar.xz
list: Use macros instead of type-erased lists
Diffstat (limited to 'src/trie.c')
-rw-r--r--src/trie.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/trie.c b/src/trie.c
index 7b00f4b..43df9dc 100644
--- a/src/trie.c
+++ b/src/trie.c
@@ -83,6 +83,7 @@
#include "trie.h"
#include "config.h"
+#include "list.h"
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
@@ -163,7 +164,7 @@ static uintptr_t trie_encode_node(const struct trie_node *node) {
void trie_init(struct trie *trie) {
trie->root = 0;
- list_init(&trie->leaves);
+ LIST_INIT(trie);
}
/** Check if a number is a power of two. */
@@ -340,8 +341,7 @@ static struct trie_leaf *trie_leaf_alloc(struct trie *trie, const void *key, siz
return NULL;
}
- link_init(&leaf->link);
- list_append(&trie->leaves, &leaf->link);
+ LIST_APPEND(trie, leaf);
leaf->value = NULL;
leaf->length = length;
@@ -352,7 +352,7 @@ static struct trie_leaf *trie_leaf_alloc(struct trie *trie, const void *key, siz
/** Free a leaf. */
static void trie_leaf_free(struct trie *trie, struct trie_leaf *leaf) {
- list_remove(&trie->leaves, &leaf->link);
+ LIST_REMOVE(trie, leaf);
free(leaf);
}