]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
correct multiple internal spaces
authorNick Mathewson <nickm@torproject.org>
Sun, 28 Nov 2004 09:14:07 +0000 (09:14 +0000)
committerNick Mathewson <nickm@torproject.org>
Sun, 28 Nov 2004 09:14:07 +0000 (09:14 +0000)
svn:r3004

contrib/checkSpace.pl
src/common/util.c
src/or/test.c

index f64a22fb9bfef6d3deac1b10d85c70087579a067..8724250bc2e8ae3cf8bf7d207fcb683ca15fdfe8 100755 (executable)
@@ -40,13 +40,13 @@ for $fn (@ARGV) {
            }
        }
        if (m!/\*.*?\*/!) {
-           s!/\*.*?\*/!!;
+           s!\s*/\*.*?\*/!!;
        } elsif (m!/\*!) {
-           s!/\*!!;
+           s!\s*/\*!!;
            $incomment = 1;
            next;
        }
-       s!"(?:[^\"]+|\\.)*"!!g;
+       s!"(?:[^\"]+|\\.)*"!"X"!g;
        next if /^\#/;
        ## Warn about C++-style comments.
        if (m!//!) {
@@ -57,16 +57,8 @@ for $fn (@ARGV) {
        if (/([^\s])\{/) {
            print "       $1\{:$fn:$.\n";
        }
-       ## Warn about function calls with space before parens.
-       if (/(\w+)\s\(/) {
-           if ($1 ne "if" and $1 ne "while" and $1 ne "for" and 
-               $1 ne "switch" and $1 ne "return" and $1 ne "int" and 
-                $1 ne "void" and $1 ne "__attribute__") {
-               print "     fn ():$fn:$.\n";
-           }
-       }
        ## Warn about multiple internal spaces.
-       #if (/\S\s{2,}[^\s\\]/) {
+       #if (/[^\s,:]\s{2,}[^\s\\=]/) {
        #    print "     X  X:$fn:$.\n";
        #}
        ## Warn about { with stuff after.
@@ -74,6 +66,14 @@ for $fn (@ARGV) {
        #if (/\{[^\}\\]+$/) {
        #    print "     {X:$fn:$.\n";
        #}
+       ## Warn about function calls with space before parens.
+       if (/(\w+)\s\(/) {
+           if ($1 ne "if" and $1 ne "while" and $1 ne "for" and 
+               $1 ne "switch" and $1 ne "return" and $1 ne "int" and 
+                $1 ne "void" and $1 ne "__attribute__") {
+               print "     fn ():$fn:$.\n";
+           }
+       }
     }
     close(F);
 }
index 31ec0d5f4cce8c2879004d37bc5949f5c535ecb6..055dfbcc576f8f4452d91bf49e234ddeede8a452 100644 (file)
@@ -1207,7 +1207,7 @@ parse_addr_and_port_range(const char *s, uint32_t *addr_out,
     *port_max_out = 65535;
   } else {
     endptr = NULL;
-    *port_min_out =  (uint16_t) tor_parse_long(port, 10, 1, 65535,
+    *port_min_out = (uint16_t) tor_parse_long(port, 10, 1, 65535,
                                                NULL, &endptr);
     if (*endptr == '-') {
       port = endptr+1;
index f80cc55204ec73195cad6af718a2bd8a30637499..d5960926916bae68cc442bf112a22789251ae2a1 100644 (file)
@@ -680,9 +680,9 @@ test_util(void) {
   test_eq(0L, tor_parse_long("10",10,50,100,NULL,NULL));
 
   /* Test parse_line_from_str */
-  strlcpy(buf, "k v\n" " key    value with spaces   \n"  "keykey val\n"
+  strlcpy(buf, "k v\n" " key    value with spaces   \n" "keykey val\n"
           "k2\n"
-          "k3 \n"  "\n" "   \n" "#comment\n"
+          "k3 \n" "\n" "   \n" "#comment\n"
           "k4#a\n" "k5#abc\n" "k6 val #with comment\n", sizeof(buf));
   cp = buf;