]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
checksrc: disallow spaces before labels
authorEmanuele Torre <torreemanuele6@gmail.com>
Thu, 18 May 2023 04:54:18 +0000 (06:54 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 18 May 2023 18:45:04 +0000 (20:45 +0200)
Out of 415 labels throughout the code base, 86 of those labels were
not at the start of the line. Which means labels always at the start of
the line is the favoured style overall with 329 instances.

Out of the 86 labels not at the start of the line:
* 75 were indented with the same indentation level of the following line
* 8 were indented with exactly one space
* 2 were indented with one fewer indentation level then the following
  line
* 1 was indented with the indentation level of the following line minus
  three space (probably unintentional)

Co-Authored-By: Viktor Szakats
Closes #11134

55 files changed:
docs/examples/parseurl.c
docs/examples/urlapi.c
lib/altsvc.c
lib/asyn-thread.c
lib/base64.c
lib/c-hyper.c
lib/conncache.c
lib/cookie.c
lib/curl_path.c
lib/dict.c
lib/doh.c
lib/easy.c
lib/ftp.c
lib/headers.c
lib/hostip.c
lib/hsts.c
lib/http.c
lib/http2.c
lib/mprintf.c
lib/mqtt.c
lib/multi.c
lib/netrc.c
lib/parsedate.c
lib/socketpair.c
lib/socks.c
lib/telnet.c
lib/url.c
lib/urlapi.c
lib/vquic/curl_ngtcp2.c
lib/vssh/wolfssh.c
lib/vtls/mbedtls.c
lib/vtls/openssl.c
lib/vtls/schannel.c
lib/vtls/sectransp.c
scripts/checksrc.pl
src/tool_formparse.c
src/tool_operate.c
src/tool_operhlp.c
src/tool_setopt.c
src/tool_urlglob.c
src/tool_xattr.c
tests/libtest/lib1156.c
tests/libtest/lib1522.c
tests/libtest/lib1597.c
tests/libtest/lib1903.c
tests/libtest/lib1905.c
tests/libtest/lib590.c
tests/libtest/lib677.c
tests/server/mqttd.c
tests/server/sws.c
tests/server/tftpd.c
tests/unit/unit1607.c
tests/unit/unit1609.c
tests/unit/unit1653.c
tests/unit/unit1654.c

index ab1714d6add205a8c216cb42895fe85347baadc9..688336f0256de722c4c5b944d68a106c6ec76df8 100644 (file)
@@ -74,7 +74,7 @@ int main(void)
     curl_free(path);
   }
 
-  fail:
+fail:
   curl_url_cleanup(h); /* free url handle */
   return 0;
 }
index 2f446e60c70014aa2f884d877eaadc8174036b12..f266365db55ea6cc2631b0b9edeb87c172c86590 100644 (file)
@@ -67,7 +67,7 @@ int main(void)
     goto cleanup;
   }
 
-  cleanup:
+cleanup:
   curl_url_cleanup(urlp);
   curl_easy_cleanup(curl);
   return 0;
index 31a7abcc5d02f0370b357f495b333c1f1d3b2f7d..f812bafc1bd506a6d64d6632910c2bf879b1254e 100644 (file)
@@ -117,7 +117,7 @@ static struct altsvc *altsvc_createid(const char *srchost,
   as->dst.port = curlx_ultous(dstport);
 
   return as;
-  error:
+error:
   altsvc_free(as);
   return NULL;
 }
@@ -217,7 +217,7 @@ static CURLcode altsvc_load(struct altsvcinfo *asi, const char *file)
   }
   return result;
 
-  fail:
+fail:
   Curl_safefree(asi->filename);
   free(line);
   fclose(fp);
