checkpatch: indent checks -- stop when we run out of continuation lines
authorAndy Whitcroft <apw@canonical.com>
Tue, 22 Sep 2009 00:04:36 +0000 (17:04 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 22 Sep 2009 14:17:48 +0000 (07:17 -0700)
Ensure we terminate when there are no futher continuation lines when
trying to determine relative indent of conditionals and their blocks.

Reported-by: John Daiker <daikerjohn@gmail.com>
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/checkpatch.pl

index aa009a3b5b81cbcd6f7766cef3956b90ed2bbc01..b6f267b720352270fade77275ee29d2862dcee7d 100755 (executable)
@@ -1547,8 +1547,9 @@ sub process {
                                    $s =~ /^\s*#\s*?/ ||
                                    $s =~ /^\s*$Ident\s*:/) {
                                        $continuation = ($s =~ /^.*?\\\n/) ? 1 : 0;
-                                       $s =~ s/^.*?\n//;
-                                       $cond_lines++;
+                                       if ($s =~ s/^.*?\n//) {
+                                               $cond_lines++;
+                                       }
                                }
                        }