diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2023-03-31 16:19:45 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2023-03-31 16:39:56 -0400 |
commit | 86f4b4f7180bca73a734249e67dada708f8275ff (patch) | |
tree | 408bdffc5001ce8180dc46f10d4cc04ea7c17d82 /src/trie.c | |
parent | f75f3de63888702f29f48bcf2691291403720b9d (diff) | |
download | bfs-86f4b4f7180bca73a734249e67dada708f8275ff.tar.xz |
list: Use macros instead of type-erased lists
Diffstat (limited to 'src/trie.c')
-rw-r--r-- | src/trie.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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); } |