Skip to content

Commit

Permalink
Move vars closer to where they are used.
Browse files Browse the repository at this point in the history
  • Loading branch information
petdance committed Nov 28, 2024
1 parent 576299f commit 8ca1a50
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions ack
Original file line number Diff line number Diff line change
Expand Up @@ -689,12 +689,8 @@ sub file_loop_normal {
sub print_matches_in_file {
my $file = shift;

my $max_count = $opt_m || -1; # Go negative for no limit so it can never reduce to 0.
my $nmatches = 0;
my $filename = $file->name;

my $has_printed_from_this_file = 0;

my $fh = $file->open;
if ( !$fh ) {
if ( $App::Ack::report_bad_filenames ) {
Expand All @@ -709,6 +705,8 @@ sub print_matches_in_file {
}

# Check for context before the main loop, so we don't pay for it if we don't need it.
my $nmatches;
my $max_count = $opt_m || -1; # Go negative for no limit so it can never reduce to 0.
if ( $is_tracking_context ) {
$nmatches = pmif_context( $fh, $filename, $display_filename, $max_count );
}
Expand Down

0 comments on commit 8ca1a50

Please sign in to comment.