From 25fb42242320ffb55655d89268ddbb468eab9a6a Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 23 Jul 2022 15:52:08 +0000 Subject: [PATCH] dsdeflate: shorten scope of initial buffer 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 -- 2.44.0