projects/linux·commit 6f779c18

checkpatch: suspect indent count condition lines correctly

6f779c18 · Andy Whitcroft <[email protected]> · 2008-10-15 22:02:27 -07:00

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

Signed-off-by: Andy Whitcroft <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Commit
6f779c18ca74358b6ac8eb8f5d502843fa92be4e
Parents
5368df20

Changes

1 files changed · +2 −1

FileStatusAddDelContent
scripts/checkpatch.plmodified+2−1View file

scripts/checkpatch.pl

View file
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: