Skip to content

Commit

Permalink
Merge pull request #506 from sth/unnecessary-variables
Browse files Browse the repository at this point in the history
Removed some unnecessary variables
  • Loading branch information
hoelzro committed Oct 22, 2014
2 parents 88573de + 32e0f47 commit 7de5a42
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions ack
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,6 @@ sub print_line_with_context {
}

my $ors = $opt_print0 ? "\0" : "\n";
my $match_word = $opt->{w};
my $is_tracking_context = $opt_after_context || $opt_before_context;

$matching_line =~ s/[\r\n]+$//g;
Expand Down Expand Up @@ -929,10 +928,9 @@ sub resource_has_match {
}
}
else {
my $re = $opt_regex;
if ( $opt_v ) {
while ( <$fh> ) {
if (!/$re/o) {
if (!/$opt_regex/o) {
$has_match = 1;
last;
}
Expand All @@ -945,7 +943,7 @@ sub resource_has_match {
local $/;
<$fh>;
};
$has_match = $content =~ /$re/o;
$has_match = $content =~ /$opt_regex/o;
}
close $fh;
}
Expand All @@ -964,18 +962,17 @@ sub count_matches_in_resource {
}
}
else {
my $re = $opt_regex;
if ( $opt_v ) {
while ( <$fh> ) {
++$nmatches if (!/$re/o);
++$nmatches if (!/$opt_regex/o);
}
}
else {
my $content = do {
local $/;
<$fh>;
};
$nmatches =()= ($content =~ /$re/og);
$nmatches =()= ($content =~ /$opt_regex/og);
}
close $fh;
}
Expand Down Expand Up @@ -1114,8 +1111,6 @@ RESOURCES:
last RESOURCES if defined($opt_m) && $nmatches >= $opt_m;
}
elsif ( $opt_lines ) {
my $opt_passthru = $opt_passthru;

my %line_numbers;
foreach my $line ( @{ $opt_lines } ) {
my @lines = split /,/, $line;
Expand Down

0 comments on commit 7de5a42

Please sign in to comment.