checksrc: disallow spaces before labels

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
This commit is contained in:
Emanuele Torre 2023-05-18 06:54:18 +02:00 committed by Daniel Stenberg
parent d334b02924
commit f198d33e8d
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
55 changed files with 92 additions and 86 deletions

View File

@ -74,7 +74,7 @@ int main(void)
curl_free(path); curl_free(path);
} }
fail: fail:
curl_url_cleanup(h); /* free url handle */ curl_url_cleanup(h); /* free url handle */
return 0; return 0;
} }

View File

@ -67,7 +67,7 @@ int main(void)
goto cleanup; goto cleanup;
} }
cleanup: cleanup:
curl_url_cleanup(urlp); curl_url_cleanup(urlp);
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
return 0; return 0;

View File

@ -117,7 +117,7 @@ static struct altsvc *altsvc_createid(const char *srchost,
as->dst.port = curlx_ultous(dstport); as->dst.port = curlx_ultous(dstport);
return as; return as;
error: error:
altsvc_free(as); altsvc_free(as);
return NULL; return NULL;
} }
@ -217,7 +217,7 @@ static CURLcode altsvc_load(struct altsvcinfo *asi, const char *file)
} }
return result; return result;
fail: fail:
Curl_safefree(asi->filename); Curl_safefree(asi->filename);
free(line); free(line);
fclose(fp); fclose(fp);

View File

@ -251,7 +251,7 @@ int init_thread_sync_data(struct thread_data *td,
return 1; return 1;
err_exit: err_exit:
#ifndef CURL_DISABLE_SOCKETPAIR #ifndef CURL_DISABLE_SOCKETPAIR
if(tsd->sock_pair[0] != CURL_SOCKET_BAD) { if(tsd->sock_pair[0] != CURL_SOCKET_BAD) {
sclose(tsd->sock_pair[0]); sclose(tsd->sock_pair[0]);
@ -469,10 +469,10 @@ static bool init_resolve_thread(struct Curl_easy *data,
return TRUE; return TRUE;
err_exit: err_exit:
destroy_async_data(asp); destroy_async_data(asp);
errno_exit: errno_exit:
errno = err; errno = err;
return FALSE; return FALSE;
} }

View File

@ -178,7 +178,7 @@ CURLcode Curl_base64_decode(const char *src,
*outlen = rawlen; *outlen = rawlen;
return CURLE_OK; return CURLE_OK;
bad: bad:
free(newstr); free(newstr);
return CURLE_BAD_CONTENT_ENCODING; return CURLE_BAD_CONTENT_ENCODING;
} }

View 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.userpwd);
Curl_safefree(data->state.aptr.proxyuserpwd); Curl_safefree(data->state.aptr.proxyuserpwd);
return CURLE_OK; return CURLE_OK;
error: error:
DEBUGASSERT(result); DEBUGASSERT(result);
if(io) if(io)
hyper_io_free(io); hyper_io_free(io);

View File

@ -246,7 +246,7 @@ CURLcode Curl_conncache_add_conn(struct Curl_easy *data)
"The cache now contains %zu members", "The cache now contains %zu members",
conn->connection_id, connc->num_conn)); conn->connection_id, connc->num_conn));
unlock: unlock:
CONNCACHE_UNLOCK(data); CONNCACHE_UNLOCK(data);
return result; return result;

View File

@ -1387,7 +1387,7 @@ static struct Cookie *dup_cookie(struct Cookie *src)
} }
return d; return d;
fail: fail:
freecookie(d); freecookie(d);
return NULL; return NULL;
} }

View File

@ -191,7 +191,7 @@ CURLcode Curl_get_pathname(const char **cpp, char **path, char *homedir)
} }
return CURLE_OK; return CURLE_OK;
fail: fail:
Curl_safefree(*path); Curl_safefree(*path);
return CURLE_QUOTE_ERROR; return CURLE_QUOTE_ERROR;
} }

