From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id D9B9B1F61D for ; Mon, 24 Feb 2020 08:08:23 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] v2writable: lookup_content => content_exists Date: Mon, 24 Feb 2020 08:08:23 +0000 Message-Id: <20200224080823.16809-4-e@yhbt.net> In-Reply-To: <20200224080823.16809-1-e@yhbt.net> References: <20200224080823.16809-1-e@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: It only needs to return a boolean, since none of the current callers care about the return value, so avoid a hash assignment and use of `$smsg->{mime}', here. --- lib/PublicInbox/V2Writable.pm | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/PublicInbox/V2Writable.pm b/lib/PublicInbox/V2Writable.pm index 573a92aa..b42e6a13 100644 --- a/lib/PublicInbox/V2Writable.pm +++ b/lib/PublicInbox/V2Writable.pm @@ -201,11 +201,10 @@ sub v2_num_for { # crap, Message-ID is already known, hope somebody just resent: foreach my $m (@$mids) { # read-only lookup now safe to do after above barrier - my $existing = lookup_content($self, $mime, $m); # easy, don't store duplicates # note: do not add more diagnostic info here since # it gets noisy on public-inbox-watch restarts - return () if $existing; + return () if content_exists($self, $mime, $m); } # AltId may pre-populate article numbers (e.g. X-Mail-Count @@ -824,7 +823,7 @@ sub get_blob ($$) { $ibx->msg_by_smsg($smsg); } -sub lookup_content ($$$) { +sub content_exists ($$$) { my ($self, $mime, $mid) = @_; my $over = $self->{over}; my $cids = content_ids($mime); @@ -836,11 +835,7 @@ sub lookup_content ($$$) { next; } my $cur = PublicInbox::MIME->new($msg); - if (content_matches($cids, $cur)) { - $smsg->{mime} = $cur; - return $smsg; - } - + return 1 if content_matches($cids, $cur); # XXX DEBUG_DIFF is experimental and may be removed diff($mid, $cur, $mime) if $ENV{DEBUG_DIFF};