From 8080f099f6a40ce9b79e62f8c424ece42fdffa7a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 25 Apr 2023 10:50:49 +0000 Subject: mid+contenthash: eliminate needless local variable captures It's possible in theory that Perl could be smarter and free memory a tad sooner this way. Regardless, fewer lines of code is easier-to-navigate/read and can save optree size and reduce parsing times. --- lib/PublicInbox/MID.pm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'lib/PublicInbox/MID.pm') diff --git a/lib/PublicInbox/MID.pm b/lib/PublicInbox/MID.pm index 4819cc25..b1ae9939 100644 --- a/lib/PublicInbox/MID.pm +++ b/lib/PublicInbox/MID.pm @@ -92,8 +92,7 @@ sub references ($) { my ($hdr) = @_; my @mids; foreach my $f (qw(References In-Reply-To)) { - my @v = $hdr->header_raw($f); - foreach my $v (@v) { + for my $v ($hdr->header_raw($f)) { push(@mids, ($v =~ /$MID_EXTRACT/g)); } } @@ -104,8 +103,7 @@ sub references ($) { my %addr = ( y => 1, n => 1 ); foreach my $f (qw(To From Cc)) { - my @v = $hdr->header_raw($f); - foreach my $v (@v) { + for my $v ($hdr->header_raw($f)) { $addr{$_} = 1 for (PublicInbox::Address::emails($v)); } } -- cgit v1.2.3-24-ge0c7