]> Sergey Matveev's repositories - public-inbox.git/commitdiff
dsdeflate: shorten scope of initial buffer
authorEric Wong <e@80x24.org>
Sat, 23 Jul 2022 15:52:08 +0000 (15:52 +0000)
committerEric Wong <e@80x24.org>
Sun, 24 Jul 2022 23:06:07 +0000 (23:06 +0000)
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

index b5208e4368abd63626cf617eda1bd4ba4f00fb08..bf0ecd3877c79295ed99c90c0e2f750f730b6bfe 100644 (file)
@@ -27,10 +27,10 @@ my %IN_OPT = (
 );
 
 # global deflate context and buffer
 );
 
 # global deflate context and buffer
-my $zbuf = \(my $buf = '');
-my $zout;
+my ($zout, $zbuf);
 {
        my $err;
 {
        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
        ($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