From: Dan Carpenter <error27@gmail.com>
To: Lars Lindley <lindley@coyote.org>
Cc: gregkh@suse.de, greg@kroah.com, penberg@cs.helsinki.fi,
pavel@ucw.cz, harvey.harrison@gmail.com,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: strip_whitespace.pl
Date: Sun, 21 Mar 2010 13:55:42 +0300 [thread overview]
Message-ID: <20100321105541.GK5331@bicker> (raw)
In-Reply-To: <4BA5204C.9050208@coyote.org>
I've written a new script called strip_whitespace.pl (included).
One bug is that, if you split or unsplit a string literal that
confuses it. Otherwise it seems to work.
strip_whitespace.pl drivers/staging/winbond/reg.c > before
apply patch
strip_whitespace.pl drivers/staging/winbond/reg.c > after
`diff before after`. If they are the same then resend the patch.
regards,
dan carpenter
#!/usr/bin/perl
use strict;
my $file = shift();
open FILE, "<$file";
my $txt = do { local $/; <FILE> };
# strip C99 comments
$txt =~ s/\/\/.*//g;
# strip newlines
$txt =~ s/\n//g;
# strip remaining comments
$txt =~ s/\/\*.*?\*\///g;
# strip tabs
$txt =~ s/\t//g;
# strip spaces
$txt =~ s/ //g;
# add newlines again
$txt =~ s/;/;\n/g;
print "$txt\n";
next prev parent reply other threads:[~2010-03-21 10:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-20 15:14 [PATCH] staging: winbond: reg.c Coding style fixes Lars Lindley
2010-03-20 16:24 ` Dan Carpenter
2010-03-20 19:21 ` Lars Lindley
2010-03-21 6:58 ` Pavel Machek
2010-03-21 12:39 ` Pekka Enberg
2010-03-21 15:40 ` Lars Lindley
2010-03-21 9:14 ` Dan Carpenter
2010-03-21 10:55 ` Dan Carpenter [this message]
2010-03-21 11:07 ` strip_whitespace.pl Dan Carpenter
2010-03-21 15:31 ` strip_whitespace.pl Lars Lindley
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=20100321105541.GK5331@bicker \
--to=error27@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=greg@kroah.com \
--cc=gregkh@suse.de \
--cc=harvey.harrison@gmail.com \
--cc=lindley@coyote.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=penberg@cs.helsinki.fi \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.