X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=blobdiff_plain;f=lib%2FPublicInbox%2FSearchThread.pm;h=f07dd69665623985461df30166cd0c148b4fe7f8;hp=507f25baab0e04760b3e55c57f116d6a958246a6;hb=08b543eb6c67cc19ea8e86afe6b9494df79e2fea;hpb=a877fe97c753e7dc1803936e932adff566f7641d diff --git a/lib/PublicInbox/SearchThread.pm b/lib/PublicInbox/SearchThread.pm index 507f25ba..f07dd696 100644 --- a/lib/PublicInbox/SearchThread.pm +++ b/lib/PublicInbox/SearchThread.pm @@ -83,15 +83,15 @@ sub thread { } } my $ibx = $ctx->{ibx}; - my $rootset = [ grep { # n.b.: delete prevents cyclic refs + my @rootset = grep { # n.b.: delete prevents cyclic refs !delete($_->{parent}) && $_->visible($ibx) - } values %id_table ]; - $rootset = $ordersub->($rootset); - $_->order_children($ordersub, $ctx) for @$rootset; + } values %id_table; + $ordersub->(\@rootset); + $_->order_children($ordersub, $ctx) for @rootset; # parent imposter messages with reused Message-IDs unshift(@{$id_table{$_->{mid}}->{children}}, $_) for @imposters; - $rootset; + \@rootset; } package PublicInbox::SearchThread::Msg; @@ -172,12 +172,12 @@ sub order_children { my @q = ($cur); my $ibx = $ctx->{ibx}; while (defined($cur = shift @q)) { - my $c = $cur->{children}; # The hashref here... - - $c = [ grep { !$seen{$_}++ && visible($_, $ibx) } values %$c ]; - $c = $ordersub->($c) if scalar @$c > 1; - $cur->{children} = $c; # ...becomes an arrayref - push @q, @$c; + # the {children} hashref here... + my @c = grep { !$seen{$_}++ && visible($_, $ibx) } + values %{$cur->{children}}; + $ordersub->(\@c) if scalar(@c) > 1; + $cur->{children} = \@c; # ...becomes an arrayref + push @q, @c; } }