]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
www_coderepo: capture uses a flattened list
authorEric Wong <e@80x24.org>
Wed, 25 Oct 2023 00:29:27 +0000 (00:29 +0000)
committerEric Wong <e@80x24.org>
Wed, 25 Oct 2023 07:28:32 +0000 (07:28 +0000)
We no longer need a multi-dimensional list to pass multiple
arguments to the psgi_qx callback.  This simplifies usage
and reduces allocations.

lib/PublicInbox/WwwCoderepo.pm

index e8c340b5dc76c5e3aaf960f589628d52a870b0fd..68c4c86d72c48c279767ff077f6cbfa9b6b27453 100644 (file)
@@ -178,9 +178,8 @@ EOM
 }
 
 sub capture { # psgi_qx callback to capture git-for-each-ref
-       my ($bref, $arg) = @_; # arg = [ctx, key, OnDestroy(summary_END)]
-       utf8_maybe($$bref);
-       $arg->[0]->{qx_res}->{$arg->[1]} = $$bref;
+       my ($bref, $ctx, $key) = @_; #  $_[3] = OnDestroy(summary_END)
+       $ctx->{qx_res}->{$key} = $$bref;
        # summary_END may be called via OnDestroy $arg->[2]
 }
 
@@ -220,8 +219,7 @@ sub summary ($$) {
                my ($k, $cmd) = @$_;
                my $qsp = PublicInbox::Qspawn->new($cmd, \%env, \%opt);
                $qsp->{qsp_err} = $qsp_err;
-               $qsp->psgi_qx($ctx->{env}, undef, \&capture,
-                               [$ctx, $k, $END]);
+               $qsp->psgi_qx($ctx->{env}, undef, \&capture, $ctx, $k, $END);
        }
        $tip //= 'HEAD';
        my @try = ("$tip:README", "$tip:README.md"); # TODO: configurable