From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.2 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 7B7A61F725 for ; Fri, 27 Oct 2023 09:40:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1698399641; bh=SGH0Vpqs3rFBMYeZkMElJNCjHloat+UzAU5NUgnuWMY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Pz0wvRpD5DZdMaOYOwWkI1nXKs4qj+pdZEtTr+J2iwOFjr+6fxyCzDvGZy1uFKJHD 7sHVS2tViISgS/l5SXgSh0CeuMezXOGOX37inQ2JMIs8ipE4Y1nao1mzRqc/2SHjQZ zPEN3gZjdhttb5vZD+TzAuklZ4ISqSaPddIGjywo= From: Eric Wong To: spew@80x24.org Subject: [PATCH 10/18] cindex: drop redundant close on regular FH Date: Fri, 27 Oct 2023 09:40:31 +0000 Message-ID: <20231027094039.3788289-10-e@80x24.org> In-Reply-To: <20231027094039.3788289-1-e@80x24.org> References: <20231027094039.3788289-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: There's no need to waste optree space on close() statements for file handles which are (effectively) read-only on their last use. Instead, let Perl refcounting take care of it so we have less code to wade through when focusing on close statements which actually matter. --- lib/PublicInbox/CodeSearchIdx.pm | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/PublicInbox/CodeSearchIdx.pm b/lib/PublicInbox/CodeSearchIdx.pm index c1a1ee90..9117ec3b 100644 --- a/lib/PublicInbox/CodeSearchIdx.pm +++ b/lib/PublicInbox/CodeSearchIdx.pm @@ -268,7 +268,6 @@ sub shard_index { # via wq_io_do in IDX_SHARDS my $cmd = $git->cmd(@LOG_STDIN); my $rd = popen_rd($cmd, undef, { 0 => $in }, \&cidx_reap_log, $cmd, $self, $op_p); - close $in; PublicInbox::CidxLogP->new($rd, $self, $git, $roots); # CidxLogP->event_step will call cidx_read_log_p once there's input } @@ -457,7 +456,6 @@ sub partition_refs ($$$) { my ($self, $git, $refs) = @_; # show-ref --heads --tags --hash output sysseek($refs, 0, SEEK_SET); my $rfh = $git->popen(qw(rev-list --stdin), undef, { 0 => $refs }); - close $refs; my $seen = 0; my @shard_in = map { $_->reopen;