index 4d7f8605f7701234ebc7c2a78669a7b87db1d3f1..6f0a2126ab63c60161aa3a8968f09b26fbc9eaf1 100644 (file)
@@ -251,7 +251,7 @@ int init_thread_sync_data(struct thread_data *td,
 
   return 1;
 
- err_exit:
+err_exit:
 #ifndef CURL_DISABLE_SOCKETPAIR
   if(tsd->sock_pair[0] != CURL_SOCKET_BAD) {
     sclose(tsd->sock_pair[0]);
@@ -469,10 +469,10 @@ static bool init_resolve_thread(struct Curl_easy *data,
 
   return TRUE;
 
- err_exit:
+err_exit:
   destroy_async_data(asp);
 
- errno_exit:
+errno_exit:
   errno = err;
   return FALSE;
 }
index e1b7b7287add0cc42f00b4354709d6c39bdf65c5..971300e1790eaea9d9521a80c12e40383ebd4224 100644 (file)
@@ -178,7 +178,7 @@ CURLcode Curl_base64_decode(const char *src,
   *outlen = rawlen;
 
   return CURLE_OK;
-  bad:
+bad:
   free(newstr);
   return CURLE_BAD_CONTENT_ENCODING;
 }
index 9c7632d354686c82afc336ceb71f367dec64090d..756aebee21f42f77107e83db008f65f65ba1b754 100644 (file)
@@ -1212,7 +1212,7 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
   Curl_safefree(data->state.aptr.userpwd);
   Curl_safefree(data->state.aptr.proxyuserpwd);
   return CURLE_OK;
-  error:
+error:
   DEBUGASSERT(result);
   if(io)
     hyper_io_free(io);
index 1c736da6057251d0d44f29b53ddc87c526dd81d4..a21409c13f1f220d82e3bd1ce31da882351e2525 100644 (file)
@@ -246,7 +246,7 @@ CURLcode Curl_conncache_add_conn(struct Curl_easy *data)
                "The cache now contains %zu members",
                conn->connection_id, connc->num_conn));
 
-  unlock:
+unlock:
   CONNCACHE_UNLOCK(data);
 
   return result;
index 8c0b2b19b4a884d7a856cf4c05075544d02ec23f..22bc2e6fe2ea4a84ba0d086f945cba2eda94f55f 100644 (file)
@@ -1387,7 +1387,7 @@ static struct Cookie *dup_cookie(struct Cookie *src)
   }
   return d;
 
-  fail:
+fail:
   freecookie(d);
   return NULL;
 }
index b4b48fe86ffb8b2c5dceb98ccc0d8e46062044e1..856423db997da61cd2335ecc84915cd8435f6dfd 100644 (file)
@@ -191,7 +191,7 @@ CURLcode Curl_get_pathname(const char **cpp, char **path, char *homedir)
   }
   return CURLE_OK;
 
-  fail:
+fail:
   Curl_safefree(*path);
   return CURLE_QUOTE_ERROR;
 }
index 0ce62a00e98e5170b777586ae1aead8a5e4b2d3f..3172b38290998bb9289663d33b37564388cc2e82 100644 (file)
@@ -312,7 +312,7 @@ static CURLcode dict_do(struct Curl_easy *data, bool *done)
     }
   }
 
-  error:
+error:
   free(eword);
   free(path);
   return result;
index 922d757845854b6b2e3cd8b923d212baa15216b9..7a38eab01f44e4d206f4dc1a40cdbe18e9f9121c 100644 (file)
--- a/lib/doh.c
+++ b/lib/doh.c
@@ -347,7 +347,7 @@ static CURLcode dohprobe(struct Curl_easy *data,
   free(nurl);
   return CURLE_OK;
 
-  error:
+error:
   free(nurl);
   Curl_close(&doh);
   return result;
@@ -409,7 +409,7 @@ struct Curl_addrinfo *Curl_doh(struct Curl_easy *data,
 #endif
   return NULL;
 
-  error:
+error:
   curl_slist_free_all(dohp->headers);
   data->req.doh->headers = NULL;
   for(slot = 0; slot < DOH_PROBE_SLOTS; slot++) {
index d72a2a88d3c1c0f8edf1e3c1adc06b7f7d5f6c5f..d36cc03d1f0e9a06b8aaf293675fce1cfeedaaaf 100644 (file)
@@ -209,7 +209,7 @@ static CURLcode global_init(long flags, bool memoryfuncs)
 
   return CURLE_OK;
 
-  fail:
+fail:
   initialized--; /* undo the increase */
   return CURLE_FAILED_INIT;
 }
@@ -993,7 +993,7 @@ struct Curl_easy *curl_easy_duphandle(struct Curl_easy *data)
 
   return outcurl;
 
-  fail:
+fail:
 
   if(outcurl) {
 #ifndef CURL_DISABLE_COOKIES
index e492efc8a25aa3c39a50d3a9db87fc1c6a91fff8..402bfb980f93a70ad33b38588368f9c2497f3d11 100644 (file)
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -3838,7 +3838,7 @@ static CURLcode init_wc_data(struct Curl_easy *data)
   infof(data, "Wildcard - Parsing started");
   return CURLE_OK;
 
-  fail:
+fail:
   if(ftpwc) {
     Curl_ftp_parselist_data_free(&ftpwc->parser);
     free(ftpwc);
index 457ed63eda6d9230d2ffdb1ab41f7db21402a5f3..4367ce797c142115ccd869861ec5d59e15f55471 100644 (file)
@@ -325,7 +325,7 @@ CURLcode Curl_headers_push(struct Curl_easy *data, const char *header,
                          hs, &hs->node);
   data->state.prevhead = hs;
   return CURLE_OK;
-  fail:
+fail:
   free(hs);
   return result;
 }
index 4ff348436be158191959ad7665f666e53916b395..4a02f4bcba8493e327eac882b93982d3ffbec814 100644 (file)
@@ -1238,7 +1238,7 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data)
         goto err;
 
       error = false;
-   err:
+err:
       if(error) {
         failf(data, "Couldn't parse CURLOPT_RESOLVE entry '%s'",
               hostp->data);
index 661bf4d75c474275744c171d3cec8d101c83f076..53c01fc52c8e74036209643b689eabc7246e3ede 100644 (file)
@@ -390,7 +390,7 @@ CURLcode Curl_hsts_save(struct Curl_easy *data, struct hsts *h,
       unlink(tempstore);
   }
   free(tempstore);
-  skipsave:
+skipsave:
   if(data->set.hsts_write) {
     /* if there's a write callback */
     struct curl_index i; /* count */
@@ -534,7 +534,7 @@ static CURLcode hsts_load(struct hsts *h, const char *file)
   }
   return result;
 
-  fail:
+fail:
   Curl_safefree(h->filename);
   fclose(fp);
   return CURLE_OUT_OF_MEMORY;
index 15cf22c5e18ba382d75fd5007f859fecec8bf67b..7bdfdfddf334024038c72904a800de5ecb60d100 100644 (file)
@@ -398,7 +398,7 @@ static CURLcode http_output_basic(struct Curl_easy *data, bool proxy)
     goto fail;
   }
 
-  fail:
+fail:
   free(out);
   return result;
 }
@@ -424,7 +424,7 @@ static CURLcode http_output_bearer(struct Curl_easy *data)
     goto fail;
   }
 
