From 28ee19c32a1ecf8e22f30e8f9de860695f4fb30c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 29 Aug 2015 21:30:27 +0000 Subject: avoid length in boolean context Perl does not currently optimize for this. ref (from p5p): http://mid.gmane.org/D5C27970-9176-4C7A-8B99-7D78360E67A2@pobox.com --- lib/PublicInbox/SearchIdx.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/PublicInbox/SearchIdx.pm') diff --git a/lib/PublicInbox/SearchIdx.pm b/lib/PublicInbox/SearchIdx.pm index 292419e1..2ac53a73 100644 --- a/lib/PublicInbox/SearchIdx.pm +++ b/lib/PublicInbox/SearchIdx.pm @@ -74,7 +74,7 @@ sub add_message { my $subj = $smsg->subject; - if (length $subj) { + if ($subj ne '') { $doc->add_term(xpfx('subject') . $subj); my $path = $self->subject_path($subj); @@ -308,7 +308,7 @@ sub _index_sync { my $git = PublicInbox::GitCatFile->new($self->{git_dir}); my $latest = $db->get_metadata('last_commit'); - my $range = length $latest ? "$latest..$head" : $head; + my $range = $latest eq '' ? $head : "$latest..$head"; $latest = undef; # get indexed messages @@ -394,7 +394,7 @@ sub _read_git_config_perm { sub _git_config_perm { my $self = shift; my $perm = scalar @_ ? $_[0] : _read_git_config_perm($self); - return PERM_GROUP if (!defined($perm) || !length($perm)); + return PERM_GROUP if (!defined($perm) || $perm eq ''); return PERM_UMASK if ($perm eq 'umask'); return PERM_GROUP if ($perm eq 'group'); if ($perm =~ /\A(?:all|world|everybody)\z/) { -- cgit v1.2.3-24-ge0c7