From: Florent Bruneau Date: Thu, 6 Nov 2008 22:44:01 +0000 (+0100) Subject: Readable code is much better. X-Git-Url: http://git.madism.org/?a=commitdiff_plain;h=9cc886da4800f588e2b4530a87694b75e31d38f5;p=apps%2Fpfixtools.git Readable code is much better. Signed-off-by: Florent Bruneau --- 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);