From 2ac2023fa416e31189708c355db8728abbd9ef2c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 28 Feb 2016 11:28:33 +0000 Subject: reduce calls to close unless error checks are needed We can rely on timely auto-destruction based on reference counting; reducing the chance of redundant close(2) calls which may hit the wront FD. We do care about certain close calls (e.g. writing to a buffered IO handle) if we require error-checking for write-integrity. In other cases, let things go out-of-scope so it can be freed automatically after use. --- lib/PublicInbox/SearchIdx.pm | 2 -- 1 file changed, 2 deletions(-) (limited to 'lib/PublicInbox/SearchIdx.pm') diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm index 1d0d926f..415decd1 100644 --- a/lib/PublicInbox/SearchIdx.pm +++ b/lib/PublicInbox/SearchIdx.pm @@ -348,7 +348,6 @@ sub rlog { $latest = $1; } } - close $log; $latest; } @@ -446,7 +445,6 @@ sub _read_git_config_perm { my @cmd = qw(config core.sharedRepository); my $fh = PublicInbox::Git->new($self->{git_dir})->popen(@cmd); my $perm = <$fh>; - close $fh; chomp $perm if defined $perm; $perm; } -- cgit v1.2.3-24-ge0c7