From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id D119A1F6A8 for ; Sat, 10 Sep 2022 08:18:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1662797937; bh=q3X3IbcZ5/hoiAcMHrK/zS5O8nE3/bDHmxKDu7Eoisw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=xwO3I7pCjhgA75OseoReggjMdfLEoh2OTysoaxpU9mqSPUw92xwCztt5p7psnn/wN 1ZcKYeo08OLpu3Vz8PqChakymZ6wpNWKaiknNkRzzD+yBQ05wMqylWC02IH/CaXfJG vlXixQGMrDSgnmcNihNaTWiSLPFtzltLJKAJJK0Q= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 33/38] translate: support multiple buffer args Date: Sat, 10 Sep 2022 08:17:24 +0000 Message-Id: <20220910081729.2011934-34-e@80x24.org> In-Reply-To: <20220910081729.2011934-1-e@80x24.org> References: <20220910081729.2011934-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: This will let us drop some calls to zmore in subsequent commits. --- lib/PublicInbox/GzipFilter.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/PublicInbox/GzipFilter.pm b/lib/PublicInbox/GzipFilter.pm index 848370ce..72ab5d50 100644 --- a/lib/PublicInbox/GzipFilter.pm +++ b/lib/PublicInbox/GzipFilter.pm @@ -94,15 +94,15 @@ sub gone { # what: search/over/mm # for GetlineBody (via Qspawn) when NOT using $env->{'pi-httpd.async'} # Also used for ->getline callbacks -sub translate ($$) { - my $self = $_[0]; # $_[1] => input +sub translate { + my $self = shift; # $_[1] => input # allocate the zlib context lazily here, instead of in ->new. # Deflate contexts are memory-intensive and this object may # be sitting in the Qspawn limiter queue for a while. $self->{gz} //= gzip_or_die(); - if (defined $_[1]) { # my $buf = $_[1]; - zmore($self, $_[1]); + if (defined $_[0]) { # my $buf = $_[1]; + zmore($self, @_); length($self->{zbuf}) >= 8192 ? delete($self->{zbuf}) : ''; } else { # undef == EOF zflush($self);