diff options
-rw-r--r-- | fitz/memento.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/fitz/memento.c b/fitz/memento.c index dcd417b8..7c3c6200 100644 --- a/fitz/memento.c +++ b/fitz/memento.c @@ -474,6 +474,11 @@ static void showBlock(Memento_BlkHeader *b, int space) static void blockDisplay(Memento_BlkHeader *b, int n) { n++; + while (n > 40) + { + fprintf(stderr, "*"); + n -= 40; + } while(n > 0) { int i = n; @@ -499,9 +504,18 @@ static int Memento_listBlock(Memento_BlkHeader *b, static void doNestedDisplay(Memento_BlkHeader *b, int depth) { - blockDisplay(b, depth); - for (b = b->child; b; b = b->sibling) - doNestedDisplay(b, depth+1); + /* Try and avoid recursion if we can help it */ + do { + blockDisplay(b, depth); + if (b->sibling) { + if (b->child) + doNestedDisplay(b->child, depth+1); + b = b->sibling; + } else { + b = b->child; + depth++; + } + } while (b); } static int ptrcmp(const void *a_, const void *b_) |