From 70a3ec18d29c7fde9a5c06fe019b8bedef7acec8 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 26 Sep 2021 01:42:29 +0000 Subject: 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. --- lib/PublicInbox/Inbox.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/PublicInbox/Inbox.pm') 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 { -- cgit v1.2.3-24-ge0c7