From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 7/8] gzip_filter: ->zmore and ->zflush support multiple args
Date: Tue, 23 Aug 2022 08:32:02 +0000 [thread overview]
Message-ID: <20220823083203.1128993-8-e@80x24.org> (raw)
In-Reply-To: <20220823083203.1128993-1-e@80x24.org>
This will make writev-like use easier for the next commit,
and also future changes where I'll rely more on zlib for
buffering.
---
lib/PublicInbox/GzipFilter.pm | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/lib/PublicInbox/GzipFilter.pm b/lib/PublicInbox/GzipFilter.pm
index bdd313f5..86d34183 100644
--- a/lib/PublicInbox/GzipFilter.pm
+++ b/lib/PublicInbox/GzipFilter.pm
@@ -139,19 +139,22 @@ sub write {
sub zmore {
my $self = $_[0]; # $_[1] => input
http_out($self);
- my $err = $self->{gz}->deflate($_[1], $self->{zbuf});
- die "gzip->deflate: $err" if $err != Z_OK;
+ my $err;
+ for (1..$#_) {
+ $err = $self->{gz}->deflate($_[$_], $self->{zbuf});
+ die "gzip->deflate: $err" if $err != Z_OK;
+ }
undef;
}
# flushes and returns the final bit of gzipped data
-sub zflush ($;$) {
- my $self = $_[0]; # $_[1] => final input (optional)
+sub zflush ($;@) {
+ my $self = $_[0]; # $_[1..Inf] => final input (optional)
my $zbuf = delete $self->{zbuf};
my $gz = delete $self->{gz};
my $err;
- if (defined $_[1]) { # it's a bug iff $gz is undef w/ $_[1]
- $err = $gz->deflate($_[1], $zbuf);
+ for (1..$#_) { # it's a bug iff $gz is undef w/ $_[1..]
+ $err = $gz->deflate($_[$_], $zbuf);
die "gzip->deflate: $err" if $err != Z_OK;
}
$gz // return ''; # not a bug, recursing on DS->write failure
next prev parent reply other threads:[~2022-08-23 8:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-23 8:31 [PATCH 0/8] www: diff viewing enhancements Eric Wong
2022-08-23 8:31 ` [PATCH 1/8] view: generate query in single-message and commit views Eric Wong
2022-08-24 1:09 ` Kyle Meyer
2022-08-23 8:31 ` [PATCH 2/8] viewdiff: linkify diffstats for non-format-patch emails Eric Wong
2022-08-23 8:31 ` [PATCH 3/8] viewvcs: remove patchid line from commit header Eric Wong
2022-08-23 8:31 ` [PATCH 4/8] viewvcs: show commit titles for parent commits Eric Wong
2022-08-23 8:32 ` [PATCH 5/8] viewvcs: separate email and date with spaces Eric Wong
2022-08-23 8:32 ` [PATCH 6/8] ibx_async_cat: access ->{git} directly Eric Wong
2022-08-23 8:32 ` Eric Wong [this message]
2022-08-23 8:32 ` [PATCH 8/8] viewvcs: don't wait on slow disks for git commit titles Eric Wong
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=20220823083203.1128993-8-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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
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).