-  fail:
+fail:
   return result;
 }
 
index 4db9951331317fd3c187001810c0ef4a4611ab34..47e6f71393156c72ded830653279615402af1313 100644 (file)
@@ -806,7 +806,7 @@ static int set_transfer_url(struct Curl_easy *data,
   uc = curl_url_get(u, CURLUPART_URL, &url, 0);
   if(uc)
     rc = 4;
-  fail:
+fail:
   curl_url_cleanup(u);
   if(rc)
     return rc;
@@ -930,7 +930,7 @@ static int push_promise(struct Curl_cfilter *cf,
     DEBUGF(LOG_CF(data, cf, "Got PUSH_PROMISE, ignore it"));
     rv = CURL_PUSH_DENY;
   }
-  fail:
+fail:
   return rv;
 }
 
index 8e830438d47e49a65904ea8f80f3383d9d2c0a6d..af5d753d6af4924ea3b7c7efdb8276fb4fc2e70f 100644 (file)
@@ -743,11 +743,11 @@ static int dprintf_formatf(
 
       goto number;
 
-      unsigned_number:
+unsigned_number:
       /* Unsigned number of base BASE.  */
       is_neg = 0;
 
-      number:
+number:
       /* Number of base BASE.  */
 
       /* Supply a default precision if none was given.  */
index 47af369147ab2ff0e3083388161738de0f067f6f..dbe72398ad8eba028a63561c58ebb5ac297604a4 100644 (file)
@@ -605,7 +605,7 @@ static CURLcode mqtt_read_publish(struct Curl_easy *data, bool *done)
   unsigned char packet;
 
   switch(mqtt->state) {
-  MQTT_SUBACK_COMING:
+MQTT_SUBACK_COMING:
   case MQTT_SUBACK_COMING:
     result = mqtt_verify_suback(data);
     if(result)
@@ -688,7 +688,7 @@ static CURLcode mqtt_read_publish(struct Curl_easy *data, bool *done)
     result = CURLE_WEIRD_SERVER_REPLY;
     goto end;
   }
-  end:
+end:
   return result;
 }
 
index 4ee51a1533a63d4f6e515473f3f170d4ad633333..d1d32b793683362945c1d605c55eb0afa0280c56 100644 (file)
@@ -448,7 +448,7 @@ struct Curl_multi *Curl_multi_handle(int hashsize, /* socket hash */
 
   return multi;
 
-  error:
+error:
 
   sockhash_destroy(&multi->sockhash);
   Curl_hash_destroy(&multi->hostcache);
@@ -2625,7 +2625,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
       multi_handle_timeout(data, nowp, &stream_error, &result, TRUE);
     }
 
