diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2019-03-06 21:04:33 -0800 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2019-03-06 21:04:33 -0800 |
commit | 7b482d64e934bb5828ed734260f82f79e5e87651 (patch) | |
tree | 44d3c275814d854b608a5f39e76bebf244a6260d /trie.c | |
parent | 8c9f8f472cc3b356d9fa6e10d77e2a409d106ab0 (diff) | |
download | bfs-7b482d64e934bb5828ed734260f82f79e5e87651.tar.xz |
trie: Add a function to get an arbitrary leaf
This is useful if the stored values need to be cleaned up.
Diffstat (limited to 'trie.c')
-rw-r--r-- | trie.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -218,6 +218,10 @@ static struct trie_leaf *trie_representative(const struct trie *trie, const void return trie_decode_leaf(ptr); } +struct trie_leaf *trie_first_leaf(const struct trie *trie) { + return trie_representative(trie, NULL, 0); +} + struct trie_leaf *trie_find_str(const struct trie *trie, const char *key) { return trie_find_mem(trie, key, strlen(key) + 1); } |