unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 5/6] view: reduce ops for <b> encasement
Date: Fri, 15 Nov 2024 02:59:31 +0000	[thread overview]
Message-ID: <20241115025932.1647240-6-e@80x24.org> (raw)
In-Reply-To: <20241115025932.1647240-1-e@80x24.org>

We can rely on print to concatenate its args and
reduce the amount of needless copies and string ops before the
print.
---
 lib/PublicInbox/View.pm | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm
index 7ca85a85..ad259253 100644
--- a/lib/PublicInbox/View.pm
+++ b/lib/PublicInbox/View.pm
@@ -272,13 +272,12 @@ sub emit_eml ($$) {
 	my $root_anchor = $ctx->{root_anchor} || '';
 	my $irt;
 	my $obfs_ibx = $ctx->{-obfs_ibx};
-	$subj = '(no subject)' if $subj eq '';
-	$subj = '<b>'.ascii_html($subj).'</b>';
+	$subj = $subj eq '' ? '(no subject)' : ascii_html($subj);
 	obfuscate_addrs($obfs_ibx, $subj) if $obfs_ibx;
 	$subj = "<u\nid=u>$subj</u>" if $root_anchor eq $id_m;
 	my $zfh = $ctx->{zfh} // die 'BUG: no {zfh}';
-	print $zfh "<a\nhref=#e", $id, "\nid=m", $id, '>*</a> ',
-		$subj, "\n", _th_index_lite($mid_raw, \$irt, $id, $ctx);
+	print $zfh "<a\nhref=#e", $id, "\nid=m", $id, '>*</a> <b>',
+		$subj, "</b>\n", _th_index_lite($mid_raw, \$irt, $id, $ctx);
 	my @tocc;
 	my $ds = delete $smsg->{ds}; # for v1 non-Xapian/SQLite users
 

  parent reply	other threads:[~2024-11-15  2:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-15  2:59 [PATCH 0/6] a few random small fixes and improvements Eric Wong
2024-11-15  2:59 ` [PATCH 1/6] tests: fix missing modules under TEST_RUN_MODE=0 Eric Wong
2024-11-15  2:59 ` [PATCH 2/6] test_common: disable fsync in git(1) commands Eric Wong
2024-11-15  2:59 ` [PATCH 3/6] nntp: improve protocol error messages Eric Wong
2024-11-15  2:59 ` [PATCH 4/6] nntp: integerize {article} to save memory Eric Wong
2024-11-15  2:59 ` Eric Wong [this message]
2024-11-15  2:59 ` [PATCH 6/6] view: fix obfuscation in message/* attachments Eric Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241115025932.1647240-6-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).