checkpatch: suspect indent count condition lines correctly
authorAndy Whitcroft <apw@shadowen.org>
Thu, 16 Oct 2008 05:02:27 +0000 (22:02 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 16 Oct 2008 18:21:36 +0000 (11:21 -0700)
Correct calculation of the number of lines of condition where we have
suspect indent.

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/checkpatch.pl

index a2e4a3d9c6d7cbfdc4b24fbd92224b45a9a85ec0..2e513fdf3043eeed2fc37372c2d8c2cc0db06a32 100755 (executable)
@@ -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: