unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 4/4] www: simplify GzipFilter->zflush callers
Date: Wed,  3 Aug 2022 07:59:12 +0000	[thread overview]
Message-ID: <20220803075912.10219-5-e@80x24.org> (raw)
In-Reply-To: <20220803075912.10219-1-e@80x24.org>

->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 ] ]
 	}

      parent reply	other threads:[~2022-08-03  7:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-03  7:59 [PATCH 0/4] compression-related stuff Eric Wong
2022-08-03  7:59 ` [PATCH 1/4] www: gzip_filter: gracefully handle socket ->write failures Eric Wong
2022-08-03  7:59 ` [PATCH 2/4] www: gzip_filter: update a few comments Eric Wong
2022-08-03  7:59 ` [PATCH 3/4] ds: use ->dflush to distinguish from ->zflush Eric Wong
2022-08-03  7:59 ` Eric Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://public-inbox.org/README

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220803075912.10219-5-e@80x24.org \
    --to=e@80x24.org \
    --cc=meta@public-inbox.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).