From 03673adef5a74f7ebd6be960187e5e8592779900 Mon Sep 17 00:00:00 2001
From: Eric Wong <e@80x24.org>
Date: Sat, 10 Sep 2022 08:17:15 +0000
Subject: [PATCH] viewdiff: diff_hunk: shorten conditionals, slightly

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
---
 lib/PublicInbox/ViewDiff.pm | 7 ++-----
 1 file 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 @@";
-- 
2.50.0