From: Eric Wong Date: Sat, 25 Jan 2020 04:45:09 +0000 (+0000) Subject: viewdiff: use autovivification for long_path hash X-Git-Tag: v1.3.0~47 X-Git-Url: http://www.git.stargrave.org/?p=public-inbox.git;a=commitdiff_plain;h=19671d5736639c9f5d063a87a075fd309e41d203 viewdiff: use autovivification for long_path hash No sense in wasting code to do something the interpreter already does for us. --- diff --git a/lib/PublicInbox/ViewDiff.pm b/lib/PublicInbox/ViewDiff.pm index ff7d85f5..ece95f4c 100644 --- a/lib/PublicInbox/ViewDiff.pm +++ b/lib/PublicInbox/ViewDiff.pm @@ -92,8 +92,7 @@ sub anchor0 ($$$$$) { # long filenames will require us to walk backwards in anchor1 if ($fn =~ s!\A\.\.\./?!!) { - my $lp = $ctx->{-long_path} ||= {}; - $lp->{$fn} = qr/\Q$fn\E\z/s; + $ctx->{-long_path}->{$fn} = qr/\Q$fn\E\z/s; } if (my $attr = to_attr($ctx->{-apfx}.$fn)) {