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 BC88F209BC for ; Wed, 5 Oct 2016 23:57:26 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 08/17] thread: simplify Date: Wed, 5 Oct 2016 23:57:13 +0000 Message-Id: <20161005235722.14857-9-e@80x24.org> In-Reply-To: <20161005235722.14857-1-e@80x24.org> References: <20161005235722.14857-1-e@80x24.org> List-Id: Single use subroutines actually make the code more complex in this case, and there's never a {seen} field in $self. --- lib/PublicInbox/SearchThread.pm | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/lib/PublicInbox/SearchThread.pm b/lib/PublicInbox/SearchThread.pm index 7e89946..a161662 100644 --- a/lib/PublicInbox/SearchThread.pm +++ b/lib/PublicInbox/SearchThread.pm @@ -31,16 +31,10 @@ sub new { sub thread { my $self = shift; - $self->_setup(); + _add_message($self, $_) foreach @{$self->{messages}}; $self->{rootset} = [ grep { !$_->{parent} } values %{$self->{id_table}} ]; - $self->_finish(); -} - -sub _finish { - my $self = shift; delete $self->{id_table}; - delete $self->{seen}; } sub _get_cont_for_id ($$) { @@ -48,12 +42,6 @@ sub _get_cont_for_id ($$) { $self->{id_table}{$mid} ||= PublicInbox::SearchThread::Msg->new($mid); } -sub _setup { - my ($self) = @_; - - _add_message($self, $_) foreach @{$self->{messages}}; -} - sub _add_message ($$) { my ($self, $smsg) = @_; -- EW