View File

@ -312,7 +312,7 @@ static CURLcode dict_do(struct Curl_easy *data, bool *done)
} }
} }
error: error:
free(eword); free(eword);
free(path); free(path);
return result; return result;

View File

@ -347,7 +347,7 @@ static CURLcode dohprobe(struct Curl_easy *data,
free(nurl); free(nurl);
return CURLE_OK; return CURLE_OK;
error: error:
free(nurl); free(nurl);
Curl_close(&doh); Curl_close(&doh);
return result; return result;
@ -409,7 +409,7 @@ struct Curl_addrinfo *Curl_doh(struct Curl_easy *data,
#endif #endif
return NULL; return NULL;
error: error:
curl_slist_free_all(dohp->headers); curl_slist_free_all(dohp->headers);
data->req.doh->headers = NULL; data->req.doh->headers = NULL;
for(slot = 0; slot < DOH_PROBE_SLOTS; slot++) { for(slot = 0; slot < DOH_PROBE_SLOTS; slot++) {

View File

@ -209,7 +209,7 @@ static CURLcode global_init(long flags, bool memoryfuncs)
return CURLE_OK; return CURLE_OK;
fail: fail:
initialized--; /* undo the increase */ initialized--; /* undo the increase */
return CURLE_FAILED_INIT; return CURLE_FAILED_INIT;
} }
@ -993,7 +993,7 @@ struct Curl_easy *curl_easy_duphandle(struct Curl_easy *data)
return outcurl; return outcurl;
fail: fail:
if(outcurl) { if(outcurl) {
#ifndef CURL_DISABLE_COOKIES #ifndef CURL_DISABLE_COOKIES

View File

@ -3838,7 +3838,7 @@ static CURLcode init_wc_data(struct Curl_easy *data)
infof(data, "Wildcard - Parsing started"); infof(data, "Wildcard - Parsing started");
return CURLE_OK; return CURLE_OK;
fail: fail:
if(ftpwc) { if(ftpwc) {
Curl_ftp_parselist_data_free(&ftpwc->parser); Curl_ftp_parselist_data_free(&ftpwc->parser);
free(ftpwc); free(ftpwc);

View File

@ -325,7 +325,7 @@ CURLcode Curl_headers_push(struct Curl_easy *data, const char *header,
hs, &hs->node); hs, &hs->node);
data->state.prevhead = hs; data->state.prevhead = hs;
return CURLE_OK; return CURLE_OK;
fail: fail:
free(hs); free(hs);
return result; return result;
} }

View File

@ -1238,7 +1238,7 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data)
goto err; goto err;
error = false; error = false;
err: err:
if(error) { if(error) {
failf(data, "Couldn't parse CURLOPT_RESOLVE entry '%s'", failf(data, "Couldn't parse CURLOPT_RESOLVE entry '%s'",
hostp->data); hostp->data);

View File

@ -390,7 +390,7 @@ CURLcode Curl_hsts_save(struct Curl_easy *data, struct hsts *h,
unlink(tempstore); unlink(tempstore);
} }
free(tempstore); free(tempstore);
skipsave: skipsave:
if(data->set.hsts_write) { if(data->set.hsts_write) {
/* if there's a write callback */ /* if there's a write callback */
struct curl_index i; /* count */ struct curl_index i; /* count */
@ -534,7 +534,7 @@ static CURLcode hsts_load(struct hsts *h, const char *file)
} }
return result; return result;
fail: fail:
Curl_safefree(h->filename); Curl_safefree(h->filename);
fclose(fp); fclose(fp);
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;

View File

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

View File

@ -806,7 +806,7 @@ static int set_transfer_url(struct Curl_easy *data,
uc = curl_url_get(u, CURLUPART_URL, &url, 0); uc = curl_url_get(u, CURLUPART_URL, &url, 0);
if(uc) if(uc)
rc = 4; rc = 4;
fail: fail:
curl_url_cleanup(u); curl_url_cleanup(u);
if(rc) if(rc)
return 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")); DEBUGF(LOG_CF(data, cf, "Got PUSH_PROMISE, ignore it"));
rv = CURL_PUSH_DENY; rv = CURL_PUSH_DENY;
} }
fail: fail:
return rv; return rv;
} }

