summaryrefslogtreecommitdiffstats
path: root/trie.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2019-03-04 23:30:17 -0800
committerTavian Barnes <tavianator@tavianator.com>2019-03-04 23:35:00 -0800
commit21a9a9bb078c062b7cb13f8d176a3375d7b01eb2 (patch)
tree9a1b50fe144182506ef49c3c4d9294d1f9255169 /trie.h
parent8ec4f46f31b1d2f71d193952e595e2037fe7f22d (diff)
downloadbfs-21a9a9bb078c062b7cb13f8d176a3375d7b01eb2.tar.xz
trie: Implement removal
Diffstat (limited to 'trie.h')
-rw-r--r--trie.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/trie.h b/trie.h
index fd91f0c..8fcf04b 100644
--- a/trie.h
+++ b/trie.h
@@ -106,6 +106,32 @@ struct trie_leaf *trie_insert_str(struct trie *trie, const char *key);
struct trie_leaf *trie_insert_mem(struct trie *trie, const void *key, size_t length);
/**
+ * Remove a string key from a trie.
+ *
+ * @param trie
+ * The trie to modify.
+ * @param key
+ * The key to remove.
+ * @return
+ * Whether the key was found.
+ */
+bool trie_remove_str(struct trie *trie, const char *key);
+
+/**
+ * Remove a fixed-size key from a trie.
+ *
+ * @param trie
+ * The trie to modify.
+ * @param key
+ * The key to remove.
+ * @param size
+ * The size of the key in bytes.
+ * @return
+ * Whether the key was found.
+ */
+bool trie_remove_mem(struct trie *trie, const void *key, size_t size);
+
+/**
* Destroy a trie and its contents.
*/
void trie_destroy(struct trie *trie);