-    statemachine_end:
+statemachine_end:
 
     if(data->mstate < MSTATE_COMPLETED) {
       if(result) {
index aa1b80ab2fd76cbbf92ccc2af649f913f3dde45d..e6a09b187a5dc273d06c47e42fdef0e0d9f166c5 100644 (file)
@@ -244,7 +244,7 @@ static int parsenetrc(const char *host,
       }
     } /* while Curl_get_line() */
 
-    out:
+out:
     if(!retcode) {
       /* success */
       if(login_alloc) {
index 1662dd36b89ee1ed2a2eec5e50ecb6e77d4d4861..1a7195b16ac995af7c2a81b1bc6c852cdfc1e7e9 100644 (file)
@@ -332,7 +332,7 @@ static bool match_time(const char *date,
     }
   }
   return FALSE; /* not a time string */
-  match:
+match:
   *h = hh;
   *m = mm;
   *s = ss;
index 7ee0fbc1fefe7699680e3f65b8d59953e9494860..963e1406f603d2eb7752dfc3ce26d2d60a88014b 100644 (file)
@@ -183,7 +183,7 @@ int Curl_socketpair(int domain, int type, int protocol,
   sclose(listener);
   return 0;
 
-  error:
+error:
   sclose(listener);
   sclose(socks[0]);
   sclose(socks[1]);
index 95c2b004c964f5665cc43b11e6bdd5d716dabf81..def6f0f755313cc80d6eccb0ce65658f071bb8b0 100644 (file)
@@ -354,7 +354,7 @@ static CURLproxycode do_SOCKS4(struct Curl_cfilter *cf,
       }
     }
     /* FALLTHROUGH */
-  CONNECT_RESOLVED:
+CONNECT_RESOLVED:
   case CONNECT_RESOLVED: {
     struct Curl_addrinfo *hp = NULL;
     /*
@@ -394,7 +394,7 @@ static CURLproxycode do_SOCKS4(struct Curl_cfilter *cf,
       return CURLPX_RESOLVE_HOST;
   }
     /* FALLTHROUGH */
-  CONNECT_REQ_INIT:
+CONNECT_REQ_INIT:
   case CONNECT_REQ_INIT:
     /*
      * This is currently not supporting "Identification Protocol (RFC1413)".
@@ -638,7 +638,7 @@ static CURLproxycode do_SOCKS5(struct Curl_cfilter *cf,
       return CURLPX_OK;
     }
     /* FALLTHROUGH */
-  CONNECT_SOCKS_READ_INIT:
+CONNECT_SOCKS_READ_INIT:
   case CONNECT_SOCKS_READ_INIT:
     sx->outstanding = 2; /* expect two bytes */
     sx->outp = socksreq; /* store it here */
@@ -700,7 +700,7 @@ static CURLproxycode do_SOCKS5(struct Curl_cfilter *cf,
   default: /* do nothing! */
     break;
 
-  CONNECT_AUTH_INIT:
+CONNECT_AUTH_INIT:
   case CONNECT_AUTH_INIT: {
     /* Needs user name and password */
     size_t proxy_user_len, proxy_password_len;
@@ -779,7 +779,7 @@ static CURLproxycode do_SOCKS5(struct Curl_cfilter *cf,
     /* Everything is good so far, user was authenticated! */
     sxstate(sx, data, CONNECT_REQ_INIT);
     /* FALLTHROUGH */
-  CONNECT_REQ_INIT:
+CONNECT_REQ_INIT:
   case CONNECT_REQ_INIT:
     if(socks5_resolve_local) {
       enum resolve_t rc = Curl_resolv(data, sx->hostname, sx->remote_port,
@@ -818,7 +818,7 @@ static CURLproxycode do_SOCKS5(struct Curl_cfilter *cf,
       }
     }
     /* FALLTHROUGH */
-  CONNECT_RESOLVED:
+CONNECT_RESOLVED:
   case CONNECT_RESOLVED: {
     struct Curl_addrinfo *hp = NULL;
     size_t destlen;
@@ -873,7 +873,7 @@ static CURLproxycode do_SOCKS5(struct Curl_cfilter *cf,
     Curl_resolv_unlock(data, dns); /* not used anymore from now on */
     goto CONNECT_REQ_SEND;
   }
-  CONNECT_RESOLVE_REMOTE:
+CONNECT_RESOLVE_REMOTE:
   case CONNECT_RESOLVE_REMOTE:
     /* Authentication is complete, now specify destination to the proxy */
     len = 0;
@@ -913,7 +913,7 @@ static CURLproxycode do_SOCKS5(struct Curl_cfilter *cf,
     }
     /* FALLTHROUGH */
 
-  CONNECT_REQ_SEND:
+CONNECT_REQ_SEND:
   case CONNECT_REQ_SEND:
     /* PORT MSB */
     socksreq[len++] = (unsigned char)((sx->remote_port >> 8) & 0xff);
index 0cfde0f0d401c00cc2fb02f407d1c62d48faad79..643e43d2b0ac79498783b59b3ebf682508f9eb91 100644 (file)
@@ -1110,7 +1110,7 @@ CURLcode telrcv(struct Curl_easy *data,
       break;
 
     case CURL_TS_IAC:
-    process_iac:
+process_iac:
       DEBUGASSERT(startwrite < 0);
       switch(c) {
       case CURL_WILL:
index 501a0fc6a9267f4d38b753ebb26fab07447093c9..b37d13f8f521189316913c714445508120b9392f 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -1587,7 +1587,7 @@ static struct connectdata *allocate_conn(struct Curl_easy *data)
   conn->gssapi_delegation = data->set.gssapi_delegation;
 
   return conn;
-  error:
+error:
 
   free(conn->localdev);
   free(conn);
@@ -2301,7 +2301,7 @@ static CURLcode parse_proxy(struct Curl_easy *data,
   }
 #endif
 
-  error:
+error:
   free(proxyuser);
   free(proxypasswd);
   free(host);
@@ -2898,7 +2898,7 @@ static CURLcode parse_connect_to_host_port(struct Curl_easy *data,
 
   *port_result = port;
 
-  error:
+error:
   free(host_dup);
   return result;
 }
index 83e4ceda3af8b25383c511c18d55e040c155602b..b163db93fc4d640a2faeadfb1f28c4ec49319509 100644 (file)
@@ -481,7 +481,7 @@ static CURLUcode parse_hostname_login(struct Curl_URL *u,
   *offset = ptr - login;
   return CURLUE_OK;
 
-  out:
+out:
 
   free(userp);
   free(passwdp);
@@ -1317,7 +1317,7 @@ static CURLUcode parseurl(const char *url, CURLU *u, unsigned int flags)
   u->host = Curl_dyn_ptr(&host);
 
   return result;
-  fail:
+fail:
   Curl_dyn_free(&host);
   free_urlhandle(u);
   return result;
@@ -1380,7 +1380,7 @@ CURLU *curl_url_dup(const CURLU *in)
     u->portnum = in->portnum;
   }
   return u;
-  fail:
+fail:
   curl_url_cleanup(u);
   return NULL;
 }
@@ -1876,7 +1876,7 @@ CURLUcode curl_url_set(CURLU *u, CURLUPart what,
         free(*storep);
         *storep = Curl_dyn_ptr(&enc);
         return CURLUE_OK;
-        nomem:
+nomem:
         free((char *)newp);
         return CURLUE_OUT_OF_MEMORY;
       }
index c2d071b0485683a943ab2a79b4897137792b3cac..05f960afdffa1a22215f62ba4ba6817d10618a50 100644 (file)
@@ -1305,7 +1305,7 @@ static int init_ngh3_conn(struct Curl_cfilter *cf)
   }
 
   return CURLE_OK;
-  fail:
+fail:
 
   return result;
 }
index 2ca91b7363b1d9b12da445d99d2ff0e4c827affe..780b6126acc1ec269a253ae9016d6043f1026283 100644 (file)
@@ -425,7 +425,7 @@ static CURLcode wssh_connect(struct Curl_easy *data, bool *done)
     state(data, SSH_SFTP_INIT);
 
   return wssh_multi_statemach(data, done);
-  error:
+error:
   wolfSSH_free(sshc->ssh_session);
   wolfSSH_CTX_free(sshc->ctx);
   return CURLE_FAILED_INIT;
index 7f0f4e36685ae064b2663cc33c3a4712d9bcca6b..d95888c36e29b480e249a1c8eed8f4ad12d53136 100644 (file)
@@ -831,7 +831,7 @@ mbed_connect_step2(struct Curl_cfilter *cf, struct Curl_easy *data)
     result = Curl_pin_peer_pubkey(data,
                                   pinnedpubkey,
                                   &pubkey[PUB_DER_MAX_BYTES - size], size);
-    pinnedpubkey_error:
+pinnedpubkey_error:
     mbedtls_x509_crt_free(p);
     free(p);
     free(pubkey);
index 970b37efd13c14f760c3e6851c6fe963c9ae66d5..6543fb19a26db63ec262bf548f7077c4090a8c68 100644 (file)
@@ -1496,7 +1496,7 @@ int cert_stuff(struct Curl_easy *data,
       }
 
       cert_done = 1;
-    fail:
+fail:
       EVP_PKEY_free(pri);
       X509_free(x509);
       sk_X509_pop_free(ca, X509_free);
@@ -4501,7 +4501,7 @@ static ssize_t ossl_send(struct Curl_cfilter *cf,
   }
   *curlcode = CURLE_OK;
 
-  out:
+out:
   return (ssize_t)rc; /* number of bytes */
 }
 
@@ -4603,7 +4603,7 @@ static ssize_t ossl_recv(struct Curl_cfilter *cf,
     }
   }
 
-  out:
+out:
   return nread;
 }
 
index 430a41c13d7e2a61f58866a4556931a96bf5c094..513811d2d805a89ea2d966afbff39cc064674bef 100644 (file)
@@ -2358,7 +2358,7 @@ schannel_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
                "schannel: decrypted data buffer: offset %zu length %zu",
                backend->decdata_offset, backend->decdata_length));
 
-  cleanup:
+cleanup:
   /* Warning- there is no guarantee the encdata state is valid at this point */
   DEBUGF(infof(data, "schannel: schannel_recv cleanup"));
 
index 175b7a96da9f5a9459d93ae23b924a512986acc4..b24c77fcac1403bf6e13a609d3b6c7e79869eb6b 100644 (file)
@@ -3376,7 +3376,7 @@ static ssize_t sectransp_recv(struct Curl_cfilter *cf,
 
   DEBUGASSERT(backend);
 
-  again:
+again:
   *curlcode = CURLE_OK;
   err = SSLRead(backend->ssl_ctx, buf, buffersize, &processed);
 
index 1ec9212a0f079d75dff960f0cda7378b365748f2..5c279db9030a5a706e6fab7a88896fd690684ee1 100755 (executable)
@@ -75,6 +75,7 @@ my %warnings = (
     'INCLUDEDUP',      => 'same file is included again',
     'INDENTATION'      => 'wrong start column for code',
     'LONGLINE'         => "Line longer than $max_column",
+    'SPACEBEFORELABEL' => 'labels not at the start of the line',
     'MULTISPACE'       => 'multiple spaces used when not suitable',
     'NOSPACEEQUALS'    => 'equals sign without preceding space',
     'NOTEQUALSZERO',   => 'if/while comparison with != 0',
@@ -697,6 +698,11 @@ sub scanfile {
                       $line, length($1), $file, $ol, "no space before colon of switch label");
         }
 
+        if($prevl !~ /\?\z/ && $l =~ /^ +([A-Za-z_][A-Za-z0-9_]*):$/ && $1 ne 'default') {
+            checkwarn("SPACEBEFORELABEL",
+                      $line, length($1), $file, $ol, "no space before label");
+        }
+
         # scan for use of banned functions
         if($l =~ /^(.*\W)
                    (gmtime|localtime|
index e75f5e6595ba1874597a8c7c572f9de22b66dac2..7842c033b1e24594b32bb256fa724bb4eeb89be4 100644 (file)
@@ -900,7 +900,7 @@ int formparse(struct OperationConfig *config,
     goto fail;
   }
   err = 0;
-  fail:
+fail:
   Curl_safefree(contents);
   curl_slist_free_all(headers);
   return err;
index 4da9dea16d59cbabf9baa706bbeacd8ce59fe9ee..ead7dca6308d00d1cdd4828b3e1959aa8f1274ba 100644 (file)
@@ -624,7 +624,7 @@ static CURLcode post_per_transfer(struct GlobalConfig *global,
       return CURLE_OK;
     }
   } /* if retry_numretries */
-  noretry:
+noretry:
 
   if((global->progressmode == CURL_PROGRESS_BAR) &&
      per->progressbar.calls)
index 01a24b4338b25be7306683ce4ddbce0273499f67..a964d796dee628366acfc0b3fb675a5b72ec7e89 100644 (file)
@@ -170,7 +170,7 @@ CURLcode add_file_name_to_url(CURL *curl, char **inurlp, const char *filename)
       /* nothing to do */
       result = CURLE_OK;
   }
-  fail:
+fail:
   curl_url_cleanup(uh);
   curl_free(path);
   return result;
index 3279e85957c0b8b1f6dfe1d143731a4bd1542cdd..0f3cc83b95d99ea10a04a2eda4a271b2a8c47e0c 100644 (file)
@@ -296,7 +296,7 @@ CURLcode tool_setopt_enum(CURL *curl, struct GlobalConfig *config,
   if(ret)
     warnf(config, "option %s returned error (%d)\n", name, (int)ret);
 #endif
-  nomem:
+nomem:
   return ret;
 }
 
@@ -338,7 +338,7 @@ CURLcode tool_setopt_flags(CURL *curl, struct GlobalConfig *config,
       CODE2("%s%ldL);", preamble, rest);
   }
 
- nomem:
+nomem:
   return ret;
 }
 
@@ -381,7 +381,7 @@ CURLcode tool_setopt_bitmask(CURL *curl, struct GlobalConfig *config,
       CODE2("%s%luUL);", preamble, rest);
   }
 
- nomem:
+nomem:
   return ret;
 }
 
@@ -407,7 +407,7 @@ static CURLcode libcurl_generate_slist(struct curl_slist *slist, int *slistno)
                                        *slistno, *slistno, escaped);
   }
 
