about summary refs log tree commit homepage
path: root/lib/PublicInbox/View.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-09-10 08:17:06 +0000
committerEric Wong <e@80x24.org>2022-09-10 19:50:35 +0000
commit86afb4a830a0c55c911105e63821ffc844523d18 (patch)
treed03719d0ce366729840b8c4ad522cde5ff73264c /lib/PublicInbox/View.pm
parent109711976cb9c5e0b9a465b0b6ffcb509434f688 (diff)
downloadpublic-inbox-86afb4a830a0c55c911105e63821ffc844523d18.tar.gz
Favor fewer, yet more expensive operations than many smaller
ones.  While we're still directly manipulating ctx->{obuf} after
this, this change makes it easier for us to avoid doing so in
the future.
Diffstat (limited to 'lib/PublicInbox/View.pm')
-rw-r--r--lib/PublicInbox/View.pm17
1 files changed, 6 insertions, 11 deletions
diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 0b67d92f..1b55fe77 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -508,17 +508,12 @@ sub thread_html_i { # PublicInbox::WwwStream::getline callback
 
 sub submsg_hdr ($$) {
         my ($ctx, $eml) = @_;
-        my $obfs_ibx = $ctx->{-obfs_ibx};
-        my $rv = $ctx->{obuf};
-        $$rv .= "\n";
+        my $s = "\n";
         for my $h (qw(From To Cc Subject Date Message-ID X-Alt-Message-ID)) {
-                my @v = $eml->header($h);
-                for my $v (@v) {
-                        obfuscate_addrs($obfs_ibx, $v) if $obfs_ibx;
-                        $v = ascii_html($v);
-                        $$rv .= "$h: $v\n";
-                }
+                $s .= "$h: $_\n" for $eml->header($h);
         }
+        obfuscate_addrs($ctx->{-obfs_ibx}, $s) if $ctx->{-obfs_ibx};
+        ascii_html($s);
 }
 
 sub attach_link ($$$$;$) {
@@ -559,7 +554,7 @@ EOF
         $$rv .= ($desc eq '') ? "$ts --]" : "$desc --]\n[-- $ts --]";
         $$rv .= "</a>\n";
 
-        submsg_hdr($ctx, $part) if $part->{is_submsg};
+        $$rv .= submsg_hdr($ctx, $part) if $part->{is_submsg};
 
         undef;
 }
@@ -578,7 +573,7 @@ sub add_text_body { # callback for each_part
 
         my $rv = $ctx->{obuf};
         if ($part->{is_submsg}) {
-                submsg_hdr($ctx, $part);
+                $$rv .= submsg_hdr($ctx, $part);
                 $$rv .= "\n";
         }