From 4dca6dfadbea2c746f20b8c7d7977ef5f96a3106 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 10 Sep 2022 08:17:24 +0000 Subject: [PATCH] translate: support multiple buffer args 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); -- 2.44.0