- nomem:
+nomem:
   Curl_safefree(escaped);
   return ret;
 }
@@ -590,7 +590,7 @@ CURLcode tool_setopt_slist(CURL *curl, struct GlobalConfig *config,
       CODE2("curl_easy_setopt(hnd, %s, slist%d);", name, i);
   }
 
- nomem:
+nomem:
   return ret;
 }
 
@@ -704,7 +704,7 @@ CURLcode tool_setopt(CURL *curl, bool str, struct GlobalConfig *global,
     }
   }
 
- nomem:
+nomem:
   Curl_safefree(escaped);
   return ret;
 }
index fe1ce64c6565ca0a154e9e00cc6b30dbbc1c74d1..2b4136518351aae94683849c263c0c81f21c9453 100644 (file)
@@ -295,7 +295,7 @@ static CURLcode glob_range(struct URLGlob *glob, char **patternp,
       }
     }
 
-    fail:
+fail:
     *posp += (pattern - *patternp);
 
     if(!endp || !step_n ||
index a37416d7ffb4821a0593c4b438607417493a363b..968cf2f72d4c370e67b0327687bec28bf3a804fa 100644 (file)
@@ -75,7 +75,7 @@ char *stripcredentials(const char *url)
 
     return nurl;
   }
-  error:
+error:
   curl_url_cleanup(u);
   return NULL;
 }
