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 8B4BA1F601 for ; Sat, 23 Jul 2022 15:52:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1658591529; bh=rGWgnYggt4zotndTAtBTBvxWUkxE/VBLNw21rEx7hqQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=OAPoktvzmwDuww/8d822yc86kFf1yg81NeCzGmo6+SgU5BpIctq8+XfE/r7zIKJhG lp1BXvBYz/DPC9udPd9VBuMSlcAIPtpWjx2KEw6ikrozWLI435v8aC7PWhbXit3KpK C8UvZack0DzVVAYN1pObEPVgJv8bh9+ijaSWzp+4= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/3] dsdeflate: shorten scope of initial buffer Date: Sat, 23 Jul 2022 15:52:08 +0000 Message-Id: <20220723155209.3811345-3-e@80x24.org> In-Reply-To: <20220723155209.3811345-1-e@80x24.org> References: <20220723155209.3811345-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: There's no need to keep the initial buffer alive in package-wide scope once it's replaced by `$next' in ->write or ->zflush. --- lib/PublicInbox/DSdeflate.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/DSdeflate.pm b/lib/PublicInbox/DSdeflate.pm index b5208e43..bf0ecd38 100644 --- a/lib/PublicInbox/DSdeflate.pm +++ b/lib/PublicInbox/DSdeflate.pm @@ -27,10 +27,10 @@ my %IN_OPT = ( ); # global deflate context and buffer -my $zbuf = \(my $buf = ''); -my $zout; +my ($zout, $zbuf); { my $err; + $zbuf = \(my $initial = ''); # replaced by $next in zflush/write ($zout, $err) = Compress::Raw::Zlib::Deflate->new( # nnrpd (INN) and Compress::Raw::Zlib favor MemLevel=9, # the zlib C library and git use MemLevel=8 as the default