From d4cb7fb06031435cd25f5e000bf9c0e4b8b30177 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 25 Jan 2020 04:44:52 +0000 Subject: [PATCH] searchview: keep $noop sub private to the package 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 -- 2.44.0