about summary refs log tree commit homepage
path: root/lib/PublicInbox/WwwListing.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2020-09-09 06:26:12 +0000
committerEric Wong <e@80x24.org>2020-09-10 19:45:18 +0000
commit352e2799ecec328f71aa33219214a0e3fc3d5f10 (patch)
tree4f1f22c286d613843d62c49d695a99f2ea05b08c /lib/PublicInbox/WwwListing.pm
parentde9648ca847cf032aab6da9cac1217bf9cca9c90 (diff)
downloadpublic-inbox-352e2799ecec328f71aa33219214a0e3fc3d5f10.tar.gz
In Perl, we can simplify callers by passing a single array
all the way down the stack instead of a single array ref which
needs to be expanded every call.
Diffstat (limited to 'lib/PublicInbox/WwwListing.pm')
-rw-r--r--lib/PublicInbox/WwwListing.pm13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/PublicInbox/WwwListing.pm b/lib/PublicInbox/WwwListing.pm
index 12b0d9ad..a7c7cbc1 100644
--- a/lib/PublicInbox/WwwListing.pm
+++ b/lib/PublicInbox/WwwListing.pm
@@ -12,21 +12,19 @@ use PublicInbox::ManifestJsGz;
 use bytes (); # bytes::length
 
 sub list_all_i {
-        my ($ibx, $arg) = @_;
-        my ($list, $hide_key) = @$arg;
+        my ($ibx, $list, $hide_key) = @_;
         push @$list, $ibx unless $ibx->{-hide}->{$hide_key};
 }
 
 sub list_all ($$$) {
         my ($self, $env, $hide_key) = @_;
         my $list = [];
-        $self->{pi_config}->each_inbox(\&list_all_i, [ $list, $hide_key ]);
+        $self->{pi_config}->each_inbox(\&list_all_i, $list, $hide_key);
         $list;
 }
 
 sub list_match_domain_i {
-        my ($ibx, $arg) = @_;
-        my ($list, $hide_key, $re) = @$arg;
+        my ($ibx, $list, $hide_key, $re) = @_;
         if (!$ibx->{-hide}->{$hide_key} && grep(/$re/, @{$ibx->{url}})) {
                 push @$list, $ibx;
         }
@@ -37,9 +35,8 @@ sub list_match_domain ($$$) {
         my $list = [];
         my $host = $env->{HTTP_HOST} // $env->{SERVER_NAME};
         $host =~ s/:[0-9]+\z//;
-        my $arg = [ $list, $hide_key,
-                qr!\A(?:https?:)?//\Q$host\E(?::[0-9]+)?/!i ];
-        $self->{pi_config}->each_inbox(\&list_match_domain_i, $arg);
+        $self->{pi_config}->each_inbox(\&list_match_domain_i, $list, $hide_key,
+                                qr!\A(?:https?:)?//\Q$host\E(?::[0-9]+)?/!i);
         $list;
 }