]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
checksrc: warn on empty line before open brace
authorDaniel Stenberg <daniel@haxx.se>
Thu, 15 Oct 2020 13:30:55 +0000 (15:30 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 15 Oct 2020 21:32:26 +0000 (23:32 +0200)
... and fix a few occurances

Closes #6088

lib/checksrc.pl
lib/ftp.c
lib/multi.c
lib/vauth/ntlm.c
lib/vtls/openssl.c
tests/unit/unit1604.c

index 78b9cef5bd3977d3a1a084d9b62aff6a751e47cb..126f3c77ed59cc40776adaf0fd292065e03797ed 100755 (executable)
@@ -85,6 +85,7 @@ my %warnings = (
     'DOBRACE'          => 'A single space between do and open brace',
     'BRACEWHILE'       => 'A single space between open brace and while',
     'EXCLAMATIONSPACE' => 'Whitespace after exclamation mark in expression',
+    'EMPTYLINEBRACE'   => 'Empty line before the open brace',
     );
 
 sub readskiplist {
@@ -594,6 +595,11 @@ sub scanfile {
             checkwarn("PARENBRACE",
                       $line, length($1)+1, $file, $l, "missing space after close paren");
         }
+        # check for "^{" with an empty line before it
+        if(($l =~ /^\{/) && ($prevl =~ /^[ \t]*\z/)) {
+            checkwarn("EMPTYLINEBRACE",
+                      $line, 0, $file, $l, "empty line before open brace");
+        }
 
         # check for space before the semicolon last in a line
         if($l =~ /^(.*[^ ].*) ;$/) {
index 11031da6fbc93416a9bc0c005938596770a0f98a..46533c71b885a67841465af43ca9582256c4a587 100644 (file)
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -901,7 +901,6 @@ typedef enum {
 
 static CURLcode ftp_state_use_port(struct connectdata *conn,
                                    ftpport fcmd) /* start with this */
-
 {
   CURLcode result = CURLE_OK;
   struct ftp_conn *ftpc = &conn->proto.ftpc;
index 4cc7c5ae612794c2ce12d147479ce728cf004f36..9f7de97be2ea91f9c0a758706cb005a1dbe1a633 100644 (file)
@@ -3158,7 +3158,6 @@ CURLMcode curl_multi_socket_action(struct Curl_multi *multi, curl_socket_t s,
 }
 
 CURLMcode curl_multi_socket_all(struct Curl_multi *multi, int *running_handles)
-
 {
   CURLMcode result;
   if(multi->in_callback)
index ecfeacb9af8c34762c0f6f2ec4b7519adc745bd2..540ac9482aa01d1d1dccb1dc86f634952295aa3a 100644 (file)
@@ -497,7 +497,6 @@ CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data,
                                              const char *passwdp,
                                              struct ntlmdata *ntlm,
                                              char **outptr, size_t *outlen)
-
 {
   /* NTLM type-3 message structure:
 
index 28a1ae6dab6c1873cdb0ab5c79d77da18274fc41..76d0bc413d7d55ed7659e795bab623855ce55291 100644 (file)
@@ -3453,7 +3453,6 @@ typedef int numcert_t;
 
 static CURLcode get_cert_chain(struct connectdata *conn,
                                struct ssl_connect_data *connssl)
-
 {
   CURLcode result;
   STACK_OF(X509) *sk;
index 9c4f77670f6f2519ed5e220af10240e0baa93c62..74366d11f24ce40c617eda08c2c00ed52ff2b263 100644 (file)
@@ -82,7 +82,6 @@ struct data {
 };
 
 UNITTEST_START
-
 { /* START sanitize_file_name */
   struct data data[] = {
     { "", 0,
@@ -349,7 +348,6 @@ UNITTEST_START
 
 #else
 UNITTEST_START
-
 {
   fprintf(stderr, "Skipped test not for this platform\n");
 }