View File

@ -743,11 +743,11 @@ static int dprintf_formatf(
goto number; goto number;
unsigned_number: unsigned_number:
/* Unsigned number of base BASE. */ /* Unsigned number of base BASE. */
is_neg = 0; is_neg = 0;
number: number:
/* Number of base BASE. */ /* Number of base BASE. */
/* Supply a default precision if none was given. */ /* Supply a default precision if none was given. */

View File

@ -605,7 +605,7 @@ static CURLcode mqtt_read_publish(struct Curl_easy *data, bool *done)
unsigned char packet; unsigned char packet;
switch(mqtt->state) { switch(mqtt->state) {
MQTT_SUBACK_COMING: MQTT_SUBACK_COMING:
case MQTT_SUBACK_COMING: case MQTT_SUBACK_COMING:
result = mqtt_verify_suback(data); result = mqtt_verify_suback(data);
if(result) if(result)
@ -688,7 +688,7 @@ static CURLcode mqtt_read_publish(struct Curl_easy *data, bool *done)
result = CURLE_WEIRD_SERVER_REPLY; result = CURLE_WEIRD_SERVER_REPLY;
goto end; goto end;
} }
end: end:
return result; return result;
} }

View File

@ -448,7 +448,7 @@ struct Curl_multi *Curl_multi_handle(int hashsize, /* socket hash */
return multi; return multi;
error: error:
sockhash_destroy(&multi->sockhash); sockhash_destroy(&multi->sockhash);
Curl_hash_destroy(&multi->hostcache); 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); multi_handle_timeout(data, nowp, &stream_error, &result, TRUE);
} }
statemachine_end: statemachine_end:
if(data->mstate < MSTATE_COMPLETED) { if(data->mstate < MSTATE_COMPLETED) {
if(result) { if(result) {

View File

@ -244,7 +244,7 @@ static int parsenetrc(const char *host,
} }
} /* while Curl_get_line() */ } /* while Curl_get_line() */
out: out:
if(!retcode) { if(!retcode) {
/* success */ /* success */
if(login_alloc) { if(login_alloc) {

View File

@ -332,7 +332,7 @@ static bool match_time(const char *date,
} }
} }
return FALSE; /* not a time string */ return FALSE; /* not a time string */
match: match:
*h = hh; *h = hh;
*m = mm; *m = mm;
*s = ss; *s = ss;

View File

@ -183,7 +183,7 @@ int Curl_socketpair(int domain, int type, int protocol,
sclose(listener); sclose(listener);
return 0; return 0;
error: error:
sclose(listener); sclose(listener);
sclose(socks[0]); sclose(socks[0]);
sclose(socks[1]); sclose(socks[1]);

View File

@ -354,7 +354,7 @@ static CURLproxycode do_SOCKS4(struct Curl_cfilter *cf,
} }
} }
/* FALLTHROUGH */ /* FALLTHROUGH */
CONNECT_RESOLVED: CONNECT_RESOLVED:
case CONNECT_RESOLVED: { case CONNECT_RESOLVED: {
struct Curl_addrinfo *hp = NULL; struct Curl_addrinfo *hp = NULL;
/* /*
@ -394,7 +394,7 @@ static CURLproxycode do_SOCKS4(struct Curl_cfilter *cf,
return CURLPX_RESOLVE_HOST; return CURLPX_RESOLVE_HOST;
} }
/* FALLTHROUGH */ /* FALLTHROUGH */
CONNECT_REQ_INIT: CONNECT_REQ_INIT:
case CONNECT_REQ_INIT: case CONNECT_REQ_INIT:
/* /*
* This is currently not supporting "Identification Protocol (RFC1413)". * This is currently not supporting "Identification Protocol (RFC1413)".
@ -638,7 +638,7 @@ static CURLproxycode do_SOCKS5(struct Curl_cfilter *cf,
return CURLPX_OK; return CURLPX_OK;
} }
/* FALLTHROUGH */ /* FALLTHROUGH */
CONNECT_SOCKS_READ_INIT: CONNECT_SOCKS_READ_INIT:
case CONNECT_SOCKS_READ_INIT: case CONNECT_SOCKS_READ_INIT:
sx->outstanding = 2; /* expect two bytes */ sx->outstanding = 2; /* expect two bytes */
sx->outp = socksreq; /* store it here */ sx->outp = socksreq; /* store it here */
@ -700,7 +700,7 @@ static CURLproxycode do_SOCKS5(struct Curl_cfilter *cf,
default: /* do nothing! */ default: /* do nothing! */
break; break;
CONNECT_AUTH_INIT: CONNECT_AUTH_INIT:
case CONNECT_AUTH_INIT: { case CONNECT_AUTH_INIT: {
/* Needs user name and password */ /* Needs user name and password */
size_t proxy_user_len, proxy_password_len; 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! */ /* Everything is good so far, user was authenticated! */
sxstate(sx, data, CONNECT_REQ_INIT); sxstate(sx, data, CONNECT_REQ_INIT);
/* FALLTHROUGH */ /* FALLTHROUGH */
CONNECT_REQ_INIT: CONNECT_REQ_INIT:
case CONNECT_REQ_INIT: case CONNECT_REQ_INIT:
if(socks5_resolve_local) { if(socks5_resolve_local) {
enum resolve_t rc = Curl_resolv(data, sx->hostname, sx->remote_port, 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 */ /* FALLTHROUGH */
CONNECT_RESOLVED: CONNECT_RESOLVED:
case CONNECT_RESOLVED: { case CONNECT_RESOLVED: {
struct Curl_addrinfo *hp = NULL; struct Curl_addrinfo *hp = NULL;
size_t destlen; 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 */ Curl_resolv_unlock(data, dns); /* not used anymore from now on */
goto CONNECT_REQ_SEND; goto CONNECT_REQ_SEND;
} }
CONNECT_RESOLVE_REMOTE: CONNECT_RESOLVE_REMOTE:
case CONNECT_RESOLVE_REMOTE: case CONNECT_RESOLVE_REMOTE:
/* Authentication is complete, now specify destination to the proxy */ /* Authentication is complete, now specify destination to the proxy */
len = 0; len = 0;
@ -913,7 +913,7 @@ static CURLproxycode do_SOCKS5(struct Curl_cfilter *cf,
} }
/* FALLTHROUGH */ /* FALLTHROUGH */
CONNECT_REQ_SEND: CONNECT_REQ_SEND:
case CONNECT_REQ_SEND: case CONNECT_REQ_SEND:
/* PORT MSB */ /* PORT MSB */
socksreq[len++] = (unsigned char)((sx->remote_port >> 8) & 0xff); socksreq[len++] = (unsigned char)((sx->remote_port >> 8) & 0xff);

View File

@ -1110,7 +1110,7 @@ CURLcode telrcv(struct Curl_easy *data,
break; break;
case CURL_TS_IAC: case CURL_TS_IAC:
process_iac: process_iac:
DEBUGASSERT(startwrite < 0); DEBUGASSERT(startwrite < 0);
switch(c) { switch(c) {
case CURL_WILL: case CURL_WILL:

View File

@ -1587,7 +1587,7 @@ static struct connectdata *allocate_conn(struct Curl_easy *data)
conn->gssapi_delegation = data->set.gssapi_delegation; conn->gssapi_delegation = data->set.gssapi_delegation;
return conn; return conn;
error: error:
free(conn->localdev); free(conn->localdev);
free(conn); free(conn);
@ -2301,7 +2301,7 @@ static CURLcode parse_proxy(struct Curl_easy *data,
} }
#endif #endif
error: error:
free(proxyuser); free(proxyuser);
free(proxypasswd); free(proxypasswd);
free(host); free(host);
@ -2898,7 +2898,7 @@ static CURLcode parse_connect_to_host_port(struct Curl_easy *data,
*port_result = port; *port_result = port;
error: error:
free(host_dup); free(host_dup);
return result; return result;
} }

View File

@ -481,7 +481,7 @@ static CURLUcode parse_hostname_login(struct Curl_URL *u,
*offset = ptr - login; *offset = ptr - login;
return CURLUE_OK; return CURLUE_OK;
out: out:
free(userp); free(userp);
free(passwdp); free(passwdp);
@ -1317,7 +1317,7 @@ static CURLUcode parseurl(const char *url, CURLU *u, unsigned int flags)
u->host = Curl_dyn_ptr(&host); u->host = Curl_dyn_ptr(&host);
return result; return result;
fail: fail:
Curl_dyn_free(&host); Curl_dyn_free(&host);
free_urlhandle(u); free_urlhandle(u);
return result; return result;
@ -1380,7 +1380,7 @@ CURLU *curl_url_dup(const CURLU *in)
u->portnum = in->portnum; u->portnum = in->portnum;
} }
return u; return u;
fail: fail:
curl_url_cleanup(u); curl_url_cleanup(u);
return NULL; return NULL;
} }
@ -1876,7 +1876,7 @@ CURLUcode curl_url_set(CURLU *u, CURLUPart what,
free(*storep); free(*storep);
*storep = Curl_dyn_ptr(&enc); *storep = Curl_dyn_ptr(&enc);
return CURLUE_OK; return CURLUE_OK;
nomem: nomem:
free((char *)newp); free((char *)newp);
return CURLUE_OUT_OF_MEMORY; return CURLUE_OUT_OF_MEMORY;
} }

View File

@ -1305,7 +1305,7 @@ static int init_ngh3_conn(struct Curl_cfilter *cf)
} }
return CURLE_OK; return CURLE_OK;
fail: fail:
return result; return result;
} }

