From: Eric Wong <e@80x24.org>
To: meta@public-inbox.org
Subject: [PATCH 7/8] nntp: hdr_msg_id: use named sub for long_response
Date: Sat, 21 Dec 2019 08:00:06 +0000 [thread overview]
Message-ID: <20191221080007.27810-8-e@80x24.org> (raw)
In-Reply-To: <20191221080007.27810-1-e@80x24.org>
Introduce hdr_msgid_range_i, which does the same thing as the
anonymous sub it replaces.
---
lib/PublicInbox/NNTP.pm | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/lib/PublicInbox/NNTP.pm b/lib/PublicInbox/NNTP.pm
index ec9ac287..b2927b79 100644
--- a/lib/PublicInbox/NNTP.pm
+++ b/lib/PublicInbox/NNTP.pm
@@ -656,6 +656,14 @@ sub long_response ($$;@) {
undef;
}
+sub hdr_msgid_range_i {
+ my ($self, $beg, $end) = @_;
+ my $r = $self->{ng}->mm->msg_range($beg, $end);
+ @$r or return;
+ more($self, join("\r\n", map { "$_->[0] <$_->[1]>" } @$r));
+ 1;
+}
+
sub hdr_message_id ($$$) { # optimize XHDR Message-ID [range] for slrnpull.
my ($self, $xhdr, $range) = @_;
@@ -667,17 +675,8 @@ sub hdr_message_id ($$$) { # optimize XHDR Message-ID [range] for slrnpull.
$range = $self->{article} unless defined $range;
my $r = get_range($self, $range);
return $r unless ref $r;
- my $mm = $self->{ng}->mm;
- my ($beg, $end) = @$r;
more($self, $xhdr ? r221 : r225);
- long_response($self, sub {
- my $r = $mm->msg_range($beg, $end);
- @$r or return;
- more($self, join("\r\n", map {
- "$_->[0] <$_->[1]>"
- } @$r));
- 1;
- });
+ long_response($self, \&hdr_msgid_range_i, @$r);
}
}
next prev parent reply other threads:[~2019-12-21 8:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-21 7:59 [PATCH 0/8] nntp: eliminate response-duration cyclic refs Eric Wong
2019-12-21 8:00 ` [PATCH 1/8] nntp: get_range: return scalarref for $beg Eric Wong
2019-12-21 8:00 ` [PATCH 2/8] nntp: remove cyclic refs from long_response Eric Wong
2019-12-21 8:00 ` [PATCH 3/8] nntp: hdr_searchmsg: use named sub for numeric range response Eric Wong
2019-12-21 8:00 ` [PATCH 4/8] nntp: cmd_xrover: use named sub for long_response Eric Wong
2019-12-21 8:00 ` [PATCH 5/8] nntp: cmd_listgroup: use named subs " Eric Wong
2019-12-21 8:00 ` [PATCH 6/8] nntp: cmd_newnews: use named sub " Eric Wong
2019-12-21 8:00 ` Eric Wong [this message]
2019-12-21 8:00 ` [PATCH 8/8] nntp: cmd_xover: " 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=20191221080007.27810-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).