Skip to content

Commit

Permalink
More defined() instead of boolean.
Browse files Browse the repository at this point in the history
  • Loading branch information
petdance committed Nov 24, 2024
1 parent a439441 commit 223c0ab
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ack
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ sub print_matches_in_file {
if ( $in_range ) {
$match_colno = undef;
my $is_match = /$search_re/o;
if ( $is_match && $search_not_re ) {
if ( $is_match && defined($search_not_re) ) {
local @-;
$is_match = !/$search_not_re/o;
}
Expand Down Expand Up @@ -1139,25 +1139,25 @@ sub count_matches_in_file {
if ( $using_ranges ) {
while ( <$fh> ) {
chomp;
$in_range = 1 if ( !$in_range && $opt_range_start && /$opt_range_start/o );
$in_range = 1 if ( !$in_range && defined($opt_range_start) && /$opt_range_start/o );
if ( $in_range ) {
my $is_match = /$search_re/o;
if ( $is_match && $search_not_re ) {
if ( $is_match && defined($search_not_re) ) {
$is_match = !/$search_not_re/o;
}
if ( $is_match xor $opt_v ) {
++$nmatches;
last if $bail;
}
}
$in_range = 0 if ( $in_range && $opt_range_end && /$opt_range_end/o );
$in_range = 0 if ( $in_range && defined($opt_range_end) && /$opt_range_end/o );
}
}
else {
while ( <$fh> ) {
chomp;
my $is_match = /$search_re/o;
if ( $is_match && $search_not_re ) {
if ( $is_match && defined($search_not_re) ) {
$is_match = !/$search_not_re/o;
}
if ( $is_match xor $opt_v ) {
Expand Down

0 comments on commit 223c0ab

Please sign in to comment.