index bdc95d8520a7ce760794ba340bb4afbe26d0dde4..84a5d48be0128ccd3aad9bbf0d8a43da35d59b57 100644 (file)
@@ -123,7 +123,7 @@ static int onetest(CURL *curl, const char *url, const struct testparams *p,
   }
   return 0;
 
-  test_cleanup:
+test_cleanup:
 
   return 1;
 }
@@ -164,7 +164,7 @@ int test(char *URL)
   printf("%d\n", status);
   return status;
 
-  test_cleanup:
+test_cleanup:
 
   curl_easy_cleanup(curl);
   curl_global_cleanup();
index c19aa636feab3bf0f5b461db4dc703e562c109cf..869959729eae01b04be7ca66541e17e25aa75e37 100644 (file)
@@ -92,7 +92,7 @@ int test(char *URL)
   else {
     printf("curl_easy_perform() failed. e = %d\n", code);
   }
-  test_cleanup:
+test_cleanup:
   curl_slist_free_all(pHeaderList);
   curl_easy_cleanup(curl);
   curl_global_cleanup();
index 48b9c7c5a8c1b3a4bc4c104c959b50657e313860..44769f9cfeccecd4195dbb4b175f15b275531cc2 100644 (file)
@@ -107,7 +107,7 @@ int test(char *URL)
   printf("Tested %u strings\n", i);
   res = (int)result;
 
