staging: Remove unnecessary semicolons when if (foo) {...};
authorJoe Perches <joe@perches.com>
Sun, 10 Apr 2011 21:31:32 +0000 (14:31 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 25 Apr 2011 23:58:34 +0000 (16:58 -0700)
commit9fc86028fa21f8831c0fdc701732cf491da1202c
tree36b1aed544c06bda3a0134e8a023115ca957e49b
parent60b0fa1af9b323f096fb5335f33cc5b4a8f0198d
staging: Remove unnecessary semicolons when if (foo) {...};

Done via perl script:

$ cat remove_semi_if.pl
my $match_balanced_parentheses = qr/(\((?:[^\(\)]++|(?-1))*\))/;
my $match_balanced_braces      = qr/(\{(?:[^\{\}]++|(?-1))*\})/;

foreach my $file (@ARGV) {
    my $f;
    my $text;
    my $oldtext;

    next if ((-d $file));

    open($f, '<', $file)
or die "$P: Can't open $file for read\n";
    $oldtext = do { local($/) ; <$f> };
    close($f);

    next if ($oldtext eq "");

    $text = $oldtext;

    my $count = 0;
    do {
$count = 0;
$count += $text =~ s@\b(if\s*${match_balanced_parentheses}\s*)${match_balanced_braces}\s*;@"$1$3"@egx;
    } while ($count > 0);

    if ($text ne $oldtext) {
my $newfile = $file;

open($f, '>', $newfile)
    or die "$P: Can't open $newfile for write\n";
print $f $text;
close($f);
    }
}

$

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
18 files changed:
drivers/staging/intel_sst/intel_sst_pvt.c
drivers/staging/vt6655/bssdb.c
drivers/staging/vt6655/device_main.c
drivers/staging/vt6655/dpc.c
drivers/staging/vt6655/ioctl.c
drivers/staging/vt6655/power.c
drivers/staging/vt6655/rxtx.c
drivers/staging/vt6655/wcmd.c
drivers/staging/vt6655/wmgr.c
drivers/staging/vt6655/wpactl.c
drivers/staging/vt6656/bssdb.c
drivers/staging/vt6656/dpc.c
drivers/staging/vt6656/ioctl.c
drivers/staging/vt6656/main_usb.c
drivers/staging/vt6656/rxtx.c
drivers/staging/vt6656/wcmd.c
drivers/staging/vt6656/wmgr.c
drivers/staging/vt6656/wpactl.c