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/ContentHash.pm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'lib/PublicInbox/ContentHash.pm') diff --git a/lib/PublicInbox/ContentHash.pm b/lib/PublicInbox/ContentHash.pm index d3ff146a..a4f6196f 100644 --- a/lib/PublicInbox/ContentHash.pm +++ b/lib/PublicInbox/ContentHash.pm @@ -76,8 +76,7 @@ sub content_digest ($;$) { last; } foreach my $h (qw(Subject Date)) { - my @v = $eml->header($h); - foreach my $v (@v) { + for my $v ($eml->header($h)) { utf8::encode($v); $dig->add("$h\0$v\0"); } @@ -86,8 +85,7 @@ sub content_digest ($;$) { # not in the original message. For the purposes of deduplication, # do not take it into account: foreach my $h (qw(To Cc)) { - my @v = $eml->header($h); - digest_addr($dig, $h, $_) foreach @v; + digest_addr($dig, $h, $_) for ($eml->header($h)); } msg_iter($eml, \&content_dig_i, $dig); $dig; -- cgit v1.2.3-24-ge0c7