View File

@ -425,7 +425,7 @@ static CURLcode wssh_connect(struct Curl_easy *data, bool *done)
state(data, SSH_SFTP_INIT); state(data, SSH_SFTP_INIT);
return wssh_multi_statemach(data, done); return wssh_multi_statemach(data, done);
error: error:
wolfSSH_free(sshc->ssh_session); wolfSSH_free(sshc->ssh_session);
wolfSSH_CTX_free(sshc->ctx); wolfSSH_CTX_free(sshc->ctx);
return CURLE_FAILED_INIT; return CURLE_FAILED_INIT;

View File

@ -831,7 +831,7 @@ mbed_connect_step2(struct Curl_cfilter *cf, struct Curl_easy *data)
result = Curl_pin_peer_pubkey(data, result = Curl_pin_peer_pubkey(data,
pinnedpubkey, pinnedpubkey,
&pubkey[PUB_DER_MAX_BYTES - size], size); &pubkey[PUB_DER_MAX_BYTES - size], size);
pinnedpubkey_error: pinnedpubkey_error:
mbedtls_x509_crt_free(p); mbedtls_x509_crt_free(p);
free(p); free(p);
free(pubkey); free(pubkey);

View File

@ -1496,7 +1496,7 @@ int cert_stuff(struct Curl_easy *data,
} }
cert_done = 1; cert_done = 1;
fail: fail:
EVP_PKEY_free(pri); EVP_PKEY_free(pri);
X509_free(x509); X509_free(x509);
sk_X509_pop_free(ca, X509_free); sk_X509_pop_free(ca, X509_free);
@ -4501,7 +4501,7 @@ static ssize_t ossl_send(struct Curl_cfilter *cf,
} }
*curlcode = CURLE_OK; *curlcode = CURLE_OK;
out: out:
return (ssize_t)rc; /* number of bytes */ return (ssize_t)rc; /* number of bytes */
} }
@ -4603,7 +4603,7 @@ static ssize_t ossl_recv(struct Curl_cfilter *cf,
} }
} }
out: out:
return nread; return nread;
} }

