From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id F40C91F61A for ; Wed, 3 Aug 2022 07:59:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1659513553; bh=Dns3khS1T22c6tt9ZqT/VMoyHKfk8w1H2Jbt5zSBUsg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=s4UaeRmCGHlKHawNTbkFQblp2YDop6GByLt4PDwbHtNi6QhbrcutlCanWgLzLVYMo cMAIV9V5516UHic8yqX0Gt8qRB13MBSa2BIkxwTzedp36qNgRLH9qh8bs1M/PtNOUA lTQzOHyZNa8U28AwrSSQG4e2kGRyxRZlyP0nG2yk= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 4/4] www: simplify GzipFilter->zflush callers Date: Wed, 3 Aug 2022 07:59:12 +0000 Message-Id: <20220803075912.10219-5-e@80x24.org> In-Reply-To: <20220803075912.10219-1-e@80x24.org> References: <20220803075912.10219-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: ->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 ] ] }