Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib, src, tests: added space around ternary expressions #14912

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/asyn-thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ CURL_STDCALL getaddrinfo_thread(void *arg)
rc = Curl_getaddrinfo_ex(tsd->hostname, service, &tsd->hints, &tsd->res);

if(rc) {
tsd->sock_error = SOCKERRNO?SOCKERRNO:rc;
tsd->sock_error = SOCKERRNO ? SOCKERRNO : rc;
if(tsd->sock_error == 0)
tsd->sock_error = RESOLVER_ENOMEM;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/c-hyper.c
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
}

p_accept = Curl_checkheaders(data,
STRCONST("Accept"))?NULL:"Accept: */*\r\n";
STRCONST("Accept")) ? NULL : "Accept: */*\r\n";
if(p_accept) {
result = Curl_hyper_header(data, headers, p_accept);
if(result)
Expand Down
2 changes: 1 addition & 1 deletion lib/cf-haproxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ static CURLcode cf_haproxy_create(struct Curl_cfilter **pcf,

out:
cf_haproxy_ctx_free(ctx);
*pcf = result? NULL : cf;
*pcf = result ? NULL : cf;
return result;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/cf-https-connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ static CURLcode cf_hc_create(struct Curl_cfilter **pcf,
cf_hc_reset(cf, data);

out:
*pcf = result? NULL : cf;
*pcf = result ? NULL : cf;
free(ctx);
return result;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -1417,7 +1417,7 @@ static CURLcode cf_setup_create(struct Curl_cfilter **pcf,
ctx = NULL;

out:
*pcf = result? NULL : cf;
*pcf = result ? NULL : cf;
free(ctx);
return result;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/cookie.c
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ Curl_cookie_add(struct Curl_easy *data,
* domain can access the variable. Set TRUE when the cookie says
* .domain.com and to false when the domain is complete www.domain.com
*/
co->tailmatch = strcasecompare(ptr, "TRUE")?TRUE:FALSE;
co->tailmatch = strcasecompare(ptr, "TRUE") ? TRUE : FALSE;
break;
case 2:
/* The file format allows the path field to remain not filled in */
Expand Down Expand Up @@ -1400,7 +1400,7 @@ struct Cookie *Curl_cookie_getlist(struct Curl_easy *data,

while(co) {
/* if the cookie requires we are secure we must only continue if we are! */
if(co->secure?secure:TRUE) {
if(co->secure ? secure : TRUE) {

/* now check if the domain is correct */
if(!co->domain ||
Expand Down
2 changes: 1 addition & 1 deletion lib/cw-out.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ static CURLcode cw_out_write(struct Curl_easy *data,
CURLcode result;
bool flush_all;

flush_all = (type & CLIENTWRITE_EOS)? TRUE:FALSE;
flush_all = (type & CLIENTWRITE_EOS) ? TRUE : FALSE;
if((type & CLIENTWRITE_BODY) ||
((type & CLIENTWRITE_HEADER) && data->set.include_header)) {
result = cw_out_do_write(ctx, data, CW_OUT_BODY, flush_all, buf, blen);
Expand Down
2 changes: 1 addition & 1 deletion lib/escape.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ CURLcode Curl_urldecode(const char *string, size_t length,
DEBUGASSERT(string);
DEBUGASSERT(ctrl >= REJECT_NADA); /* crash on TRUE/FALSE */

alloc = (length?length:strlen(string));
alloc = (length ? length : strlen(string));
ns = malloc(alloc + 1);

if(!ns)
Expand Down
2 changes: 1 addition & 1 deletion lib/ftp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2218,7 +2218,7 @@ static CURLcode client_write_header(struct Curl_easy *data,
int save = data->set.include_header;
data->set.include_header = TRUE;
result = Curl_client_write(data, CLIENTWRITE_HEADER, buf, blen);
data->set.include_header = save? TRUE:FALSE;
data->set.include_header = save ? TRUE : FALSE;
return result;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/hostip.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ bool Curl_ipv6works(struct Curl_easy *data)
ipv6_works = 1;
sclose(s);
}
return (ipv6_works>0)?TRUE:FALSE;
return (ipv6_works>0) ? TRUE : FALSE;
}
}
#endif /* USE_IPV6 */
Expand Down
14 changes: 7 additions & 7 deletions lib/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -2582,7 +2582,7 @@ CURLcode Curl_http(struct Curl_easy *data, bool *done)
goto fail;

p_accept = Curl_checkheaders(data,
STRCONST("Accept"))?NULL:"Accept: */*\r\n";
STRCONST("Accept")) ? NULL : "Accept: */*\r\n";

result = Curl_http_range(data, httpreq);
if(result)
Expand Down Expand Up @@ -3042,8 +3042,8 @@ CURLcode Curl_http_header(struct Curl_easy *data,
char *persistentauth = Curl_copy_header_value(hd);
if(!persistentauth)
return CURLE_OUT_OF_MEMORY;
negdata->noauthpersist = checkprefix("false", persistentauth)?
TRUE:FALSE;
negdata->noauthpersist = checkprefix("false", persistentauth) ?
TRUE : FALSE;
negdata->havenoauthpersist = TRUE;
infof(data, "Negotiate: noauthpersist -> %d, header part: %s",
negdata->noauthpersist, persistentauth);
Expand Down Expand Up @@ -4093,7 +4093,7 @@ CURLcode Curl_http_req_make(struct httpreq **preq,
out:
if(result && req)
Curl_http_req_free(req);
*preq = result? NULL : req;
*preq = result ? NULL : req;
return result;
}

Expand Down Expand Up @@ -4251,7 +4251,7 @@ CURLcode Curl_http_req_make2(struct httpreq **preq,
out:
if(result && req)
Curl_http_req_free(req);
*preq = result? NULL : req;
*preq = result ? NULL : req;
return result;
}

Expand Down Expand Up @@ -4382,7 +4382,7 @@ CURLcode Curl_http_resp_make(struct http_resp **presp,
out:
if(result && resp)
Curl_http_resp_free(resp);
*presp = result? NULL : resp;
*presp = result ? NULL : resp;
return result;
}

Expand Down Expand Up @@ -4543,7 +4543,7 @@ static void http_exp100_send_anyway(struct Curl_easy *data)
bool Curl_http_exp100_is_selected(struct Curl_easy *data)
{
struct Curl_creader *r = Curl_creader_get_by_type(data, &cr_exp100);
return r? TRUE : FALSE;
return r ? TRUE : FALSE;
}

#endif /* CURL_DISABLE_HTTP */
2 changes: 1 addition & 1 deletion lib/http2.c
Original file line number Diff line number Diff line change
Expand Up @@ -2751,7 +2751,7 @@ static CURLcode http2_cfilter_add(struct Curl_cfilter **pcf,
out:
if(result)
cf_h2_ctx_free(ctx);
*pcf = result? NULL : cf;
*pcf = result ? NULL : cf;
return result;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/krb5.c
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ static void do_sec_send(struct Curl_easy *data, struct connectdata *conn,
size_t cmd_size = 0;
CURLcode error;
enum protection_level prot_level = conn->data_prot;
bool iscmd = (prot_level == PROT_CMD)?TRUE:FALSE;
bool iscmd = (prot_level == PROT_CMD) ? TRUE : FALSE;

DEBUGASSERT(prot_level > PROT_NONE && prot_level < PROT_LAST);

Expand Down Expand Up @@ -655,7 +655,7 @@ static void do_sec_send(struct Curl_easy *data, struct connectdata *conn,

socket_write(data, fd, cmd_buffer, cmd_size);
socket_write(data, fd, "\r\n", 2);
infof(data, "Send: %s%s", prot_level == PROT_PRIVATE?enc:mic,
infof(data, "Send: %s%s", prot_level == PROT_PRIVATE ? enc : mic,
cmd_buffer);
free(cmd_buffer);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/multi.c
Original file line number Diff line number Diff line change
Expand Up @@ -2374,7 +2374,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
*/
CURLcode ret = Curl_retry_request(data, &newurl);
if(!ret)
retry = (newurl)?TRUE:FALSE;
retry = (newurl) ? TRUE : FALSE;
else if(!result)
result = ret;

Expand Down
4 changes: 2 additions & 2 deletions lib/pingpong.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ CURLcode Curl_pp_statemach(struct Curl_easy *data,
/* We are receiving and there is data ready in the SSL library */
rc = 1;
else
rc = Curl_socket_check(pp->sendleft?CURL_SOCKET_BAD:sock, /* reading */
rc = Curl_socket_check(pp->sendleft ? CURL_SOCKET_BAD : sock, /* reading */
CURL_SOCKET_BAD,
pp->sendleft?sock:CURL_SOCKET_BAD, /* writing */
pp->sendleft ? sock : CURL_SOCKET_BAD, /* writing */
interval_ms);

if(block) {
Expand Down
4 changes: 2 additions & 2 deletions lib/sendf.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ CURLcode Curl_cwriter_create(struct Curl_cwriter **pwriter,
result = cwt->do_init(data, writer);

out:
*pwriter = result? NULL : writer;
*pwriter = result ? NULL : writer;
if(result)
free(writer);
return result;
Expand Down Expand Up @@ -930,7 +930,7 @@ CURLcode Curl_creader_create(struct Curl_creader **preader,
result = crt->do_init(data, reader);

out:
*preader = result? NULL : reader;
*preader = result ? NULL : reader;
if(result)
free(reader);
return result;
Expand Down
2 changes: 1 addition & 1 deletion lib/vquic/curl_ngtcp2.c
Original file line number Diff line number Diff line change
Expand Up @@ -2476,7 +2476,7 @@ static bool cf_ngtcp2_conn_is_alive(struct Curl_cfilter *cf,
*input_pending = FALSE;
result = cf_progress_ingress(cf, data, NULL);
CURL_TRC_CF(data, cf, "is_alive, progress ingress -> %d", result);
alive = result? FALSE : TRUE;
alive = result ? FALSE : TRUE;
}

out:
Expand Down
2 changes: 1 addition & 1 deletion lib/vquic/curl_osslq.c
Original file line number Diff line number Diff line change
Expand Up @@ -2207,7 +2207,7 @@ static bool cf_osslq_conn_is_alive(struct Curl_cfilter *cf,
*input_pending = FALSE;
result = cf_progress_ingress(cf, data);
CURL_TRC_CF(data, cf, "is_alive, progress ingress -> %d", result);
alive = result? FALSE : TRUE;
alive = result ? FALSE : TRUE;
}

out:
Expand Down
2 changes: 1 addition & 1 deletion lib/vssh/libssh.c
Original file line number Diff line number Diff line change
Expand Up @@ -2609,7 +2609,7 @@ static ssize_t sftp_recv(struct Curl_easy *data, int sockindex,
mem, (uint32_t)len,
(uint32_t)conn->proto.sshc.sftp_file_index);

myssh_block2waitfor(conn, (nread == SSH_AGAIN)?TRUE:FALSE);
myssh_block2waitfor(conn, (nread == SSH_AGAIN) ? TRUE : FALSE);

if(nread == SSH_AGAIN) {
*err = CURLE_AGAIN;
Expand Down
16 changes: 8 additions & 8 deletions lib/vssh/libssh2.c
Original file line number Diff line number Diff line change
Expand Up @@ -2269,7 +2269,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
(sftperr != LIBSSH2_FX_PERMISSION_DENIED)) {
result = sftp_libssh2_error_to_CURLE(sftperr);
state(data, SSH_SFTP_CLOSE);
sshc->actualcode = result?result:CURLE_SSH;
sshc->actualcode = result ? result : CURLE_SSH;
break;
}
rc = 0; /* clear rc and continue */
Expand Down Expand Up @@ -2304,7 +2304,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
sftp_libssh2_strerror(sftperr));
state(data, SSH_SFTP_CLOSE);
result = sftp_libssh2_error_to_CURLE(sftperr);
sshc->actualcode = result?result:CURLE_SSH;
sshc->actualcode = result ? result : CURLE_SSH;
break;
}
sshp->readdir_filename = malloc(PATH_MAX + 1);
Expand Down Expand Up @@ -2384,7 +2384,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
else if(rc < 0) {
sftperr = libssh2_sftp_last_error(sshc->sftp_session);
result = sftp_libssh2_error_to_CURLE(sftperr);
sshc->actualcode = result?result:CURLE_SSH;
sshc->actualcode = result ? result : CURLE_SSH;
failf(data, "Could not open remote file for reading: %s :: %d",
sftp_libssh2_strerror(sftperr),
libssh2_session_last_errno(sshc->ssh_session));
Expand Down Expand Up @@ -2474,7 +2474,7 @@ static CURLcode ssh_statemach_act(struct Curl_easy *data, bool *block)
sftp_libssh2_strerror(sftperr));
state(data, SSH_SFTP_CLOSE);
result = sftp_libssh2_error_to_CURLE(sftperr);
sshc->actualcode = result?result:CURLE_SSH;
sshc->actualcode = result ? result : CURLE_SSH;
break;
}
state(data, SSH_SFTP_DOWNLOAD_STAT);
Expand Down Expand Up @@ -3545,7 +3545,7 @@ static ssize_t scp_send(struct Curl_easy *data, int sockindex,
/* libssh2_channel_write() returns int! */
nwrite = (ssize_t) libssh2_channel_write(sshc->ssh_channel, mem, len);

ssh_block2waitfor(data, (nwrite == LIBSSH2_ERROR_EAGAIN)?TRUE:FALSE);
ssh_block2waitfor(data, (nwrite == LIBSSH2_ERROR_EAGAIN) ? TRUE : FALSE);

if(nwrite == LIBSSH2_ERROR_EAGAIN) {
*err = CURLE_AGAIN;
Expand All @@ -3570,7 +3570,7 @@ static ssize_t scp_recv(struct Curl_easy *data, int sockindex,
/* libssh2_channel_read() returns int */
nread = (ssize_t) libssh2_channel_read(sshc->ssh_channel, mem, len);

ssh_block2waitfor(data, (nread == LIBSSH2_ERROR_EAGAIN)?TRUE:FALSE);
ssh_block2waitfor(data, (nread == LIBSSH2_ERROR_EAGAIN) ? TRUE : FALSE);
if(nread == LIBSSH2_ERROR_EAGAIN) {
*err = CURLE_AGAIN;
nread = -1;
Expand Down Expand Up @@ -3683,7 +3683,7 @@ static ssize_t sftp_send(struct Curl_easy *data, int sockindex,

nwrite = libssh2_sftp_write(sshc->sftp_handle, mem, len);

ssh_block2waitfor(data, (nwrite == LIBSSH2_ERROR_EAGAIN)?TRUE:FALSE);
ssh_block2waitfor(data, (nwrite == LIBSSH2_ERROR_EAGAIN) ? TRUE : FALSE);

if(nwrite == LIBSSH2_ERROR_EAGAIN) {
*err = CURLE_AGAIN;
Expand Down Expand Up @@ -3711,7 +3711,7 @@ static ssize_t sftp_recv(struct Curl_easy *data, int sockindex,

nread = libssh2_sftp_read(sshc->sftp_handle, mem, len);

ssh_block2waitfor(data, (nread == LIBSSH2_ERROR_EAGAIN)?TRUE:FALSE);
ssh_block2waitfor(data, (nread == LIBSSH2_ERROR_EAGAIN) ? TRUE : FALSE);

if(nread == LIBSSH2_ERROR_EAGAIN) {
*err = CURLE_AGAIN;
Expand Down
6 changes: 3 additions & 3 deletions lib/vtls/openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -4356,9 +4356,9 @@ static CURLcode ossl_connect_step2(struct Curl_cfilter *cf,
infof(data, "ECH: unexpected status %d",rv);
}
infof(data, "ECH: result: status is %s, inner is %s, outer is %s",
(status?status:"NULL"),
(inner?inner:"NULL"),
(outer?outer:"NULL"));
(status ? status : "NULL"),
(inner ? inner : "NULL"),
(outer ? outer : "NULL"));
OPENSSL_free(inner);
OPENSSL_free(outer);
if(rv == SSL_ECH_STATUS_GREASE_ECH) {
Expand Down
4 changes: 2 additions & 2 deletions lib/vtls/rustls.c
Original file line number Diff line number Diff line change
Expand Up @@ -866,8 +866,8 @@ cr_connect_common(struct Curl_cfilter *cf,
wants_write = rustls_connection_wants_write(rconn) ||
backend->plain_out_buffered;
DEBUGASSERT(wants_read || wants_write);
writefd = wants_write?sockfd:CURL_SOCKET_BAD;
readfd = wants_read?sockfd:CURL_SOCKET_BAD;
writefd = wants_write ? sockfd : CURL_SOCKET_BAD;
readfd = wants_read ? sockfd : CURL_SOCKET_BAD;

/* check allowed time left */
timeout_ms = Curl_timeleft(data, NULL, TRUE);
Expand Down
4 changes: 2 additions & 2 deletions lib/vtls/sectransp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1254,7 +1254,7 @@ static CURLcode sectransp_connect_step1(struct Curl_cfilter *cf,
else {
#if CURL_SUPPORT_MAC_10_8
err = SSLSetEnableCertVerify(backend->ssl_ctx,
conn_config->verifypeer?true:false);
conn_config->verifypeer ? true : false);
if(err != noErr) {
failf(data, "SSL: SSLSetEnableCertVerify() failed: OSStatus %d", err);
return CURLE_SSL_CONNECT_ERROR;
Expand All @@ -1263,7 +1263,7 @@ static CURLcode sectransp_connect_step1(struct Curl_cfilter *cf,
}
#else
err = SSLSetEnableCertVerify(backend->ssl_ctx,
conn_config->verifypeer?true:false);
conn_config->verifypeer ? true : false);
if(err != noErr) {
failf(data, "SSL: SSLSetEnableCertVerify() failed: OSStatus %d", err);
return CURLE_SSL_CONNECT_ERROR;
Expand Down
4 changes: 2 additions & 2 deletions lib/vtls/vtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -1950,7 +1950,7 @@ static CURLcode cf_ssl_create(struct Curl_cfilter **pcf,
out:
if(result)
cf_ctx_free(ctx);
*pcf = result? NULL : cf;
*pcf = result ? NULL : cf;
return result;
}

Expand Down Expand Up @@ -2008,7 +2008,7 @@ static CURLcode cf_ssl_proxy_create(struct Curl_cfilter **pcf,
out:
if(result)
cf_ctx_free(ctx);
*pcf = result? NULL : cf;
*pcf = result ? NULL : cf;
return result;
}

Expand Down
Loading
Loading