[PATCH 2.6.24-rc8-mm1] checkpatch.pl -- Handle backslashes within quoted string.

From: Tetsuo Handa
Date: Fri Jan 18 2008 - 08:21:20 EST


checkpatch.pl was unable to handle \\ within quoted string.

+static void test(char *sp, char *dp)
+{
+ if (*sp == '\\') {
+ *dp++ = '\\';
+ *dp++ = '\\';
+ }
+}

I hope this patch can fix it.
But I don't know whether there is a side effect or not.
Should we use "X" rather than "\\"?

Signed-off-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
---
scripts/checkpatch.pl | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

--- linux-2.6-mm.orig/scripts/checkpatch.pl
+++ linux-2.6-mm/scripts/checkpatch.pl
@@ -276,6 +276,11 @@ sub sanitise_line {
my $quote = '';

foreach my $c (split(//, $line)) {
+ if ($quote && $l eq "\\" && $c eq "\\") {
+ $res .= "\\";
+ $l = '';
+ next;
+ }
if ($l ne "\\" && ($c eq "'" || $c eq '"')) {
if ($quote eq '') {
$quote = $c;
@@ -286,7 +291,7 @@ sub sanitise_line {
$quote = '';
}
}
- if ($quote && $c ne "\t") {
+ if ($quote && $c ne "\t" && $c ne "\\") {
$res .= "X";
} else {
$res .= $c;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/