lkml.org 
[lkml]   [2011]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: rename_rev.pl script for reviewing renames
On Thu, Feb 03, 2011 at 01:08:28PM +0300, Dan Carpenter wrote:
> There are a lot of refactoring patches where people change camel case
> names to kernel style names etc. I've written a script to make it
> easier to review them. It's attached.

Cool, thanks for sharing. I guess my comments won't matter much, here
they are anyway :)

> sub usage() {
> print "cat diff | transform.pl old new old new old new...\n";

Filename of the tool does not match.

> # white space at the end of lines
> $line =~ s/ *$//g;
> $line =~ s/\t*$//g;

Character class here as well? Will also get mixtures of the two.

> while (<>) {
> my $line = $_;

You could work here with plain $_, but I assume you don't do on purpose.

>
> if ($line =~ /^---/) {
> next;
> }
> if ($line =~ /^\+\+\+/) {
> next;
> }

Use an alternation in the regexp?

> my $output = filter($line);
> if ($line =~ /^-/) {
> print $oldfh $output;
> next;
> }
> if ($line =~ /^\+/) {
> print $newfh $output;
> next;
> }

Ditto.

Regards,

Wolfram

--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2011-02-03 11:25    [from the cache]
©2003-2011 Jasper Spaans