* [PATCH] inbox: cloneurl: avoid undef to hash table value
@ 2021-09-26 1:42 Eric Wong
0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2021-09-26 1:42 UTC (permalink / raw)
To: meta
This saves us some memory for the hash slot in the common case
the `cloneurl' file doesn't exist.
---
lib/PublicInbox/Inbox.pm | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm
index 3ba92c99..1d5fc708 100644
--- a/lib/PublicInbox/Inbox.pm
+++ b/lib/PublicInbox/Inbox.pm
@@ -216,11 +216,11 @@ sub description {
sub cloneurl {
my ($self) = @_;
- ($self->{cloneurl} //= do {
+ $self->{cloneurl} // do {
my $s = try_cat("$self->{inboxdir}/cloneurl");
my @urls = split(/\s+/s, $s);
- scalar(@urls) ? \@urls : undef
- }) // [];
+ scalar(@urls) ? ($self->{cloneurl} = \@urls) : undef;
+ } // [];
}
sub base_url {
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-09-26 1:42 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-26 1:42 [PATCH] inbox: cloneurl: avoid undef to hash table value Eric Wong
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).