From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 2408D1F68D for ; Wed, 25 Oct 2023 00:29:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1698193790; bh=rslVh8Jdy7FNOfmW3zilMw8R5sO0hv8ReaPN/SYyxC4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=HRpgY15pK8yDhfzxjv7LvugGKcGMjgIqsUV9CYglKv2FMuOBPYBmE5hlYcT6m7j+J W/4Szfy6sqfHkNL3HhEtudkiua9LRxeTU+VBgYpgY2F+ACVht1LUCRff+S/29CzLoz 5dqZUH9w7H8OJPaCQ1FjCSvrqmYSVwOsdFO9dPIM= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 04/26] www_coderepo: capture uses a flattened list Date: Wed, 25 Oct 2023 00:29:27 +0000 Message-ID: <20231025002949.3092193-5-e@80x24.org> In-Reply-To: <20231025002949.3092193-1-e@80x24.org> References: <20231025002949.3092193-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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 | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/PublicInbox/WwwCoderepo.pm b/lib/PublicInbox/WwwCoderepo.pm index e8c340b5..68c4c86d 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