about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2022-08-03 07:59:12 +0000
committerEric Wong <e@80x24.org>2022-08-03 19:57:38 +0000
commitaa26a8a66c845bc4754f7099b675082899933078 (patch)
treee5a2783df78ca1170b77bb2778d83e262d5a6e2f
parent7d3928a8c2b759149104d41ad09a6cff490fcef7 (diff)
downloadpublic-inbox-aa26a8a66c845bc4754f7099b675082899933078.tar.gz
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.
-rw-r--r--lib/PublicInbox/Mbox.pm3
-rw-r--r--lib/PublicInbox/WwwText.pm6
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 ] ]
         }