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 9F58C1FD45 for ; Sat, 25 Jan 2020 04:45:11 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 04/22] searchview: keep $noop sub private to the package Date: Sat, 25 Jan 2020 04:44:52 +0000 Message-Id: <20200125044510.13769-5-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: It'll always be used as a callback, so there's no point in giving it a name to be called non-anonymously. Making assigments to it is slightly faster since there's no need to repeatedly do a lookup by name. --- lib/PublicInbox/SearchView.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/SearchView.pm b/lib/PublicInbox/SearchView.pm index 94a55b8d..97233069 100644 --- a/lib/PublicInbox/SearchView.pm +++ b/lib/PublicInbox/SearchView.pm @@ -14,7 +14,7 @@ use PublicInbox::SearchThread; our $LIM = 200; my %rmap_inc; -sub noop {} +my $noop = sub {}; sub mbox_results { my ($ctx) = @_; @@ -59,7 +59,7 @@ retry: if ($err) { $code = 400; $ctx->{-html_tip} = '
'.err_txt($ctx, $err).'

'; - $cb = *noop; + $cb = $noop; } elsif ($total == 0) { if (defined($ctx->{-uxs_retried})) { # undo retry damage: @@ -71,7 +71,7 @@ retry: } $code = 404; $ctx->{-html_tip} = "
\n[No results found]

"; - $cb = *noop; + $cb = $noop; } else { return adump($_[0], $mset, $q, $ctx) if $x eq 'A'; @@ -122,7 +122,7 @@ sub mset_summary { $$res .= "$pfx - by $f @ $date UTC [$pct%]\n\n"; } $$res .= search_nav_bot($mset, $q); - *noop; + $noop; } # shorten "/full/path/to/Foo/Bar.pm" to "Foo/Bar.pm" so error