summaryrefslogtreecommitdiffstats
path: root/trie.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2019-03-06 21:04:33 -0800
committerTavian Barnes <tavianator@tavianator.com>2019-03-06 21:04:33 -0800
commit7b482d64e934bb5828ed734260f82f79e5e87651 (patch)
tree44d3c275814d854b608a5f39e76bebf244a6260d /trie.h
parent8c9f8f472cc3b356d9fa6e10d77e2a409d106ab0 (diff)
downloadbfs-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.h')
-rw-r--r--trie.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/trie.h b/trie.h
index fcdd630..48f69cc 100644
--- a/trie.h
+++ b/trie.h
@@ -54,6 +54,16 @@ struct trie_leaf {
void trie_init(struct trie *trie);
/**
+ * Get the first (lexicographically earliest) leaf in the trie.
+ *
+ * @param trie
+ * The trie to search.
+ * @return
+ * The first leaf, or NULL if the trie is empty.
+ */
+struct trie_leaf *trie_first_leaf(const struct trie *trie);
+
+/**
* Find the leaf for a string key.
*
* @param trie