View File

@ -2358,7 +2358,7 @@ schannel_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
"schannel: decrypted data buffer: offset %zu length %zu", "schannel: decrypted data buffer: offset %zu length %zu",
backend->decdata_offset, backend->decdata_length)); backend->decdata_offset, backend->decdata_length));
cleanup: cleanup:
/* Warning- there is no guarantee the encdata state is valid at this point */ /* Warning- there is no guarantee the encdata state is valid at this point */
DEBUGF(infof(data, "schannel: schannel_recv cleanup")); DEBUGF(infof(data, "schannel: schannel_recv cleanup"));

View File

@ -3376,7 +3376,7 @@ static ssize_t sectransp_recv(struct Curl_cfilter *cf,
DEBUGASSERT(backend); DEBUGASSERT(backend);
again: again:
*curlcode = CURLE_OK; *curlcode = CURLE_OK;
err = SSLRead(backend->ssl_ctx, buf, buffersize, &processed); err = SSLRead(backend->ssl_ctx, buf, buffersize, &processed);

View File

@ -75,6 +75,7 @@ my %warnings = (
'INCLUDEDUP', => 'same file is included again', 'INCLUDEDUP', => 'same file is included again',
'INDENTATION' => 'wrong start column for code', 'INDENTATION' => 'wrong start column for code',
'LONGLINE' => "Line longer than $max_column", 'LONGLINE' => "Line longer than $max_column",
'SPACEBEFORELABEL' => 'labels not at the start of the line',
'MULTISPACE' => 'multiple spaces used when not suitable', 'MULTISPACE' => 'multiple spaces used when not suitable',
'NOSPACEEQUALS' => 'equals sign without preceding space', 'NOSPACEEQUALS' => 'equals sign without preceding space',
'NOTEQUALSZERO', => 'if/while comparison with != 0', 'NOTEQUALSZERO', => 'if/while comparison with != 0',
@ -697,6 +698,11 @@ sub scanfile {
$line, length($1), $file, $ol, "no space before colon of switch label"); $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 # scan for use of banned functions
if($l =~ /^(.*\W) if($l =~ /^(.*\W)
(gmtime|localtime| (gmtime|localtime|

View File

@ -900,7 +900,7 @@ int formparse(struct OperationConfig *config,
goto fail; goto fail;
} }
err = 0; err = 0;
fail: fail:
Curl_safefree(contents); Curl_safefree(contents);
curl_slist_free_all(headers); curl_slist_free_all(headers);
return err; return err;

View File

@ -624,7 +624,7 @@ static CURLcode post_per_transfer(struct GlobalConfig *global,
return CURLE_OK; return CURLE_OK;
} }
} /* if retry_numretries */ } /* if retry_numretries */
noretry: noretry:
if((global->progressmode == CURL_PROGRESS_BAR) && if((global->progressmode == CURL_PROGRESS_BAR) &&
per->progressbar.calls) per->progressbar.calls)

View File

@ -170,7 +170,7 @@ CURLcode add_file_name_to_url(CURL *curl, char **inurlp, const char *filename)
/* nothing to do */ /* nothing to do */
result = CURLE_OK; result = CURLE_OK;
} }
fail: fail:
curl_url_cleanup(uh); curl_url_cleanup(uh);
curl_free(path); curl_free(path);
return result; return result;

