mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Whitcroft <apw@canonical.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org, Andy Whitcroft <apw@canonical.com>
Subject: [PATCH 3/7] checkpatch: indent checks -- stop when we run out of continuation lines
Date: Fri, 21 Aug 2009 22:46:06 +0100	[thread overview]
Message-ID: <1250891170-8599-4-git-send-email-apw@canonical.com> (raw)
In-Reply-To: <1250891170-8599-1-git-send-email-apw@canonical.com>

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>
---
 scripts/checkpatch.pl |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index aa009a3..b6f267b 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -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++;
+					}
 				}
 			}
 
-- 
1.6.3.3


  parent reply	other threads:[~2009-08-21 21:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-21 21:46 [PATCH 0/7] update checkpatch to v0.29 Andy Whitcroft
2009-08-21 21:46 ` [PATCH 1/7] checkpatch: possible types -- else cannot start a type Andy Whitcroft
2009-08-21 21:46 ` [PATCH 2/7] checkpatch: handle C99 comments correctly (performance issue) Andy Whitcroft
2009-08-21 21:46 ` Andy Whitcroft [this message]
2009-08-21 21:46 ` [PATCH 4/7] checkpatch: make -f alias --file, add --help, more verbose help message Andy Whitcroft
2009-08-25 11:51   ` Pavel Machek
2009-08-21 21:46 ` [PATCH 5/7] checkpatch: format strings should not have brackets in macros Andy Whitcroft
2009-08-21 21:46 ` [PATCH 6/7] checkpatch: limit sN/uN matches to actual bit sizes Andy Whitcroft
2009-08-21 21:46 ` [PATCH 7/7] checkpatch: version 0.29 Andy Whitcroft
2009-08-21 23:54 ` [PATCH 0/7] update checkpatch to v0.29 Andrew Morton
2009-08-25  7:43 ` checkpatch infinite loop ? Eric Dumazet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1250891170-8599-4-git-send-email-apw@canonical.com \
    --to=apw@canonical.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®