Skip to content

Commit

Permalink
checksrc: disallow spaces before labels
Browse files Browse the repository at this point in the history
Out of 223 labels throughout the code base, 65 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 158 instances.

Out of the 65 labels not at the start of the line:
* 58 were indented with the same indentation level of the following line
* 5 were indented with exactly one space
* 1 was indented with one less indentation level of the following line
* 1 was indented with the indentation level of the following line minus
  three space (probably unintentional)
  • Loading branch information
emanuele6 committed May 18, 2023
1 parent a9f8fe2 commit 8d1a3ca
Show file tree
Hide file tree
Showing 48 changed files with 71 additions and 65 deletions.
2 changes: 1 addition & 1 deletion docs/examples/parseurl.c
Expand Up @@ -74,7 +74,7 @@ int main(void)
curl_free(path);
}

fail:
fail:
curl_url_cleanup(h); /* free url handle */
return 0;
}
2 changes: 1 addition & 1 deletion docs/examples/urlapi.c
Expand Up @@ -67,7 +67,7 @@ int main(void)
goto cleanup;
}

cleanup:
cleanup:
curl_url_cleanup(urlp);
curl_easy_cleanup(curl);
return 0;
Expand Down
4 changes: 2 additions & 2 deletions lib/altsvc.c
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/base64.c
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/c-hyper.c
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/conncache.c
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/cookie.c
Expand Up @@ -1387,7 +1387,7 @@ static struct Cookie *dup_cookie(struct Cookie *src)
}
return d;

fail:
fail:
freecookie(d);
return NULL;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/curl_path.c
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/dict.c
Expand Up @@ -312,7 +312,7 @@ static CURLcode dict_do(struct Curl_easy *data, bool *done)
}
}

error:
error:
free(eword);
free(path);
return result;
Expand Down
4 changes: 2 additions & 2 deletions lib/doh.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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++) {
Expand Down
4 changes: 2 additions & 2 deletions lib/easy.c
Expand Up @@ -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;
}
Expand Down Expand Up @@ -993,7 +993,7 @@ struct Curl_easy *curl_easy_duphandle(struct Curl_easy *data)

return outcurl;

fail:
fail:

if(outcurl) {
#ifndef CURL_DISABLE_COOKIES
Expand Down
2 changes: 1 addition & 1 deletion lib/ftp.c
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/headers.c
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/hostip.c
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions lib/hsts.c
Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions lib/http.c
Expand Up @@ -398,7 +398,7 @@ static CURLcode http_output_basic(struct Curl_easy *data, bool proxy)
goto fail;
}

fail:
fail:
free(out);
return result;
}
Expand All @@ -424,7 +424,7 @@ static CURLcode http_output_bearer(struct Curl_easy *data)
goto fail;
}

fail:
fail:
return result;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/http2.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/mprintf.c
Expand Up @@ -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. */
Expand Down
2 changes: 1 addition & 1 deletion lib/mqtt.c
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/multi.c
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/netrc.c
Expand Up @@ -244,7 +244,7 @@ static int parsenetrc(const char *host,
}
} /* while Curl_get_line() */

out:
out:
if(!retcode) {
/* success */
if(login_alloc) {
Expand Down
2 changes: 1 addition & 1 deletion lib/parsedate.c
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/socketpair.c
Expand Up @@ -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]);
Expand Down
6 changes: 3 additions & 3 deletions lib/url.c
Expand Up @@ -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);
Expand Down Expand Up @@ -2301,7 +2301,7 @@ static CURLcode parse_proxy(struct Curl_easy *data,
}
#endif

error:
error:
free(proxyuser);
free(proxypasswd);
free(host);
Expand Down Expand Up @@ -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;
}
Expand Down
8 changes: 4 additions & 4 deletions lib/urlapi.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/vquic/curl_ngtcp2.c
Expand Up @@ -1305,7 +1305,7 @@ static int init_ngh3_conn(struct Curl_cfilter *cf)
}

return CURLE_OK;
fail:
fail:

return result;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/vssh/wolfssh.c
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions lib/vtls/openssl.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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 */
}

Expand Down Expand Up @@ -4603,7 +4603,7 @@ static ssize_t ossl_recv(struct Curl_cfilter *cf,
}
}

out:
out:
return nread;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/vtls/schannel.c
Expand Up @@ -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"));

Expand Down
2 changes: 1 addition & 1 deletion lib/vtls/sectransp.c
Expand Up @@ -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);

Expand Down

0 comments on commit 8d1a3ca

Please sign in to comment.