]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
checksrc: add ASTERISKSPACE
authorDaniel Stenberg <daniel@haxx.se>
Wed, 23 Nov 2016 06:52:38 +0000 (07:52 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 24 Nov 2016 22:48:45 +0000 (23:48 +0100)
Verifies a 'char *name' style, with no space after the asterisk.

lib/checksrc.pl

index 83c38b2394d3b72dca89d283738ce73eb17bf072..9eb76f47ef3866a29baa9e8dac38ac56cbf69ea0 100755 (executable)
@@ -55,7 +55,8 @@ my %warnings = (
     'COPYRIGHT'        => 'file missing a copyright statement',
     'BADCOMMAND'       => 'bad !checksrc! instruction',
     'UNUSEDIGNORE'     => 'a warning ignore was not used',
-    'OPENCOMMENT'      => 'file ended with a /* comment still "open"'
+    'OPENCOMMENT'      => 'file ended with a /* comment still "open"',
+    'ASTERISKSPACE'    => 'pointer declared with space after asterisk'
     );
 
 sub readwhitelist {
@@ -471,6 +472,12 @@ sub scanfile {
             }
         }
 
+        # check for 'char * name'
+        if(($l =~ /(^.*(char|int|long|void|curl_slist|CURL|CURLM|CURLMsg|curl_httppost) *\*) (\w+)/) && ($3 ne "const")) {
+            checkwarn("ASTERISKSPACE",
+                      $line, length($1), $file, $ol,
+                      "no space after declarative asterisk");
+        }
         $line++;
         $prevl = $ol;
     }