From: Eric Wong Date: Sat, 25 Jan 2020 04:44:52 +0000 (+0000) Subject: searchview: keep $noop sub private to the package X-Git-Tag: v1.3.0~64 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;ds=inline;h=d4cb7fb06031435cd25f5e000bf9c0e4b8b30177;p=public-inbox.git 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. --- 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