+
+
+/* Debug {{{1
+ */
+
+static inline void trie_entry_inspect(const trie_t *trie,
+ const trie_entry_t *entry, int level)
+{
+ for (int i = 0 ; i < level ; ++i) {
+ fputs(" ", stdout);
+ }
+ if (entry->c == NULL) {
+ fputs("(nil)", stdout);
+ } else {
+ for (int i = 0 ; i < entry->c_len ; ++i) {
+ if (entry->c[i]) {
+ printf("%c ", entry->c[i]);
+ } else {
+ fputs("\\0 ", stdout);
+ }
+ }
+ }
+ fputs("\n", stdout);
+ for (int i = 0 ; i < entry->children_len ; ++i) {
+ trie_entry_inspect(trie, &trie->entries[entry->children[i]], level + 1);
+ }
+}
+
+void trie_inspect(const trie_t *trie)
+{
+ trie_entry_inspect(trie, trie->entries, 0);
+}