about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2024-02-13 09:42:42 +0000
committerEric Wong <e@80x24.org>2024-02-14 07:26:12 +0000
commite7c8ab553ee21acf9c9ac0a9180aa76080716290 (patch)
treed84fd6a9f9ea572d77a575db441553b254cec7cf
parenteb2ce64095383b3ecf9edc492f908bfce3a88beb (diff)
downloadpublic-inbox-e7c8ab553ee21acf9c9ac0a9180aa76080716290.tar.gz
eml: reuse ->decode buffer
It's not really relevant at the moment, but a sufficiently
smart implementation could eventually save some memory here.
Perl already optimizes in-place sort (@x = sort @x), so there's
precedent for a potential future where a Perl implementation
could generally optimize in-place operations for non-builtin
subroutines, too.
-rw-r--r--lib/PublicInbox/Eml.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/PublicInbox/Eml.pm b/lib/PublicInbox/Eml.pm
index 56aec1e5..d59d7c3f 100644
--- a/lib/PublicInbox/Eml.pm
+++ b/lib/PublicInbox/Eml.pm
@@ -475,10 +475,10 @@ sub body_str {
                         join("\n\t", header_raw($self, 'Content-Type')));
         };
         my $enc = find_encoding($cs) or croak "unknown encoding `$cs'";
-        my $tmp = body($self);
+        my $ret = body($self);
         local @enc_warn;
         local $SIG{__WARN__} = $enc_warn;
-        my $ret = $enc->decode($tmp, Encode::FB_WARN);
+        $ret = $enc->decode($ret, Encode::FB_WARN);
         croak(@enc_warn) if @enc_warn;
         $ret;
 }