From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 08D59209C2 for ; Wed, 5 Oct 2016 23:57:29 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 17/17] thread: remove weaken dependency Date: Wed, 5 Oct 2016 23:57:22 +0000 Message-Id: <20161005235722.14857-18-e@80x24.org> In-Reply-To: <20161005235722.14857-1-e@80x24.org> References: <20161005235722.14857-1-e@80x24.org> List-Id: 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(-) diff --git a/lib/PublicInbox/SearchThread.pm b/lib/PublicInbox/SearchThread.pm index 05de9ec..003a8d1 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 { -- EW