]> Sergey Matveev's repositories - public-inbox.git/commitdiff
contentid: use map to generate %seen for Message-Ids
authorEric Wong <e@yhbt.net>
Thu, 23 Jan 2020 23:05:54 +0000 (23:05 +0000)
committerEric Wong <e@yhbt.net>
Fri, 24 Jan 2020 23:04:50 +0000 (23:04 +0000)
This use of map {} is a common idiom as we no longer consider
the Message-ID as part of the digest.

lib/PublicInbox/ContentId.pm

index eb937a0e722982937f4a93619c00330f7b4d15b2..0c4a8678beb02fa4db436ca12c55eda6bc0edc79 100644 (file)
@@ -60,12 +60,9 @@ sub content_digest ($) {
        # References: and In-Reply-To: get used interchangeably
        # in some "duplicates" in LKML.  We treat them the same
        # in SearchIdx, so treat them the same for this:
-       my %seen;
-       foreach my $mid (@{mids($hdr)}) {
-               # do NOT consider the Message-ID as part of the content_id
-               # if we got here, we've already got Message-ID reuse
-               $seen{$mid} = 1;
-       }
+       # do NOT consider the Message-ID as part of the content_id
+       # if we got here, we've already got Message-ID reuse
+       my %seen = map { $_ => 1 } @{mids($hdr)};
        foreach my $mid (@{references($hdr)}) {
                next if $seen{$mid};
                $dig->add("ref\0$mid\0");