diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2023-08-31 10:16:35 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2023-08-31 10:16:35 -0400 |
commit | 345047be5b8766a9763d4a717ff034e4e4083ade (patch) | |
tree | d1865a39269919087ace15184643907a56d62090 /src/trie.c | |
parent | 5f736eada55f84c7499103faf7c181b80eb7092f (diff) | |
download | bfs-345047be5b8766a9763d4a717ff034e4e4083ade.tar.xz |
trie: New trie_clear() function
Diffstat (limited to 'src/trie.c')
-rw-r--r-- | src/trie.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -715,6 +715,14 @@ void trie_remove(struct trie *trie, struct trie_leaf *leaf) { trie_remove_impl(trie, leaf); } +void trie_clear(struct trie *trie) { + trie->root = 0; + LIST_INIT(trie); + + varena_clear(&trie->leaves); + varena_clear(&trie->nodes); +} + void trie_destroy(struct trie *trie) { varena_destroy(&trie->leaves); varena_destroy(&trie->nodes); |