Skip to content

Commit

Permalink
Change two for loops to foreach loops for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Baker committed Mar 9, 2016
1 parent 6b44c19 commit 1ac25e4
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions libs/header_clean/header_clean.pl
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,10 @@ sub strip_empty_first_line {
# Remove + or - at the beginning of the lines
sub strip_leading_indicators {
my $array = shift(); # Array passed in by reference
my $line_count = scalar(@$array);
my $ansi_color_regex = qr/(\e\[[0-9]{1,3}(?:;[0-9]{1,3}){0,3}[mK])?/;

for (my $i = 0; $i < $line_count; $i++) {
$array->[$i] =~ s/^(${ansi_color_regex})[+-]/$1 /;
foreach my $line (@$array) {
$line =~ s/^(${ansi_color_regex})[+-]/$1 /;
}

return 1;
Expand All @@ -141,19 +140,17 @@ sub strip_leading_indicators {
# Remove the first space so everything aligns left
sub strip_first_column {
my $array = shift(); # Array passed in by reference
my $line_count = scalar(@$array);
my $ansi_color_regex = qr/(\e\[[0-9]{1,3}(?:;[0-9]{1,3}){0,3}[mK])?/;

for (my $i = 0; $i < $line_count; $i++) {
$array->[$i] =~ s/^(${ansi_color_regex})[[:space:]]/$1/;
foreach my $line (@$array) {
$line =~ s/^(${ansi_color_regex})[[:space:]]/$1/;
}

return 1;
}

sub mark_empty_lines {
my $array = shift(); # Array passed in by reference
my $line_count = scalar(@$array);
my $ansi_color_regex = qr/(\e\[[0-9]{1,3}(?:;[0-9]{1,3}){0,3}[mK])?/;

my $reset_color = "\e\\[0?m";
Expand Down

0 comments on commit 1ac25e4

Please sign in to comment.