about summary refs log tree commit homepage
path: root/lib/PublicInbox/SearchView.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2016-06-21 02:58:58 +0000
committerEric Wong <e@80x24.org>2016-06-21 03:07:04 +0000
commitcf1fb806c5a4cb03833bd4276c0fb2906ebb9cc7 (patch)
treeed8f92843c31fc61fb110a220ec52cb4e3c8b58a /lib/PublicInbox/SearchView.pm
parent76d8f68dc273e54809ad69cfe49e141003f790ef (diff)
downloadpublic-inbox-cf1fb806c5a4cb03833bd4276c0fb2906ebb9cc7.tar.gz
Since we have a common pattern, for walking threads,
extract it into a function and reduce the amount of code
we haev.

This will make it easier to switch to an event-driven interface
for getline, too.
Diffstat (limited to 'lib/PublicInbox/SearchView.pm')
-rw-r--r--lib/PublicInbox/SearchView.pm8
1 files changed, 1 insertions, 7 deletions
diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm
index ba258270..ae875bf7 100644
--- a/lib/PublicInbox/SearchView.pm
+++ b/lib/PublicInbox/SearchView.pm
@@ -172,13 +172,7 @@ sub tdump {
                 fh => $fh,
         };
         $ctx->{searchview} = 1;
-        my @q = map { (0, $_) } $th->rootset;
-        while (@q) {
-                my $level = shift @q;
-                my $node = shift @q or next;
-                tdump_ent($state, $level, $node);
-                unshift @q, $level+1, $node->child, $level, $node->next;
-        }
+        PublicInbox::View::walk_thread($th, $state, *tdump_ent);
         PublicInbox::View::thread_adj_level($state, 0);
 
         $fh->write(search_nav_bot($mset, $q). "\n\n" .