mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Whitcroft <apw@shadowen.org>
To: Andrew Morton <akpm@osdl.org>
Cc: Randy Dunlap <rdunlap@xenotime.net>,
	Joel Schopp <jschopp@austin.ibm.com>, Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org, Andy Whitcroft <apw@shadowen.org>
Subject: [PATCH 5/7] checkpatch: suspect indent count condition lines correctly
Date: Tue,  2 Sep 2008 18:25:12 +0100	[thread overview]
Message-ID: <1220376314-15180-6-git-send-email-apw@shadowen.org> (raw)
In-Reply-To: <1220376314-15180-1-git-send-email-apw@shadowen.org>

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

Signed-off-by: Andy Whitcroft <apw@shadowen.org>
---
 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


  parent reply	other threads:[~2008-09-02 17:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-02 17:25 [PATCH 0/7] checkpatch: update to version 0.23 Andy Whitcroft
2008-09-02 17:25 ` [PATCH 1/7] checkpatch: case/default checks should only check changed lines Andy Whitcroft
2008-09-02 17:25 ` [PATCH 2/7] checkpatch: suppress errors triggered by short patch Andy Whitcroft
2008-09-02 17:25 ` [PATCH 3/7] checkpatch: handle comment/quote nesting correctly Andy Whitcroft
2008-09-11 18:46   ` Jaswinder Singh
2008-09-02 17:25 ` [PATCH 4/7] checkpatch: check line endings in text format files Andy Whitcroft
2008-09-02 17:25 ` Andy Whitcroft [this message]
2008-09-02 17:25 ` [PATCH 6/7] checkpatch: ensure we only apply checks to the lines within hunks Andy Whitcroft
2008-09-02 17:25 ` [PATCH 7/7] checkpatch: version: 0.23 Andy Whitcroft

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=1220376314-15180-6-git-send-email-apw@shadowen.org \
    --to=apw@shadowen.org \
    --cc=akpm@osdl.org \
    --cc=jschopp@austin.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rdunlap@xenotime.net \
    /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®