From e95a9fc214b6cb4aa721db3682e902f327e354f2 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Sat, 24 Jul 2010 10:46:45 -0600 Subject: warnings.pl: Silence perl compiler warnings warnings.pl was trying to read two beyond the end of an array. --- warnings.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'warnings.pl') diff --git a/warnings.pl b/warnings.pl index ea6e14414d..e57ed1f513 100644 --- a/warnings.pl +++ b/warnings.pl @@ -168,13 +168,13 @@ sub mkRange { my @a = @_ ; my @out = @a ; - my $i ; - - for ($i = 1 ; $i < @a; ++ $i) { + for my $i (1 .. @a - 1) { $out[$i] = ".." - if $a[$i] == $a[$i - 1] + 1 && $a[$i] + 1 == $a[$i + 1] ; + if $a[$i] == $a[$i - 1] + 1 + && ($i >= @a - 1 || $a[$i] + 1 == $a[$i + 1] ); } + $out[-1] = $a[-1] if $out[-1] eq ".."; my $out = join(",",@out); -- cgit v1.2.1