[PATCH 5/7] checkpatch: suspect indent count condition lines correctly

From: Andy Whitcroft
Date: Tue Sep 02 2008 - 13:25:33 EST


Correct calculation of the number of lines of condition where we have
suspect indent.

Signed-off-by: Andy Whitcroft <apw@xxxxxxxxxxxx>
---
scripts/checkpatch.pl | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a2e4a3d..2e513fd 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -1417,7 +1417,8 @@ sub process {
$s =~ s/\n./\n/gs;

# Find out how long the conditional actually is.
- my $cond_lines = 0 + $c =~ /\n/gs;
+ my @newlines = ($c =~ /\n/gs);
+ my $cond_lines = 1 + $#newlines;

# We want to check the first line inside the block
# starting at the end of the conditional, so remove:
--
1.6.0.rc1.258.g80295

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/