about summary refs log tree commit homepage
path: root/lib/PublicInbox/NNTP.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-07-23 06:13:07 +0000
committerEric Wong <e@80x24.org>2022-07-23 14:22:36 +0000
commit21fcd8a37c82c1ef654d402cf592f0c9d803aa26 (patch)
treecdb863ed7b3aca8fff6fb29c8b1af67bef14f027 /lib/PublicInbox/NNTP.pm
parent0ae89efce11e1e3b10a067c61c5b4cde30fa2b3b (diff)
downloadpublic-inbox-21fcd8a37c82c1ef654d402cf592f0c9d803aa26.tar.gz
Regexps consume more CPU cycles and memory, and aren't
necessary here since we just converted the entire buffer
to CRLF.
Diffstat (limited to 'lib/PublicInbox/NNTP.pm')
-rw-r--r--lib/PublicInbox/NNTP.pm2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm
index 8ad7adc1..b223eb07 100644
--- a/lib/PublicInbox/NNTP.pm
+++ b/lib/PublicInbox/NNTP.pm
@@ -502,7 +502,7 @@ sub msg_body_write ($$) {
         # these can momentarily double the memory consumption :<
         $$msg =~ s/^\./../smg;
         $$msg =~ s/(?<!\r)\n/\r\n/sg; # Alpine barfs without this
-        $$msg .= "\r\n" unless $$msg =~ /\r\n\z/s;
+        $$msg .= "\r\n" unless substr($$msg, -2, 2) eq "\r\n";
         $self->msg_more($$msg);
 }