From 95a3cace67ff5297e6fc35972e401b7cb17ee310 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 29 Aug 2022 09:26:33 +0000 Subject: www: allow html_oneshot to take an array arg Another step towards making our internal APIs more writev-like and reducing the copies needed for `join' or `.=' concatenation. --- lib/PublicInbox/WwwStream.pm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'lib/PublicInbox/WwwStream.pm') diff --git a/lib/PublicInbox/WwwStream.pm b/lib/PublicInbox/WwwStream.pm index ab006c40..f2777fdc 100644 --- a/lib/PublicInbox/WwwStream.pm +++ b/lib/PublicInbox/WwwStream.pm @@ -164,8 +164,8 @@ sub getline { $ctx->zflush(_html_end($ctx)); } -sub html_oneshot ($$;$) { - my ($ctx, $code, $sref) = @_; +sub html_oneshot ($$;@) { + my ($ctx, $code) = @_[0, 1]; my $res_hdr = [ 'Content-Type' => 'text/html; charset=UTF-8', 'Content-Length' => undef ]; bless $ctx, __PACKAGE__; @@ -174,8 +174,7 @@ sub html_oneshot ($$;$) { $ctx->zmore(html_top($ctx)); $ctx->{base_url} = base_url($ctx); }; - $ctx->zmore($$sref) if $sref; - my $bdy = $ctx->zflush(_html_end($ctx)); + my $bdy = $ctx->zflush(@_[2..$#_], _html_end($ctx)); $res_hdr->[3] = length($bdy); [ $code, $res_hdr, [ $bdy ] ] } -- cgit v1.2.3-24-ge0c7