From 9cc886da4800f588e2b4530a87694b75e31d38f5 Mon Sep 17 00:00:00 2001 From: Florent Bruneau Date: Thu, 6 Nov 2008 23:44:01 +0100 Subject: [PATCH] Readable code is much better. Signed-off-by: Florent Bruneau --- common/trie.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/common/trie.c b/common/trie.c index ef32c96..6bf4cf9 100644 --- a/common/trie.c +++ b/common/trie.c @@ -399,7 +399,7 @@ static inline void trie_entry_inspect(const trie_t *trie, bool show_content, if (entry->c_len == 0) { fputs("(0)", stdout); } else { - const char *c = array_ptr(trie->c, entry->c_offset); + const char *c = str(trie, entry); printf("(%d) ", entry->c_len); for (int i = 0 ; i < entry->c_len ; ++i) { if (c[i]) { @@ -411,9 +411,10 @@ static inline void trie_entry_inspect(const trie_t *trie, bool show_content, } fputs("\n", stdout); } - for (uint32_t i = entry->children_offset ; - i < entry->children_offset + entry->children_len ; ++i) { - trie_entry_inspect(trie, show_content, array_ptr(trie->entries, i), level + 1); + for (uint32_t i = 0 ; i < entry->children_len ; ++i) { + trie_entry_inspect(trie, show_content, + array_ptr(trie->entries, entry->children_offset + i), + level + 1); } if (level == 0) { printf("Average char per node: %d\n", trie->c.len / trie->entries.len); -- 2.20.1