Re: strip_whitespace.pl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Yes this seems like a good tool to use.
I will sure use it in the future..

/Lars


On 2010-03-21 12:07, Dan Carpenter wrote:
> On Sun, Mar 21, 2010 at 01:55:42PM +0300, Dan Carpenter wrote:
>> 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.
> 
> On further reflection your new patch looks fine, if you combine the two.  
> But next time could you use my script?
> 
> Acked-by:  Dan Carpenter <error27@xxxxxxxxx>
> 
> regards,
> dan carpenter
> 
>>
>> 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";
> 
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel

[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux