]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/GzipFilter.pm
No ext_urls
[public-inbox.git] / lib / PublicInbox / GzipFilter.pm
index 848370ce443b2a9398d73af284381a1af3531ffb..a11ba73fa5b13ae5c680f9664f0f382a11466022 100644 (file)
@@ -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);
@@ -123,8 +123,9 @@ sub http_out ($) {
 }
 
 sub write {
+       my $self = shift;
        # my $ret = bytes::length($_[1]); # XXX does anybody care?
-       http_out($_[0])->write(translate($_[0], $_[1]));
+       http_out($self)->write($self->translate(@_));
 }
 
 sub zfh {
@@ -166,7 +167,7 @@ sub zflush ($;@) {
 sub close {
        my ($self) = @_;
        my $http_out = http_out($self) // return;
-       $http_out->write(zflush($self));
+       $http_out->write($self->zflush);
        (delete($self->{http_out}) // return)->close;
 }