View File

@ -296,7 +296,7 @@ CURLcode tool_setopt_enum(CURL *curl, struct GlobalConfig *config,
if(ret) if(ret)
warnf(config, "option %s returned error (%d)\n", name, (int)ret); warnf(config, "option %s returned error (%d)\n", name, (int)ret);
#endif #endif
nomem: nomem:
return ret; return ret;
} }
@ -338,7 +338,7 @@ CURLcode tool_setopt_flags(CURL *curl, struct GlobalConfig *config,
CODE2("%s%ldL);", preamble, rest); CODE2("%s%ldL);", preamble, rest);
} }
nomem: nomem:
return ret; return ret;
} }
@ -381,7 +381,7 @@ CURLcode tool_setopt_bitmask(CURL *curl, struct GlobalConfig *config,
CODE2("%s%luUL);", preamble, rest); CODE2("%s%luUL);", preamble, rest);
} }
nomem: nomem:
return ret; return ret;
} }
@ -407,7 +407,7 @@ static CURLcode libcurl_generate_slist(struct curl_slist *slist, int *slistno)
*slistno, *slistno, escaped); *slistno, *slistno, escaped);
} }
nomem: nomem:
Curl_safefree(escaped); Curl_safefree(escaped);
return ret; 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); CODE2("curl_easy_setopt(hnd, %s, slist%d);", name, i);
} }
nomem: nomem:
return ret; return ret;
} }
@ -704,7 +704,7 @@ CURLcode tool_setopt(CURL *curl, bool str, struct GlobalConfig *global,
} }
} }
nomem: nomem:
Curl_safefree(escaped); Curl_safefree(escaped);
return ret; return ret;
} }

