about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-02-24 08:08:22 +0000
committerEric Wong <e@yhbt.net>2020-02-24 18:30:17 +0000
commit6e7f54e4031e8ea5f5e5837befe0c1e2b4ec43f9 (patch)
tree8dd14a87861da76fa747a0b6309fa1b7b10040f8 /lib
parent04ad02d739b352514ddfb5cc659bb4a69c4d07e1 (diff)
downloadpublic-inbox-6e7f54e4031e8ea5f5e5837befe0c1e2b4ec43f9.tar.gz
v2writable: lookup_content => content_exists
It only needs to return a boolean, since none of the current
callers care about the return value.  Thus avoid a hash table
assignment and use of `$smsg->{mime}', here.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/V2Writable.pm11
1 files 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};