about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-11-02 09:35:29 +0000
committerEric Wong <e@80x24.org>2023-11-03 06:39:27 +0000
commit19f9089343c9e579253db756f2131ee493718ead (patch)
treea6563fc535f8e8d8332e4a3e9ebe790328df97e1
parente85d3280129ce60a9587895a44df765a39447634 (diff)
downloadpublic-inbox-19f9089343c9e579253db756f2131ee493718ead.tar.gz
There's no need to waste optree space on close() statements for
file handles which are (effectively) read-only on their last use
and incapable of error checking in our Perl code (since they're
only read by git).

Let Perl refcounting take care of it so we have less code to
wade through when focusing on `close' statements which actually
matter.
-rw-r--r--lib/PublicInbox/CodeSearchIdx.pm4
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/PublicInbox/CodeSearchIdx.pm b/lib/PublicInbox/CodeSearchIdx.pm
index c1a1ee90..ad915fa2 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;
@@ -971,7 +969,7 @@ sub dump_git_commits { # run_await cb
         (defined($pid) && $?) and die "E: @PRUNE_BATCH: \$?=$?";
         return if $DO_QUIT;
         my ($hexlen) = keys(%ALT_FH) or return; # done
-        close(delete $ALT_FH{$hexlen});
+        delete $ALT_FH{$hexlen};
 
         $PRUNE_BATCH[1] = "--git-dir=$TMPDIR/hexlen$hexlen.git";
         run_await(\@PRUNE_BATCH, undef, $batch_opt, \&dump_git_commits);