View File

@ -295,7 +295,7 @@ static CURLcode glob_range(struct URLGlob *glob, char **patternp,
} }
} }
fail: fail:
*posp += (pattern - *patternp); *posp += (pattern - *patternp);
if(!endp || !step_n || if(!endp || !step_n ||

View File

@ -75,7 +75,7 @@ char *stripcredentials(const char *url)
return nurl; return nurl;
} }
error: error:
curl_url_cleanup(u); curl_url_cleanup(u);
return NULL; return NULL;
} }

View File

@ -123,7 +123,7 @@ static int onetest(CURL *curl, const char *url, const struct testparams *p,
} }
return 0; return 0;
test_cleanup: test_cleanup:
return 1; return 1;
} }
@ -164,7 +164,7 @@ int test(char *URL)
printf("%d\n", status); printf("%d\n", status);
return status; return status;
test_cleanup: test_cleanup:
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
curl_global_cleanup(); curl_global_cleanup();

View File

@ -92,7 +92,7 @@ int test(char *URL)
else { else {
printf("curl_easy_perform() failed. e = %d\n", code); printf("curl_easy_perform() failed. e = %d\n", code);
} }
test_cleanup: test_cleanup:
curl_slist_free_all(pHeaderList); curl_slist_free_all(pHeaderList);
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
curl_global_cleanup(); curl_global_cleanup();

View File

@ -107,7 +107,7 @@ int test(char *URL)
printf("Tested %u strings\n", i); printf("Tested %u strings\n", i);
res = (int)result; res = (int)result;
test_cleanup: test_cleanup:
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
curl_global_cleanup(); curl_global_cleanup();

View File

@ -47,7 +47,7 @@ int test(char *URL)
curl_easy_setopt(ch, CURLOPT_COOKIEFILE, libtest_arg2); curl_easy_setopt(ch, CURLOPT_COOKIEFILE, libtest_arg2);
curl_easy_perform(ch); curl_easy_perform(ch);
cleanup: cleanup:
curl_easy_cleanup(ch); curl_easy_cleanup(ch);
curl_global_cleanup(); curl_global_cleanup();

View File

