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

Done via perl script:

$ cat remove_semi_switch.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(switch\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>
16 files changed:
drivers/staging/ath6kl/os/linux/ar6000_drv.c
drivers/staging/comedi/drivers/adl_pci9118.c
drivers/staging/comedi/drivers/cb_pcidda.c
drivers/staging/comedi/drivers/cb_pcimdas.c
drivers/staging/comedi/drivers/ni_660x.c
drivers/staging/comedi/drivers/ni_mio_common.c
drivers/staging/comedi/drivers/ni_tio.c
drivers/staging/comedi/drivers/pcl818.c
drivers/staging/crystalhd/crystalhd_misc.c
drivers/staging/cx25821/cx25821-video.c
drivers/staging/hv/hv_util.c
drivers/staging/iio/accel/lis3l02dq_core.c
drivers/staging/iio/addac/adt7316.c
drivers/staging/lirc/lirc_serial.c
drivers/staging/vt6655/wpactl.c
drivers/staging/vt6656/wpactl.c