]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Patch from karsten to detect unnecessary \n's.
authorMike Perry <mikeperry-git@fscked.org>
Sat, 20 Feb 2010 21:44:15 +0000 (13:44 -0800)
committerMike Perry <mikeperry-git@fscked.org>
Tue, 23 Feb 2010 00:52:11 +0000 (16:52 -0800)
Also fix a spacing issue.

contrib/checkSpace.pl

index db061a08288ce471ec58652a7fb7aa8a7171d7e9..b694abff6437a43ff42da6f197c144d1af840724 100755 (executable)
@@ -28,11 +28,15 @@ for $fn (@ARGV) {
         if ($C && /\s(?:if|while|for|switch)\(/) {
             print "      KW(:$fn:$.\n";
         }
-       ## Warn about #else #if instead of #elif. 
-       if (($lastline =~ /^\# *else/) and ($_ =~ /^\# *if/)) {
+        ## Warn about #else #if instead of #elif. 
+        if (($lastline =~ /^\# *else/) and ($_ =~ /^\# *if/)) {
             print " #else#if:$fn:$.\n";
-       }
-       $lastline = $_;
+        }
+        $lastline = $_;
+        ## Warn about unnecessary empty lines.
+        if ($lastnil && /^\s*}\n/) {
+            print "  UnnecNL:$fn:$.\n";
+        }
         ## Warn about multiple empty lines.
         if ($lastnil && /^$/) {
             print " DoubleNL:$fn:$.\n";