From: Eric Wong Date: Wed, 3 Aug 2022 07:59:12 +0000 (+0000) Subject: www: simplify GzipFilter->zflush callers X-Git-Tag: v1.9.0~61 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=aa26a8a66c845bc4754f7099b675082899933078;p=public-inbox.git www: simplify GzipFilter->zflush callers ->zflush can take a buffer arg, so there's no need to make a separate call to ->translate in some cases. --- diff --git a/lib/PublicInbox/Mbox.pm b/lib/PublicInbox/Mbox.pm index b977308d..e65f38f0 100644 --- a/lib/PublicInbox/Mbox.pm +++ b/lib/PublicInbox/Mbox.pm @@ -24,8 +24,7 @@ sub getline { if ($n) { $ctx->translate(msg_body($eml)); } else { # last message - $ctx->zmore(msg_body($eml)); - $ctx->zflush; + $ctx->zflush(msg_body($eml)); } } diff --git a/lib/PublicInbox/WwwText.pm b/lib/PublicInbox/WwwText.pm index 2937c333..369328ee 100644 --- a/lib/PublicInbox/WwwText.pm +++ b/lib/PublicInbox/WwwText.pm @@ -38,11 +38,7 @@ sub get_text { } my $env = $ctx->{env}; if ($raw) { - if ($code == 200) { - my $gzf = gzf_maybe($hdr, $env); - $txt = $gzf->translate($txt); - $txt .= $gzf->zflush; - } + $txt = gzf_maybe($hdr, $env)->zflush($txt) if $code == 200; $hdr->[3] = length($txt); return [ $code, $hdr, [ $txt ] ] }