-  test_cleanup:
+test_cleanup:
   curl_easy_cleanup(curl);
   curl_global_cleanup();
 
index 240dbe729a4c8e4a9f8c055daeadc693bccaeaef..79baa17dd3f48a7644ea81a32af439af29ffbe34 100644 (file)
@@ -47,7 +47,7 @@ int test(char *URL)
   curl_easy_setopt(ch, CURLOPT_COOKIEFILE, libtest_arg2);
   curl_easy_perform(ch);
 
-  cleanup:
+cleanup:
   curl_easy_cleanup(ch);
   curl_global_cleanup();
 
index bae975c994a2e9707d5e11981b0bb36b90e0398d..62b9c60cde901003baf82da2ce16aec3f37c81ac 100644 (file)
@@ -90,7 +90,7 @@ int test(char *URL)
   curl_easy_setopt(ch, CURLOPT_SHARE, NULL);
 
   curl_multi_remove_handle(cm, ch);
-  cleanup:
+cleanup:
   curl_easy_cleanup(ch);
   curl_share_cleanup(sh);
   curl_multi_cleanup(cm);
index 32271bc46c4823288f3f508c62af026208b642fc..babcd195283a0c077b99c337cde87b5dcf2a84bc 100644 (file)
@@ -64,7 +64,7 @@ int test(char *URL)
 
   res = curl_easy_perform(curl);
 
