-static const struct trie_node_f *trie_node_from_off(struct trie_f *trie, le64_t off) {
- return (const struct trie_node_f *)(trie->map + le64toh(off));
-}
-
-static const char *trie_string(struct trie_f *trie, le64_t off) {
- return trie->map + le64toh(off);
-}
-
-static int trie_children_cmp_f(const void *v1, const void *v2) {
- const struct trie_child_entry_f *n1 = v1;
- const struct trie_child_entry_f *n2 = v2;
-
- return n1->c - n2->c;
-}
-
-static const struct trie_node_f *node_lookup_f(struct trie_f *trie, const struct trie_node_f *node, uint8_t c) {
- struct trie_child_entry_f *child;
- struct trie_child_entry_f search;
-
- search.c = c;
- child = bsearch(&search, trie_node_children(trie, node), node->children_count,
- le64toh(trie->head->child_entry_size), trie_children_cmp_f);
- if (child)
- return trie_node_from_off(trie, child->child_off);
- return NULL;
-}
-
-static void trie_fnmatch_f(struct trie_f *trie, const struct trie_node_f *node, size_t p,
- struct linebuf *buf, const char *search,
- void (*cb)(struct trie_f *trie, const char *key, const char *value)) {
- size_t len;
- size_t i;
- const char *prefix;
-
- prefix = trie_string(trie, node->prefix_off);
- len = strlen(prefix + p);
- linebuf_add(buf, prefix + p, len);
-
- for (i = 0; i < node->children_count; i++) {
- const struct trie_child_entry_f *child = &trie_node_children(trie, node)[i];