From: Eric Wong Date: Wed, 25 Oct 2023 00:29:27 +0000 (+0000) Subject: www_coderepo: capture uses a flattened list X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e07851ef4f9a617718d3f9d48e42bbe0204eb9d4;p=thirdparty%2Fpublic-inbox.git www_coderepo: capture uses a flattened list We no longer need a multi-dimensional list to pass multiple arguments to the psgi_qx callback. This simplifies usage and reduces allocations. --- diff --git a/lib/PublicInbox/WwwCoderepo.pm b/lib/PublicInbox/WwwCoderepo.pm index e8c340b5d..68c4c86d7 100644 --- a/lib/PublicInbox/WwwCoderepo.pm +++ b/lib/PublicInbox/WwwCoderepo.pm @@ -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