← Commit list

be92f0a2e4

Daniel Stenberg
Daniel Stenberg
2026-04-07
SUCCESS Duration: 242s

Subject

lib: reserve 'result' for CURLcode, even more

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

lib/conncache.c+4 -4
@@ -600,7 +600,7 @@ bool Curl_cpool_find(struct Curl_easy *data,
{
struct cpool *cpool = cpool_get_instance(data);
struct cpool_bundle *bundle;
- bool result = FALSE;
+ bool found = FALSE;
DEBUGASSERT(cpool);
DEBUGASSERT(conn_cb);
@@ -619,17 +619,17 @@ bool Curl_cpool_find(struct Curl_easy *data,
curr = Curl_node_next(curr);
if(conn_cb(conn, userdata)) {
- result = TRUE;
+ found = TRUE;
break;
}
}
}
if(done_cb) {
- result = done_cb(userdata);
+ found = done_cb(userdata);
}
CPOOL_UNLOCK(cpool, data);
- return result;
+ return found;
}
void Curl_conn_terminate(struct Curl_easy *data,
lib/formdata.c+3 -3
@@ -609,11 +609,11 @@ CURLFORMcode curl_formadd(struct curl_httppost **httppost,
struct curl_httppost **last_post, ...)
{
va_list arg;
- CURLFORMcode result;
+ CURLFORMcode form;
va_start(arg, last_post);
- result = FormAdd(httppost, last_post, arg);
+ form = FormAdd(httppost, last_post, arg);
va_end(arg);
- return result;
+ return form;
}
/*
lib/http.c+3 -3
@@ -3170,13 +3170,13 @@ static statusline checkhttpprefix(struct Curl_easy *data,
static statusline checkrtspprefix(struct Curl_easy *data,
const char *s, size_t len)
{
- statusline result = STATUS_BAD;
+ statusline status = STATUS_BAD;
statusline onmatch = len >= 5 ? STATUS_DONE : STATUS_UNKNOWN;
(void)data;
if(checkprefixmax("RTSP/", s, len))
- result = onmatch;
+ status = onmatch;
- return result;
+ return status;
}
#endif /* CURL_DISABLE_RTSP */
lib/smtp.c+4 -4
@@ -485,7 +485,7 @@ static bool smtp_endofresp(struct Curl_easy *data, struct connectdata *conn,
const char *line, size_t len, int *resp)
{
struct smtp_conn *smtpc = Curl_conn_meta_get(conn, CURL_META_SMTP_CONN);
- bool result = FALSE;
+ bool end = FALSE;
(void)data;
DEBUGASSERT(smtpc);
@@ -504,7 +504,7 @@ static bool smtp_endofresp(struct Curl_easy *data, struct connectdata *conn,
char tmpline[6];
curl_off_t code;
const char *p = tmpline;
- result = TRUE;
+ end = TRUE;
memcpy(tmpline, line, (len == 5 ? 5 : 3));
tmpline[len == 5 ? 5 : 3] = 0;
if(curlx_str_number(&p, &code, len == 5 ? 99999 : 999))
@@ -518,11 +518,11 @@ static bool smtp_endofresp(struct Curl_easy *data, struct connectdata *conn,
/* Do we have a multiline (continuation) response? */
else if(line[3] == '-' &&
(smtpc->state == SMTP_EHLO || smtpc->state == SMTP_COMMAND)) {
- result = TRUE;
+ end = TRUE;
*resp = 1; /* Internal response code */
}
- return result;
+ return end;
}
/***********************************************************************
lib/url.c+4 -4
@@ -1305,7 +1305,7 @@ static bool url_attach_existing(struct Curl_easy *data,
bool *waitpipe)
{
struct url_conn_match match;
- bool result;
+ bool success;
DEBUGASSERT(!data->conn);
memset(&match, 0, sizeof(match));
@@ -1340,13 +1340,13 @@ static bool url_attach_existing(struct Curl_easy *data,
/* Find a connection in the pool that matches what "data + needle"
* requires. If a suitable candidate is found, it is attached to "data". */
- result = Curl_cpool_find(data, needle->destination,
- url_match_conn, url_match_result, &match);
+ success = Curl_cpool_find(data, needle->destination,
+ url_match_conn, url_match_result, &match);
/* wait_pipe is TRUE if we encounter a bundle that is undecided. There
* is no matching connection then, yet. */
*waitpipe = (bool)match.wait_pipe;
- return result;
+ return success;
}
/*
lib/urlapi.c+45 -45
@@ -251,7 +251,7 @@ static CURLUcode parse_hostname_login(struct Curl_URL *u,
unsigned int flags,
size_t *offset) /* to the hostname */
{
- CURLUcode result = CURLUE_OK;
+ CURLUcode ures = CURLUE_OK;
CURLcode ccode;
char *userp = NULL;
char *passwdp = NULL;
@@ -292,14 +292,14 @@ static CURLUcode parse_hostname_login(struct Curl_URL *u,
if(ccode) {
/* the only possible error from Curl_parse_login_details is out of
memory: */
- result = CURLUE_OUT_OF_MEMORY;
+ ures = CURLUE_OUT_OF_MEMORY;
goto out;
}
if(userp) {
if(flags & CURLU_DISALLOW_USER) {
/* Option DISALLOW_USER is set and URL contains username. */
- result = CURLUE_USER_NOT_ALLOWED;
+ ures = CURLUE_USER_NOT_ALLOWED;
goto out;
}
curlx_free(u->user);
@@ -329,7 +329,7 @@ out:
u->password = NULL;
u->options = NULL;
- return result;
+ return ures;
}
UNITTEST CURLUcode Curl_parse_port(struct Curl_URL *u, struct dynbuf *host,
@@ -659,21 +659,21 @@ out:
/* used for HTTP/2 server push */
CURLUcode Curl_url_set_authority(CURLU *u, const char *authority)
{
- CURLUcode result;
+ CURLUcode ures;
struct dynbuf host;
DEBUGASSERT(authority);
curlx_dyn_init(&host, CURL_MAX_INPUT_LENGTH);
- result = parse_authority(u, authority, strlen(authority),
- CURLU_DISALLOW_USER, &host, !!u->scheme);
- if(result)
+ ures = parse_authority(u, authority, strlen(authority),
+ CURLU_DISALLOW_USER, &host, !!u->scheme);
+ if(ures)
curlx_dyn_free(&host);
else {
curlx_free(u->host);
u->host = curlx_dyn_ptr(&host);
}
- return result;
+ return ures;
}
/*
@@ -1012,16 +1012,16 @@ static CURLUcode guess_scheme(CURLU *u, struct dynbuf *host)
static CURLUcode handle_fragment(CURLU *u, const char *fragment,
size_t fraglen, unsigned int flags)
{
- CURLUcode result;
+ CURLUcode ures;
u->fragment_present = TRUE;
if(fraglen > 1) {
/* skip the leading '#' in the copy but include the terminating null */
if(flags & CURLU_URLENCODE) {
struct dynbuf enc;
curlx_dyn_init(&enc, CURL_MAX_INPUT_LENGTH);
- result = urlencode_str(&enc, fragment + 1, fraglen - 1, TRUE, FALSE);
- if(result)
- return result;
+ ures = urlencode_str(&enc, fragment + 1, fraglen - 1, TRUE, FALSE);
+ if(ures)
+ return ures;
u->fragment = curlx_dyn_ptr(&enc);
}
else {
@@ -1040,12 +1040,12 @@ static CURLUcode handle_query(CURLU *u, const char *query,
if(qlen > 1) {
if(flags & CURLU_URLENCODE) {
struct dynbuf enc;
- CURLUcode result;
+ CURLUcode ures;
curlx_dyn_init(&enc, CURL_MAX_INPUT_LENGTH);
/* skip the leading question mark */
- result = urlencode_str(&enc, query + 1, qlen - 1, TRUE, TRUE);
- if(result)
- return result;
+ ures = urlencode_str(&enc, query + 1, qlen - 1, TRUE, TRUE);
+ if(ures)
+ return ures;
u->query = curlx_dyn_ptr(&enc);
}
else {
@@ -1067,13 +1067,13 @@ static CURLUcode handle_path(CURLU *u, const char *path,
size_t pathlen, unsigned int flags,
bool is_file)
{
- CURLUcode result;
+ CURLUcode ures;
if(pathlen && (flags & CURLU_URLENCODE)) {
struct dynbuf enc;
curlx_dyn_init(&enc, CURL_MAX_INPUT_LENGTH);
- result = urlencode_str(&enc, path, pathlen, TRUE, FALSE);
- if(result)
- return result;
+ ures = urlencode_str(&enc, path, pathlen, TRUE, FALSE);
+ if(ures)
+ return ures;
pathlen = curlx_dyn_len(&enc);
path = u->path = curlx_dyn_ptr(&enc);
}
@@ -1112,7 +1112,7 @@ static CURLUcode parseurl(const char *url, CURLU *u, unsigned int flags)
char schemebuf[MAX_SCHEME_LEN + 1];
size_t schemelen = 0;
size_t urllen;
- CURLUcode result = CURLUE_OK;
+ CURLUcode ures = CURLUE_OK;
struct dynbuf host;
bool is_file = FALSE;
@@ -1120,8 +1120,8 @@ static CURLUcode parseurl(const char *url, CURLU *u, unsigned int flags)
curlx_dyn_init(&host, CURL_MAX_INPUT_LENGTH);
- result = Curl_junkscan(url, &urllen, !!(flags & CURLU_ALLOW_SPACE));
- if(result)
+ ures = Curl_junkscan(url, &urllen, !!(flags & CURLU_ALLOW_SPACE));
+ if(ures)
goto fail;
schemelen = Curl_is_absolute_url(url, schemebuf, sizeof(schemebuf),
@@ -1131,13 +1131,13 @@ static CURLUcode parseurl(const char *url, CURLU *u, unsigned int flags)
/* handle the file: scheme */
if(schemelen && !strcmp(schemebuf, "file")) {
is_file = TRUE;
- result = parse_file(url, urllen, u, &host, &path, &pathlen);
+ ures = parse_file(url, urllen, u, &host, &path, &pathlen);
}
else {
const char *hostp = NULL;
size_t hostlen;
- result = parse_scheme(url, u, schemebuf, schemelen, flags, &hostp);
- if(result)
+ ures = parse_scheme(url, u, schemebuf, schemelen, flags, &hostp);
+ if(ures)
goto fail;
/* find the end of the hostname + port number */
@@ -1147,49 +1147,49 @@ static CURLUcode parseurl(const char *url, CURLU *u, unsigned int flags)
/* this pathlen also contains the query and the fragment */
pathlen = urllen - (path - url);
if(hostlen) {
- result = parse_authority(u, hostp, hostlen, flags, &host,
- u->scheme != NULL);
- if(!result && (flags & CURLU_GUESS_SCHEME) && !u->scheme)
- result = guess_scheme(u, &host);
+ ures = parse_authority(u, hostp, hostlen, flags, &host,
+ u->scheme != NULL);
+ if(!ures && (flags & CURLU_GUESS_SCHEME) && !u->scheme)
+ ures = guess_scheme(u, &host);
}
else if(flags & CURLU_NO_AUTHORITY) {
/* allowed to be empty. */
if(curlx_dyn_add(&host, ""))
- result = CURLUE_OUT_OF_MEMORY;
+ ures = CURLUE_OUT_OF_MEMORY;
}
else
- result = CURLUE_NO_HOST;
+ ures = CURLUE_NO_HOST;
}
- if(!result) {
+ if(!ures) {
/* The path might at this point contain a fragment and/or a query to
handle */
const char *fragment = strchr(path, '#');
if(fragment) {
size_t fraglen = pathlen - (fragment - path);
- result = handle_fragment(u, fragment, fraglen, flags);
+ ures = handle_fragment(u, fragment, fraglen, flags);
/* after this, pathlen still contains the query */
pathlen -= fraglen;
}
}
- if(!result) {
+ if(!ures) {
const char *query = memchr(path, '?', pathlen);
if(query) {
size_t qlen = pathlen - (query - path);
- result = handle_query(u, query, qlen, flags);
+ ures = handle_query(u, query, qlen, flags);
pathlen -= qlen;
}
}
- if(!result)
+ if(!ures)
/* the fragment and query parts are trimmed off from the path */
- result = handle_path(u, path, pathlen, flags, is_file);
- if(!result) {
+ ures = handle_path(u, path, pathlen, flags, is_file);
+ if(!ures) {
u->host = curlx_dyn_ptr(&host);
return CURLUE_OK;
}
fail:
curlx_dyn_free(&host);
free_urlhandle(u);
- return result;
+ return ures;
}
/*
@@ -1198,15 +1198,15 @@ fail:
static CURLUcode parseurl_and_replace(const char *url, CURLU *u,
unsigned int flags)
{
- CURLUcode result;
+ CURLUcode ures;
CURLU tmpurl;
memset(&tmpurl, 0, sizeof(tmpurl));
- result = parseurl(url, &tmpurl, flags);
- if(!result) {
+ ures = parseurl(url, &tmpurl, flags);
+ if(!ures) {
free_urlhandle(u);
*u = tmpurl;
}
- return result;
+ return ures;
}
/*
lib/vtls/schannel_verify.c+9 -12
@@ -438,13 +438,12 @@ static DWORD cert_get_name_string(struct Curl_easy *data,
static bool get_num_host_info(struct num_ip_data *ip_blob, LPCSTR hostname)
{
- bool result = FALSE;
struct in_addr ia;
int res = curlx_inet_pton(AF_INET, hostname, &ia);
if(res) {
ip_blob->size = sizeof(struct in_addr);
memcpy(&ip_blob->bData.ia, &ia, sizeof(struct in_addr));
- result = TRUE;
+ return TRUE;
}
else {
struct in6_addr ia6;
@@ -452,10 +451,10 @@ static bool get_num_host_info(struct num_ip_data *ip_blob, LPCSTR hostname)
if(res) {
ip_blob->size = sizeof(struct in6_addr);
memcpy(&ip_blob->bData.ia6, &ia6, sizeof(struct in6_addr));
- result = TRUE;
+ return TRUE;
}
}
- return result;
+ return FALSE;
}
static bool get_alt_name_info(struct Curl_easy *data,
@@ -463,20 +462,19 @@ static bool get_alt_name_info(struct Curl_easy *data,
PCERT_ALT_NAME_INFO *alt_name_info,
LPDWORD alt_name_info_size)
{
- bool result = FALSE;
PCERT_INFO cert_info = NULL;
PCERT_EXTENSION extension = NULL;
CRYPT_DECODE_PARA decode_para = { sizeof(CRYPT_DECODE_PARA), NULL, NULL };
if(!ctx) {
failf(data, "schannel: Null certificate context.");
- return result;
+ return FALSE;
}
cert_info = ctx->pCertInfo;
if(!cert_info) {
failf(data, "schannel: Null certificate info.");
- return result;
+ return FALSE;
}
extension = CertFindExtension(szOID_SUBJECT_ALT_NAME2,
@@ -484,7 +482,7 @@ static bool get_alt_name_info(struct Curl_easy *data,
cert_info->rgExtension);
if(!extension) {
failf(data, "schannel: CertFindExtension() returned no extension.");
- return result;
+ return FALSE;
}
if(!CryptDecodeObjectEx(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
@@ -496,11 +494,10 @@ static bool get_alt_name_info(struct Curl_easy *data,
alt_name_info,
alt_name_info_size)) {
failf(data, "schannel: CryptDecodeObjectEx() returned no alternate name "
- "information.");
- return result;
+ "information.");
+ return FALSE;
}
- result = TRUE;
- return result;
+ return TRUE;
}
/* Verify the server's hostname */
lib/vtls/vtls.c+4 -4
@@ -1455,16 +1455,16 @@ static bool ssl_cf_data_pending(struct Curl_cfilter *cf,
{
struct ssl_connect_data *connssl = cf->ctx;
struct cf_call_data save;
- bool result;
+ bool pending;
CF_DATA_SAVE(save, cf, data);
if(connssl->ssl_impl->data_pending &&
connssl->ssl_impl->data_pending(cf, data))
- result = TRUE;
+ pending = TRUE;
else
- result = cf->next->cft->has_data_pending(cf->next, data);
+ pending = cf->next->cft->has_data_pending(cf->next, data);
CF_DATA_RESTORE(cf, save);
- return result;
+ return pending;
}
static CURLcode ssl_cf_send(struct Curl_cfilter *cf,