@ -90,7 +90,7 @@ int test(char *URL)
curl_easy_setopt(ch, CURLOPT_SHARE, NULL); curl_easy_setopt(ch, CURLOPT_SHARE, NULL);
curl_multi_remove_handle(cm, ch); curl_multi_remove_handle(cm, ch);
cleanup: cleanup:
curl_easy_cleanup(ch); curl_easy_cleanup(ch);
curl_share_cleanup(sh); curl_share_cleanup(sh);
curl_multi_cleanup(cm); curl_multi_cleanup(cm);

View File

@ -64,7 +64,7 @@ int test(char *URL)
res = curl_easy_perform(curl); res = curl_easy_perform(curl);
test_cleanup: test_cleanup:
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
curl_global_cleanup(); curl_global_cleanup();

View File

@ -112,7 +112,7 @@ int test(char *URL)
} }
curl_multi_remove_handle(mcurl, curl); curl_multi_remove_handle(mcurl, curl);
fail: fail:
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
curl_multi_cleanup(mcurl); curl_multi_cleanup(mcurl);

View File

@ -702,7 +702,7 @@ static curl_socket_t mqttit(curl_socket_t fd)
} }
} while(1); } while(1);
end: end:
if(buffer) if(buffer)
free(buffer); free(buffer);
if(dump) if(dump)

View File

@ -1172,7 +1172,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
if(num > 20) if(num > 20)
num = 20; num = 20;
retry: retry:
written = swrite(sock, buffer, num); written = swrite(sock, buffer, num);
if(written < 0) { if(written < 0) {
if((EWOULDBLOCK == SOCKERRNO) || (EAGAIN == SOCKERRNO)) { if((EWOULDBLOCK == SOCKERRNO) || (EAGAIN == SOCKERRNO)) {

View File

@ -500,7 +500,7 @@ static ssize_t write_behind(struct testcase *test, int convert)
putc(c, file); */ putc(c, file); */
if(1 != write(test->ofile, &c, 1)) if(1 != write(test->ofile, &c, 1))
break; break;
skipit: skipit:
prevchar = c; prevchar = c;
} }
return count; return count;
@ -1201,7 +1201,7 @@ static void sendtftp(struct testcase *test, const struct formats *pf)
wait_ms(1000*test->writedelay); wait_ms(1000*test->writedelay);
} }
send_data: send_data:
logmsg("write"); logmsg("write");
if(swrite(peer, sdp, size + 4) != size + 4) { if(swrite(peer, sdp, size + 4) != size + 4) {
logmsg("write: fail"); logmsg("write: fail");

View File

@ -227,7 +227,7 @@ UNITTEST_START
continue; continue;
} }
} }
error: error:
curl_easy_cleanup(easy); curl_easy_cleanup(easy);
curl_multi_cleanup(multi); curl_multi_cleanup(multi);
curl_slist_free_all(list); curl_slist_free_all(list);

View File

@ -212,7 +212,7 @@ UNITTEST_START
} }
} }
goto unit_test_abort; goto unit_test_abort;
error: error:
curl_easy_cleanup(easy); curl_easy_cleanup(easy);
curl_multi_cleanup(multi); curl_multi_cleanup(multi);
curl_slist_free_all(list); curl_slist_free_all(list);

View File

@ -224,7 +224,7 @@ UNITTEST_START
goto fail; goto fail;
ret = parse_port(u, ipv6port, FALSE); ret = parse_port(u, ipv6port, FALSE);
fail_unless(ret == CURLUE_BAD_PORT_NUMBER, "parse_port did wrong"); fail_unless(ret == CURLUE_BAD_PORT_NUMBER, "parse_port did wrong");
fail: fail:
free(ipv6port); free(ipv6port);
curl_url_cleanup(u); curl_url_cleanup(u);

View File

@ -106,7 +106,7 @@ UNITTEST_START
Curl_altsvc_save(curl, asi, outname); Curl_altsvc_save(curl, asi, outname);
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
fail: fail:
Curl_altsvc_cleanup(&asi); Curl_altsvc_cleanup(&asi);
} }
#endif #endif