From ea45e9f71588572a2f4b9299a86cedc3c8e9c72a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 23 Jan 2020 23:05:55 +0000 Subject: nntp: simplify setting X-Alt-Message-ID We can cut down on the number of operations required using "grep" instead of "foreach". --- lib/PublicInbox/NNTP.pm | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm index 35729f00..12f74c3d 100644 --- a/lib/PublicInbox/NNTP.pm +++ b/lib/PublicInbox/NNTP.pm @@ -423,10 +423,7 @@ sub set_nntp_headers ($$$$$) { $hdr->header_set('Message-ID', $mid0); my @alt = $hdr->header('X-Alt-Message-ID'); my %seen = map { $_ => 1 } (@alt, $mid0); - foreach my $m (@mids) { - next if $seen{$m}++; - push @alt, $m; - } + push(@alt, grep { !$seen{$_}++ } @mids); $hdr->header_set('X-Alt-Message-ID', @alt); } -- cgit v1.2.3-24-ge0c7