From 0c28e937c80f3134898bc41f10bc9de350851944 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 30 Jun 2016 02:35:17 +0000 Subject: view: merge $state hash with existing $ctx This reduces the level of indirection to reach certain objects within the hash and there are no namespace or lifetime conflicts anyways. --- lib/PublicInbox/SearchView.pm | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'lib/PublicInbox/SearchView.pm') diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm index 8771d5d3..4af6cadb 100644 --- a/lib/PublicInbox/SearchView.pm +++ b/lib/PublicInbox/SearchView.pm @@ -170,21 +170,16 @@ sub mset_thread { my $skel = search_nav_bot($mset, $q). "
";
 	my $inbox = $ctx->{-inbox};
 	$ctx->{-upfx} = '';
-	my $state = {
-		-inbox => $inbox,
-		anchor_idx => 1,
-		ctx => $ctx,
-		cur_level => 0,
-		dst => \$skel,
-		mapping => {},
-		pct => \%pct,
-		prev_attr => '',
-		prev_level => 0,
-		seen => {},
-		srch => $ctx->{srch},
-	};
+	$ctx->{anchor_idx} = 1;
+	$ctx->{cur_level} = 0;
+	$ctx->{dst} = \$skel;
+	$ctx->{mapping} = {};
+	$ctx->{pct} = \%pct;
+	$ctx->{prev_attr} = '';
+	$ctx->{prev_level} = 0;
+	$ctx->{seen} = {};
 
-	PublicInbox::View::walk_thread($th, $state,
+	PublicInbox::View::walk_thread($th, $ctx,
 		*PublicInbox::View::pre_thread);
 
 	my $msgs = \@m;
@@ -197,7 +192,7 @@ sub mset_thread {
 		}
 		if ($mime) {
 			$mime = Email::MIME->new($mime);
-			return PublicInbox::View::index_entry($mime, $state);
+			return PublicInbox::View::index_entry($mime, $ctx);
 		}
 		$msgs = undef;
 		$skel .= "\n
"; -- cgit v1.2.3-24-ge0c7