From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id B1C781F8C8 for ; Sun, 26 Sep 2021 01:42:29 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] inbox: cloneurl: avoid undef to hash table value Date: Sun, 26 Sep 2021 01:42:29 +0000 Message-Id: <20210926014229.21296-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: 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 {