]> Sergey Matveev's repositories - public-inbox.git/commitdiff
thread: simplify
authorEric Wong <e@80x24.org>
Wed, 5 Oct 2016 23:47:23 +0000 (23:47 +0000)
committerEric Wong <e@80x24.org>
Wed, 5 Oct 2016 23:53:23 +0000 (23:53 +0000)
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

index 7e89946df81bd695ab7b14251cf2eae1ae346653..a161662019a86fe8da70768d149005f515525a36 100644 (file)
@@ -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) = @_;