about summary refs log tree commit homepage
path: root/lib/PublicInbox/ViewDiff.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-09-10 08:17:15 +0000
committerEric Wong <e@80x24.org>2022-09-10 19:50:45 +0000
commit03673adef5a74f7ebd6be960187e5e8592779900 (patch)
treeaa5736ba9971c54d919f4bec096714627ce1348d /lib/PublicInbox/ViewDiff.pm
parent7909a26697d91a74a3b4df638b2a658432f1b799 (diff)
downloadpublic-inbox-03673adef5a74f7ebd6be960187e5e8592779900.tar.gz
I'm not sure if Devel::Size::total_size can be trusted due
to the regexps and crashes[1], but when it works, it's showing
around a 900 byte size reduction, too.

[1] https://rt.cpan.org/Public/Bug/Display.html?id=96421
Diffstat (limited to 'lib/PublicInbox/ViewDiff.pm')
-rw-r--r--lib/PublicInbox/ViewDiff.pm7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/PublicInbox/ViewDiff.pm b/lib/PublicInbox/ViewDiff.pm
index b9194ed4..076aa1af 100644
--- a/lib/PublicInbox/ViewDiff.pm
+++ b/lib/PublicInbox/ViewDiff.pm
@@ -51,13 +51,10 @@ sub diff_hunk ($$$) {
         my ($oid_a, $oid_b, $spfx) = @$dctx{qw(oid_a oid_b spfx)};
 
         if (defined($spfx) && defined($oid_a) && defined($oid_b)) {
-                my ($n) = ($ca =~ /^-([0-9]+)/);
-                $n = defined($n) ? "#n$n" : '';
-
+                my $n = ($ca =~ /^-([0-9]+)/) ? "#n$1" : '';
                 my $x = qq(@@ <a\nhref="$spfx$oid_a/s/$dctx->{Q}$n">$ca</a>);
 
-                ($n) = ($cb =~ /^\+([0-9]+)/);
-                $n = defined($n) ? "#n$n" : '';
+                $n = ($cb =~ /^\+([0-9]+)/) ? "#n$1" : '';
                 $x .= qq( <a\nhref="$spfx$oid_b/s/$dctx->{Q}$n">$cb</a> @@);
         } else {
                 "@@ $ca $cb @@";