-  test_cleanup:
+test_cleanup:
 
   curl_easy_cleanup(curl);
   curl_global_cleanup();
index 12a0c18770e7c7769e3d7d115e01507f660ffe4a..94530b9a7e3b8b7cf975126acc4591659b76f6d3 100644 (file)
@@ -112,7 +112,7 @@ int test(char *URL)
   }
 
   curl_multi_remove_handle(mcurl, curl);
-  fail:
+fail:
   curl_easy_cleanup(curl);
   curl_multi_cleanup(mcurl);
 
index 347c76504e1cf54bde4d138b7849bb045a5d0cfe..ba1ed198a6840fa7b7c0618db7a838ca5732a7f8 100644 (file)
@@ -702,7 +702,7 @@ static curl_socket_t mqttit(curl_socket_t fd)
     }
   } while(1);
 
-  end:
+end:
   if(buffer)
     free(buffer);
   if(dump)
index 001972cd9ad82fdeebc356c75131082df57adafd..f74d32cbfe8d12c20646993cdbb692e71b7067fe 100644 (file)
@@ -1172,7 +1172,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
     if(num > 20)
       num = 20;
 
-    retry:
+retry:
     written = swrite(sock, buffer, num);
     if(written < 0) {
       if((EWOULDBLOCK == SOCKERRNO) || (EAGAIN == SOCKERRNO)) {
index d03053632a719512c0173364fb87302f4ba4fc95..3601d9e9d310ef02a4fa5409a4cd6ead641af72b 100644 (file)
@@ -500,7 +500,7 @@ static ssize_t write_behind(struct testcase *test, int convert)
        putc(c, file); */
     if(1 != write(test->ofile, &c, 1))
       break;
-    skipit:
+skipit:
     prevchar = c;
   }
   return count;
@@ -1201,7 +1201,7 @@ static void sendtftp(struct testcase *test, const struct formats *pf)
       wait_ms(1000*test->writedelay);
     }
 
-    send_data:
+send_data:
     logmsg("write");
     if(swrite(peer, sdp, size + 4) != size + 4) {
       logmsg("write: fail");
index b403fb9710dd5298a41eed5e719c4d53eb9c8a72..83af9c8058d2703b8d3605413eae6dd34d18a90a 100644 (file)
@@ -227,7 +227,7 @@ UNITTEST_START
       continue;
     }
   }
-  error:
+error:
   curl_easy_cleanup(easy);
   curl_multi_cleanup(multi);
   curl_slist_free_all(list);
index 06b6698563d2537bc2e7e771e7c27a940a7badc5..9f483945fd5d2f145d11e81bd64d74c79fb92aa5 100644 (file)
@@ -212,7 +212,7 @@ UNITTEST_START
     }
   }
   goto unit_test_abort;
-  error:
+error:
   curl_easy_cleanup(easy);
   curl_multi_cleanup(multi);
   curl_slist_free_all(list);
index cf848c6a32de3429b1f22ce637833bacca2a5fcd..d543fb0276398f063b79d970a5db8c812b7c3275 100644 (file)
@@ -224,7 +224,7 @@ UNITTEST_START
     goto fail;
   ret = parse_port(u, ipv6port, FALSE);
   fail_unless(ret == CURLUE_BAD_PORT_NUMBER, "parse_port did wrong");
-  fail:
+fail:
   free(ipv6port);
   curl_url_cleanup(u);
 
index 91aca378ec91e48290029a2852eaa4bcb480029c..f7ca3911b6e8e6233dc20a5ab24267ba18d47b70 100644 (file)
@@ -106,7 +106,7 @@ UNITTEST_START
   Curl_altsvc_save(curl, asi, outname);
 
   curl_easy_cleanup(curl);
-  fail:
+fail:
   Curl_altsvc_cleanup(&asi);
 }
 #endif