From: Eric Wong Date: Sun, 26 Sep 2021 01:42:29 +0000 (+0000) Subject: inbox: cloneurl: avoid undef to hash table value X-Git-Tag: v1.7.0~263 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=70a3ec18d29c7fde9a5c06fe019b8bedef7acec8;p=public-inbox.git inbox: cloneurl: avoid undef to hash table value This saves us some memory for the hash slot in the common case the `cloneurl' file doesn't exist. --- 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 {