From c76585db3daa7910edf5f4c048d783b67e2c2315 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 5 Oct 2016 23:47:32 +0000 Subject: thread: remove weaken dependency We have to walk through all the messages after threading anyways to build the rootset, so we can just delete all the parent references at that point. --- lib/PublicInbox/SearchThread.pm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib/PublicInbox') diff --git a/lib/PublicInbox/SearchThread.pm b/lib/PublicInbox/SearchThread.pm index 05de9ec5..003a8d11 100644 --- a/lib/PublicInbox/SearchThread.pm +++ b/lib/PublicInbox/SearchThread.pm @@ -33,7 +33,7 @@ sub thread { my $self = shift; _add_message($self, $_) foreach @{$self->{messages}}; my $id_table = delete $self->{id_table}; - $self->{rootset} = [ grep { !$_->{parent} } values %$id_table ]; + $self->{rootset} = [ grep { !delete $_->{parent} } values %$id_table ]; } sub _get_cont_for_id ($$) { @@ -90,7 +90,6 @@ package PublicInbox::SearchThread::Msg; use strict; use warnings; use Carp qw(croak); -use Scalar::Util qw(weaken); sub new { bless { @@ -112,7 +111,7 @@ sub add_child { delete $parent->{children}->{$cid}; } - weaken($child->{parent} = $self); + $child->{parent} = $self; } sub has_descendent { -- cgit v1.2.3-24-ge0c7