From aa26a8a66c845bc4754f7099b675082899933078 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 3 Aug 2022 07:59:12 +0000 Subject: [PATCH] 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. --- lib/PublicInbox/Mbox.pm | 3 +-- lib/PublicInbox/WwwText.pm | 6 +----- 2 files changed, 2 insertions(+), 7 deletions(-) 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 ] ] } -- 2.44.0