From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id AF02D1FD68 for ; Sat, 25 Jan 2020 04:45:14 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 21/22] viewdiff: use autovivification for long_path hash Date: Sat, 25 Jan 2020 04:45:09 +0000 Message-Id: <20200125044510.13769-22-e@yhbt.net> In-Reply-To: <20200125044510.13769-1-e@yhbt.net> References: <20200125044510.13769-1-e@yhbt.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: No sense in wasting code to do something the interpreter already does for us. --- lib/PublicInbox/ViewDiff.pm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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)) {