1. 26 Apr, 2011 35 commits
  2. 25 Apr, 2011 5 commits
    • Joe Perches's avatar
      staging: Remove unnecessary semicolons when switch (foo) {...}; · 95cd17c9
      Joe Perches authored
      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: default avatarJoe Perches <joe@perches.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      95cd17c9
    • Joe Perches's avatar
      staging: Remove unnecessary semicolons when for (foo) {...}; · 273f4bef
      Joe Perches authored
      Done via perl script:
      
      $ cat remove_semi_for.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(for\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: default avatarJoe Perches <joe@perches.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      273f4bef
    • Joe Perches's avatar
      staging: Remove unnecessary semicolons when while (foo) {...}; · b0b0fb0f
      Joe Perches authored
      Done via perl script:
      
      $ cat remove_semi_while.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(while\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);
          }
      }
      
      $
      
      One false positive removed.
      Signed-off-by: default avatarJoe Perches <joe@perches.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      b0b0fb0f
    • Joe Perches's avatar
      staging: Remove unnecessary semicolons when if (foo) {...}; · 9fc86028
      Joe Perches authored
      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: default avatarJoe Perches <joe@perches.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
      9fc86028
    • Greg Kroah-Hartman's avatar
      60b0fa1a