src/lib: remove redundant ternary operators

Closes #15435
This commit is contained in:
Daniel Stenberg 2024-10-28 17:26:19 +01:00
parent 080973dcdb
commit cd2b45201a
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
32 changed files with 68 additions and 75 deletions

View File

@ -299,7 +299,7 @@ static CURLcode on_resp_header(struct Curl_cfilter *cf,
(checkprefix("Proxy-authenticate:", header) && (checkprefix("Proxy-authenticate:", header) &&
(407 == k->httpcode))) { (407 == k->httpcode))) {
bool proxy = (k->httpcode == 407) ? TRUE : FALSE; bool proxy = (k->httpcode == 407);
char *auth = Curl_copy_header_value(header); char *auth = Curl_copy_header_value(header);
if(!auth) if(!auth)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;

View File

@ -1643,7 +1643,7 @@ static void cf_socket_active(struct Curl_cfilter *cf, struct Curl_easy *data)
cf->conn->primary = ctx->ip; cf->conn->primary = ctx->ip;
cf->conn->remote_addr = &ctx->addr; cf->conn->remote_addr = &ctx->addr;
#ifdef USE_IPV6 #ifdef USE_IPV6
cf->conn->bits.ipv6 = (ctx->addr.family == AF_INET6) ? TRUE : FALSE; cf->conn->bits.ipv6 = (ctx->addr.family == AF_INET6);
#endif #endif
} }
else { else {
@ -1751,7 +1751,7 @@ static CURLcode cf_socket_query(struct Curl_cfilter *cf,
} }
case CF_QUERY_IP_INFO: case CF_QUERY_IP_INFO:
#ifdef USE_IPV6 #ifdef USE_IPV6
*pres1 = (ctx->addr.family == AF_INET6) ? TRUE : FALSE; *pres1 = (ctx->addr.family == AF_INET6);
#else #else
*pres1 = FALSE; *pres1 = FALSE;
#endif #endif

View File

@ -855,7 +855,7 @@ parse_netscape(struct Cookie *co,
* domain can access the variable. Set TRUE when the cookie says * domain can access the variable. Set TRUE when the cookie says
* .domain.com and to false when the domain is complete www.domain.com * .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");
break; break;
case 2: case 2:
/* The file format allows the path field to remain not filled in */ /* The file format allows the path field to remain not filled in */

View File

@ -2042,10 +2042,10 @@ static CURLcode client_write_header(struct Curl_easy *data,
* headers from CONNECT should not automatically be part of the * headers from CONNECT should not automatically be part of the
* output. */ * output. */
CURLcode result; CURLcode result;
int save = data->set.include_header; bool save = data->set.include_header;
data->set.include_header = TRUE; data->set.include_header = TRUE;
result = Curl_client_write(data, CLIENTWRITE_HEADER, buf, blen); result = Curl_client_write(data, CLIENTWRITE_HEADER, buf, blen);
data->set.include_header = save ? TRUE : FALSE; data->set.include_header = save;
return result; return result;
} }
@ -2793,7 +2793,7 @@ static CURLcode ftp_statemachine(struct Curl_easy *data,
if(ftpcode/100 == 2) if(ftpcode/100 == 2)
/* We have enabled SSL for the data connection! */ /* We have enabled SSL for the data connection! */
conn->bits.ftp_use_data_ssl = conn->bits.ftp_use_data_ssl =
(data->set.use_ssl != CURLUSESSL_CONTROL) ? TRUE : FALSE; (data->set.use_ssl != CURLUSESSL_CONTROL);
/* FTP servers typically responds with 500 if they decide to reject /* FTP servers typically responds with 500 if they decide to reject
our 'P' request */ our 'P' request */
else if(data->set.use_ssl > CURLUSESSL_CONTROL) else if(data->set.use_ssl > CURLUSESSL_CONTROL)
@ -3110,7 +3110,7 @@ static CURLcode ftp_multi_statemach(struct Curl_easy *data,
/* Check for the state outside of the Curl_socket_check() return code checks /* Check for the state outside of the Curl_socket_check() return code checks
since at times we are in fact already in this state when this function since at times we are in fact already in this state when this function
gets called. */ gets called. */
*done = (ftpc->state == FTP_STOP) ? TRUE : FALSE; *done = (ftpc->state == FTP_STOP);
return result; return result;
} }

View File

@ -630,7 +630,7 @@ bool Curl_ipv6works(struct Curl_easy *data)
ipv6_works = 1; ipv6_works = 1;
sclose(s); sclose(s);
} }
return (ipv6_works > 0) ? TRUE : FALSE; return (ipv6_works > 0);
} }
} }
#endif /* USE_IPV6 */ #endif /* USE_IPV6 */

View File

@ -677,7 +677,7 @@ output_auth_headers(struct Curl_easy *data,
auth, data->state.aptr.user ? auth, data->state.aptr.user ?
data->state.aptr.user : ""); data->state.aptr.user : "");
#endif #endif
authstatus->multipass = (!authstatus->done) ? TRUE : FALSE; authstatus->multipass = !authstatus->done;
} }
else else
authstatus->multipass = FALSE; authstatus->multipass = FALSE;
@ -2259,7 +2259,7 @@ CURLcode Curl_http_cookies(struct Curl_easy *data,
conn->handler->protocol&(CURLPROTO_HTTPS|CURLPROTO_WSS) || conn->handler->protocol&(CURLPROTO_HTTPS|CURLPROTO_WSS) ||
strcasecompare("localhost", host) || strcasecompare("localhost", host) ||
!strcmp(host, "127.0.0.1") || !strcmp(host, "127.0.0.1") ||
!strcmp(host, "::1") ? TRUE : FALSE; !strcmp(host, "::1");
Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE); Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE);
rc = Curl_cookie_getlist(data, data->cookies, host, data->state.up.path, rc = Curl_cookie_getlist(data, data->cookies, host, data->state.up.path,
secure_context, &list); secure_context, &list);
@ -3041,8 +3041,7 @@ CURLcode Curl_http_header(struct Curl_easy *data,
char *persistentauth = Curl_copy_header_value(hd); char *persistentauth = Curl_copy_header_value(hd);
if(!persistentauth) if(!persistentauth)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
negdata->noauthpersist = checkprefix("false", persistentauth) ? negdata->noauthpersist = !!checkprefix("false", persistentauth);
TRUE : FALSE;
negdata->havenoauthpersist = TRUE; negdata->havenoauthpersist = TRUE;
infof(data, "Negotiate: noauthpersist -> %d, header part: %s", infof(data, "Negotiate: noauthpersist -> %d, header part: %s",
negdata->noauthpersist, persistentauth); negdata->noauthpersist, persistentauth);
@ -3083,7 +3082,7 @@ CURLcode Curl_http_header(struct Curl_easy *data,
conn->handler->protocol&(CURLPROTO_HTTPS|CURLPROTO_WSS) || conn->handler->protocol&(CURLPROTO_HTTPS|CURLPROTO_WSS) ||
strcasecompare("localhost", host) || strcasecompare("localhost", host) ||
!strcmp(host, "127.0.0.1") || !strcmp(host, "127.0.0.1") ||
!strcmp(host, "::1") ? TRUE : FALSE; !strcmp(host, "::1");
Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, Curl_share_lock(data, CURL_LOCK_DATA_COOKIE,
CURL_LOCK_ACCESS_SINGLE); CURL_LOCK_ACCESS_SINGLE);
@ -4544,7 +4543,7 @@ static void http_exp100_send_anyway(struct Curl_easy *data)
bool Curl_http_exp100_is_selected(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); struct Curl_creader *r = Curl_creader_get_by_type(data, &cr_exp100);
return r ? TRUE : FALSE; return !!r;
} }
#endif /* CURL_DISABLE_HTTP */ #endif /* CURL_DISABLE_HTTP */

View File

@ -121,9 +121,9 @@ CURLcode Curl_output_digest(struct Curl_easy *data,
passwdp = ""; passwdp = "";
#if defined(USE_WINDOWS_SSPI) #if defined(USE_WINDOWS_SSPI)
have_chlg = digest->input_token ? TRUE : FALSE; have_chlg = !!digest->input_token;
#else #else
have_chlg = digest->nonce ? TRUE : FALSE; have_chlg = !!digest->nonce;
#endif #endif
if(!have_chlg) { if(!have_chlg) {

View File

@ -1399,7 +1399,7 @@ static CURLcode imap_multi_statemach(struct Curl_easy *data, bool *done)
} }
result = Curl_pp_statemach(data, &imapc->pp, FALSE, FALSE); result = Curl_pp_statemach(data, &imapc->pp, FALSE, FALSE);
*done = (imapc->state == IMAP_STOP) ? TRUE : FALSE; *done = (imapc->state == IMAP_STOP);
return result; return result;
} }

View File

@ -623,7 +623,7 @@ static void do_sec_send(struct Curl_easy *data, struct connectdata *conn,
size_t cmd_size = 0; size_t cmd_size = 0;
CURLcode error; CURLcode error;
enum protection_level prot_level = conn->data_prot; enum protection_level prot_level = conn->data_prot;
bool iscmd = (prot_level == PROT_CMD) ? TRUE : FALSE; bool iscmd = (prot_level == PROT_CMD);
DEBUGASSERT(prot_level > PROT_NONE && prot_level < PROT_LAST); DEBUGASSERT(prot_level > PROT_NONE && prot_level < PROT_LAST);

View File

@ -801,7 +801,7 @@ CURLMcode curl_multi_remove_handle(CURLM *m, CURL *d)
if(multi->in_callback) if(multi->in_callback)
return CURLM_RECURSIVE_API_CALL; return CURLM_RECURSIVE_API_CALL;
premature = (data->mstate < MSTATE_COMPLETED) ? TRUE : FALSE; premature = (data->mstate < MSTATE_COMPLETED);
/* If the 'state' is not INIT or COMPLETED, we might need to do something /* If the 'state' is not INIT or COMPLETED, we might need to do something
nice to put the easy_handle in a good known state when this returns. */ nice to put the easy_handle in a good known state when this returns. */
@ -2161,7 +2161,7 @@ static CURLMcode state_performing(struct Curl_easy *data,
*/ */
CURLcode ret = Curl_retry_request(data, &newurl); CURLcode ret = Curl_retry_request(data, &newurl);
if(!ret) if(!ret)
retry = (newurl) ? TRUE : FALSE; retry = !!newurl;
else if(!result) else if(!result)
result = ret; result = ret;

View File

@ -1119,7 +1119,7 @@ static CURLcode pop3_multi_statemach(struct Curl_easy *data, bool *done)
} }
result = Curl_pp_statemach(data, &pop3c->pp, FALSE, FALSE); result = Curl_pp_statemach(data, &pop3c->pp, FALSE, FALSE);
*done = (pop3c->state == POP3_STOP) ? TRUE : FALSE; *done = (pop3c->state == POP3_STOP);
return result; return result;
} }

View File

@ -1100,12 +1100,11 @@ static CURLcode smtp_state_rcpt_resp(struct Curl_easy *data,
(void)instate; /* no use for this yet */ (void)instate; /* no use for this yet */
is_smtp_err = (smtpcode/100 != 2) ? TRUE : FALSE; is_smtp_err = (smtpcode/100 != 2);
/* If there is multiple RCPT TO to be issued, it is possible to ignore errors /* If there is multiple RCPT TO to be issued, it is possible to ignore errors
and proceed with only the valid addresses. */ and proceed with only the valid addresses. */
is_smtp_blocking_err = is_smtp_blocking_err = (is_smtp_err && !data->set.mail_rcpt_allowfails);
(is_smtp_err && !data->set.mail_rcpt_allowfails) ? TRUE : FALSE;
if(is_smtp_err) { if(is_smtp_err) {
/* Remembering the last failure which we can report if all "RCPT TO" have /* Remembering the last failure which we can report if all "RCPT TO" have
@ -1296,7 +1295,7 @@ static CURLcode smtp_multi_statemach(struct Curl_easy *data, bool *done)
} }
result = Curl_pp_statemach(data, &smtpc->pp, FALSE, FALSE); result = Curl_pp_statemach(data, &smtpc->pp, FALSE, FALSE);
*done = (smtpc->state == SMTP_STOP) ? TRUE : FALSE; *done = (smtpc->state == SMTP_STOP);
return result; return result;
} }

View File

@ -286,7 +286,7 @@ static CURLproxycode do_SOCKS4(struct Curl_cfilter *cf,
{ {
struct connectdata *conn = cf->conn; struct connectdata *conn = cf->conn;
const bool protocol4a = const bool protocol4a =
(conn->socks_proxy.proxytype == CURLPROXY_SOCKS4A) ? TRUE : FALSE; (conn->socks_proxy.proxytype == CURLPROXY_SOCKS4A);
unsigned char *socksreq = sx->buffer; unsigned char *socksreq = sx->buffer;
CURLcode result; CURLcode result;
CURLproxycode presult; CURLproxycode presult;
@ -583,7 +583,7 @@ static CURLproxycode do_SOCKS5(struct Curl_cfilter *cf,
CURLcode result; CURLcode result;
CURLproxycode presult; CURLproxycode presult;
bool socks5_resolve_local = bool socks5_resolve_local =
(conn->socks_proxy.proxytype == CURLPROXY_SOCKS5) ? TRUE : FALSE; (conn->socks_proxy.proxytype == CURLPROXY_SOCKS5);
const size_t hostname_len = strlen(sx->hostname); const size_t hostname_len = strlen(sx->hostname);
size_t len = 0; size_t len = 0;
const unsigned char auth = data->set.socks5auth; const unsigned char auth = data->set.socks5auth;

View File

@ -205,7 +205,7 @@ static CURLcode tftp_set_timeouts(struct tftp_state_data *state)
{ {
time_t maxtime, timeout; time_t maxtime, timeout;
timediff_t timeout_ms; timediff_t timeout_ms;
bool start = (state->state == TFTP_STATE_START) ? TRUE : FALSE; bool start = (state->state == TFTP_STATE_START);
/* Compute drop-dead time */ /* Compute drop-dead time */
timeout_ms = Curl_timeleft(state->data, NULL, start); timeout_ms = Curl_timeleft(state->data, NULL, start);
@ -1232,7 +1232,7 @@ static CURLcode tftp_multi_statemach(struct Curl_easy *data, bool *done)
result = tftp_state_machine(state, event); result = tftp_state_machine(state, event);
if(result) if(result)
return result; return result;
*done = (state->state == TFTP_STATE_FIN) ? TRUE : FALSE; *done = (state->state == TFTP_STATE_FIN);
if(*done) if(*done)
/* Tell curl we are done */ /* Tell curl we are done */
Curl_xfer_setup_nop(data); Curl_xfer_setup_nop(data);
@ -1255,7 +1255,7 @@ static CURLcode tftp_multi_statemach(struct Curl_easy *data, bool *done)
result = tftp_state_machine(state, state->event); result = tftp_state_machine(state, state->event);
if(result) if(result)
return result; return result;
*done = (state->state == TFTP_STATE_FIN) ? TRUE : FALSE; *done = (state->state == TFTP_STATE_FIN);
if(*done) if(*done)
/* Tell curl we are done */ /* Tell curl we are done */
Curl_xfer_setup_nop(data); Curl_xfer_setup_nop(data);

View File

@ -1343,22 +1343,19 @@ static struct connectdata *allocate_conn(struct Curl_easy *data)
/* note that these two proxy bits are now just on what looks to be /* note that these two proxy bits are now just on what looks to be
requested, they may be altered down the road */ requested, they may be altered down the road */
conn->bits.proxy = (data->set.str[STRING_PROXY] && conn->bits.proxy = (data->set.str[STRING_PROXY] &&
*data->set.str[STRING_PROXY]) ? TRUE : FALSE; *data->set.str[STRING_PROXY]);
conn->bits.httpproxy = (conn->bits.proxy && conn->bits.httpproxy = (conn->bits.proxy &&
(conn->http_proxy.proxytype == CURLPROXY_HTTP || (conn->http_proxy.proxytype == CURLPROXY_HTTP ||
conn->http_proxy.proxytype == CURLPROXY_HTTP_1_0 || conn->http_proxy.proxytype == CURLPROXY_HTTP_1_0 ||
IS_HTTPS_PROXY(conn->http_proxy.proxytype))) ? IS_HTTPS_PROXY(conn->http_proxy.proxytype)));
TRUE : FALSE; conn->bits.socksproxy = (conn->bits.proxy && !conn->bits.httpproxy);
conn->bits.socksproxy = (conn->bits.proxy &&
!conn->bits.httpproxy) ? TRUE : FALSE;
if(data->set.str[STRING_PRE_PROXY] && *data->set.str[STRING_PRE_PROXY]) { if(data->set.str[STRING_PRE_PROXY] && *data->set.str[STRING_PRE_PROXY]) {
conn->bits.proxy = TRUE; conn->bits.proxy = TRUE;
conn->bits.socksproxy = TRUE; conn->bits.socksproxy = TRUE;
} }
conn->bits.proxy_user_passwd = conn->bits.proxy_user_passwd = !!data->state.aptr.proxyuser;
(data->state.aptr.proxyuser) ? TRUE : FALSE;
conn->bits.tunnel_proxy = data->set.tunnel_thru_httpproxy; conn->bits.tunnel_proxy = data->set.tunnel_thru_httpproxy;
#endif /* CURL_DISABLE_PROXY */ #endif /* CURL_DISABLE_PROXY */
@ -1961,11 +1958,11 @@ static CURLcode setup_range(struct Curl_easy *data)
else else
s->range = strdup(data->set.str[STRING_SET_RANGE]); s->range = strdup(data->set.str[STRING_SET_RANGE]);
s->rangestringalloc = (s->range) ? TRUE : FALSE;
if(!s->range) if(!s->range)
return CURLE_OUT_OF_MEMORY; return CURLE_OUT_OF_MEMORY;
s->rangestringalloc = TRUE;
/* tell ourselves to fetch this range */ /* tell ourselves to fetch this range */
s->use_range = TRUE; /* enable range download */ s->use_range = TRUE; /* enable range download */
} }

View File

@ -69,7 +69,7 @@ bool Curl_auth_is_digest_supported(void)
Curl_pSecFn->FreeContextBuffer(SecurityPackage); Curl_pSecFn->FreeContextBuffer(SecurityPackage);
} }
return (status == SEC_E_OK ? TRUE : FALSE); return (status == SEC_E_OK);
} }
/* /*

View File

@ -64,7 +64,7 @@ bool Curl_auth_is_gssapi_supported(void)
Curl_pSecFn->FreeContextBuffer(SecurityPackage); Curl_pSecFn->FreeContextBuffer(SecurityPackage);
} }
return (status == SEC_E_OK ? TRUE : FALSE); return (status == SEC_E_OK);
} }
/* /*

View File

@ -485,7 +485,7 @@ CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data,
unsigned char ntresp[24]; /* fixed-size */ unsigned char ntresp[24]; /* fixed-size */
unsigned char *ptr_ntresp = &ntresp[0]; unsigned char *ptr_ntresp = &ntresp[0];
unsigned char *ntlmv2resp = NULL; unsigned char *ntlmv2resp = NULL;
bool unicode = (ntlm->flags & NTLMFLAG_NEGOTIATE_UNICODE) ? TRUE : FALSE; bool unicode = (ntlm->flags & NTLMFLAG_NEGOTIATE_UNICODE);
/* The fixed hostname we provide, in order to not leak our real local host /* The fixed hostname we provide, in order to not leak our real local host
name. Copy the name used by Firefox. */ name. Copy the name used by Firefox. */
static const char host[] = "WORKSTATION"; static const char host[] = "WORKSTATION";

View File

@ -63,7 +63,7 @@ bool Curl_auth_is_ntlm_supported(void)
Curl_pSecFn->FreeContextBuffer(SecurityPackage); Curl_pSecFn->FreeContextBuffer(SecurityPackage);
} }
return (status == SEC_E_OK ? TRUE : FALSE); return (status == SEC_E_OK);
} }
/* /*

View File

@ -67,7 +67,7 @@ bool Curl_auth_is_spnego_supported(void)
} }
return (status == SEC_E_OK ? TRUE : FALSE); return (status == SEC_E_OK);
} }
/* /*

View File

@ -134,8 +134,7 @@ bool Curl_auth_user_contains_domain(const char *user)
/* Check we have a domain name or UPN present */ /* Check we have a domain name or UPN present */
char *p = strpbrk(user, "\\/@"); char *p = strpbrk(user, "\\/@");
valid = (p != NULL && p > user && p < user + strlen(user) - 1 ? TRUE : valid = (p != NULL && p > user && p < user + strlen(user) - 1);
FALSE);
} }
#if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI) #if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
else else

View File

@ -695,7 +695,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
case SSH_S_STARTUP: case SSH_S_STARTUP:
rc = ssh_connect(sshc->ssh_session); rc = ssh_connect(sshc->ssh_session);
myssh_block2waitfor(conn, (rc == SSH_AGAIN) ? TRUE : FALSE); myssh_block2waitfor(conn, (rc == SSH_AGAIN));
if(rc == SSH_AGAIN) { if(rc == SSH_AGAIN) {
DEBUGF(infof(data, "ssh_connect -> EAGAIN")); DEBUGF(infof(data, "ssh_connect -> EAGAIN"));
break; break;
@ -2085,7 +2085,7 @@ static CURLcode myssh_multi_statemach(struct Curl_easy *data,
implementation */ implementation */
CURLcode result = myssh_statemach_act(data, &block); CURLcode result = myssh_statemach_act(data, &block);
*done = (sshc->state == SSH_STOP) ? TRUE : FALSE; *done = (sshc->state == SSH_STOP);
myssh_block2waitfor(conn, block); myssh_block2waitfor(conn, block);
return result; return result;
@ -2415,7 +2415,7 @@ static ssize_t scp_send(struct Curl_easy *data, int sockindex,
/* The following code is misleading, mostly added as wishful thinking /* The following code is misleading, mostly added as wishful thinking
* that libssh at some point will implement non-blocking ssh_scp_write/read. * that libssh at some point will implement non-blocking ssh_scp_write/read.
* Currently rc can only be number of bytes read or SSH_ERROR. */ * Currently rc can only be number of bytes read or SSH_ERROR. */
myssh_block2waitfor(conn, (rc == SSH_AGAIN) ? TRUE : FALSE); myssh_block2waitfor(conn, (rc == SSH_AGAIN));
if(rc == SSH_AGAIN) { if(rc == SSH_AGAIN) {
*err = CURLE_AGAIN; *err = CURLE_AGAIN;
@ -2447,7 +2447,7 @@ static ssize_t scp_recv(struct Curl_easy *data, int sockindex,
* that libssh at some point will implement non-blocking ssh_scp_write/read. * that libssh at some point will implement non-blocking ssh_scp_write/read.
* Currently rc can only be SSH_OK or SSH_ERROR. */ * Currently rc can only be SSH_OK or SSH_ERROR. */
myssh_block2waitfor(conn, (nread == SSH_AGAIN) ? TRUE : FALSE); myssh_block2waitfor(conn, (nread == SSH_AGAIN));
if(nread == SSH_AGAIN) { if(nread == SSH_AGAIN) {
*err = CURLE_AGAIN; *err = CURLE_AGAIN;
nread = -1; nread = -1;
@ -2614,7 +2614,7 @@ static ssize_t sftp_recv(struct Curl_easy *data, int sockindex,
mem, (uint32_t)len, mem, (uint32_t)len,
(uint32_t)conn->proto.sshc.sftp_file_index); (uint32_t)conn->proto.sshc.sftp_file_index);
myssh_block2waitfor(conn, (nread == SSH_AGAIN) ? TRUE : FALSE); myssh_block2waitfor(conn, (nread == SSH_AGAIN));
if(nread == SSH_AGAIN) { if(nread == SSH_AGAIN) {
*err = CURLE_AGAIN; *err = CURLE_AGAIN;

View File

@ -3067,7 +3067,7 @@ static CURLcode ssh_multi_statemach(struct Curl_easy *data, bool *done)
implementation */ implementation */
do { do {
result = ssh_statemachine(data, &block); result = ssh_statemachine(data, &block);
*done = (sshc->state == SSH_STOP) ? TRUE : FALSE; *done = (sshc->state == SSH_STOP);
/* if there is no error, it is not done and it did not EWOULDBLOCK, then /* if there is no error, it is not done and it did not EWOULDBLOCK, then
try again */ try again */
} while(!result && !*done && !block); } while(!result && !*done && !block);
@ -3512,7 +3512,7 @@ static ssize_t scp_send(struct Curl_easy *data, int sockindex,
/* libssh2_channel_write() returns int! */ /* libssh2_channel_write() returns int! */
nwrite = (ssize_t) libssh2_channel_write(sshc->ssh_channel, mem, len); 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));
if(nwrite == LIBSSH2_ERROR_EAGAIN) { if(nwrite == LIBSSH2_ERROR_EAGAIN) {
*err = CURLE_AGAIN; *err = CURLE_AGAIN;
@ -3537,7 +3537,7 @@ static ssize_t scp_recv(struct Curl_easy *data, int sockindex,
/* libssh2_channel_read() returns int */ /* libssh2_channel_read() returns int */
nread = (ssize_t) libssh2_channel_read(sshc->ssh_channel, mem, len); 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));
if(nread == LIBSSH2_ERROR_EAGAIN) { if(nread == LIBSSH2_ERROR_EAGAIN) {
*err = CURLE_AGAIN; *err = CURLE_AGAIN;
nread = -1; nread = -1;
@ -3650,7 +3650,7 @@ static ssize_t sftp_send(struct Curl_easy *data, int sockindex,
nwrite = libssh2_sftp_write(sshc->sftp_handle, mem, len); 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));
if(nwrite == LIBSSH2_ERROR_EAGAIN) { if(nwrite == LIBSSH2_ERROR_EAGAIN) {
*err = CURLE_AGAIN; *err = CURLE_AGAIN;
@ -3678,7 +3678,7 @@ static ssize_t sftp_recv(struct Curl_easy *data, int sockindex,
nread = libssh2_sftp_read(sshc->sftp_handle, mem, len); 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));
if(nread == LIBSSH2_ERROR_EAGAIN) { if(nread == LIBSSH2_ERROR_EAGAIN) {
*err = CURLE_AGAIN; *err = CURLE_AGAIN;

View File

@ -908,7 +908,7 @@ static CURLcode wssh_multi_statemach(struct Curl_easy *data, bool *done)
implementation */ implementation */
do { do {
result = wssh_statemach_act(data, &block); result = wssh_statemach_act(data, &block);
*done = (sshc->state == SSH_STOP) ? TRUE : FALSE; *done = (sshc->state == SSH_STOP);
/* if there is no error, it is not done and it did not EWOULDBLOCK, then /* if there is no error, it is not done and it did not EWOULDBLOCK, then
try again */ try again */
if(*done) { if(*done) {

View File

@ -1015,7 +1015,7 @@ static int passwd_callback(char *buf, int num, int encrypting,
*/ */
static bool rand_enough(void) static bool rand_enough(void)
{ {
return (0 != RAND_status()) ? TRUE : FALSE; return (0 != RAND_status());
} }
static CURLcode ossl_seed(struct Curl_easy *data) static CURLcode ossl_seed(struct Curl_easy *data)

View File

@ -2053,7 +2053,7 @@ CURLcode Curl_cf_ssl_proxy_insert_after(struct Curl_cfilter *cf_at,
bool Curl_ssl_supports(struct Curl_easy *data, unsigned int ssl_option) bool Curl_ssl_supports(struct Curl_easy *data, unsigned int ssl_option)
{ {
(void)data; (void)data;
return (Curl_ssl->supports & ssl_option) ? TRUE : FALSE; return (Curl_ssl->supports & ssl_option);
} }
static struct Curl_cfilter *get_ssl_filter(struct Curl_cfilter *cf) static struct Curl_cfilter *get_ssl_filter(struct Curl_cfilter *cf)

View File

@ -1799,7 +1799,7 @@ static bool wolfssl_data_pending(struct Curl_cfilter *cf,
backend = (struct wolfssl_ctx *)ctx->backend; backend = (struct wolfssl_ctx *)ctx->backend;
if(backend->handle) /* SSL is in use */ if(backend->handle) /* SSL is in use */
return (0 != wolfSSL_pending(backend->handle)) ? TRUE : FALSE; return wolfSSL_pending(backend->handle);
else else
return FALSE; return FALSE;
} }

View File

@ -173,7 +173,7 @@ int tool_debug_cb(CURL *handle, curl_infotype type,
log_line_start(output, timebuf, idsbuf, type); log_line_start(output, timebuf, idsbuf, type);
(void)fwrite(data + st, i - st + 1, 1, output); (void)fwrite(data + st, i - st + 1, 1, output);
} }
newl = (size && (data[size - 1] != '\n')) ? TRUE : FALSE; newl = (size && (data[size - 1] != '\n'));
traced_data = FALSE; traced_data = FALSE;
break; break;
case CURLINFO_TEXT: case CURLINFO_TEXT:
@ -181,7 +181,7 @@ int tool_debug_cb(CURL *handle, curl_infotype type,
if(!newl) if(!newl)
log_line_start(output, timebuf, idsbuf, type); log_line_start(output, timebuf, idsbuf, type);
(void)fwrite(data, size, 1, output); (void)fwrite(data, size, 1, output);
newl = (size && (data[size - 1] != '\n')) ? TRUE : FALSE; newl = (size && (data[size - 1] != '\n'));
traced_data = FALSE; traced_data = FALSE;
break; break;
case CURLINFO_DATA_OUT: case CURLINFO_DATA_OUT:

View File

@ -1218,7 +1218,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
config->disallow_username_in_url = toggle; config->disallow_username_in_url = toggle;
break; break;
case C_EPSV: /* --epsv */ case C_EPSV: /* --epsv */
config->disable_epsv = (!toggle) ? TRUE : FALSE; config->disable_epsv = !toggle;
break; break;
case C_DNS_SERVERS: /* --dns-servers */ case C_DNS_SERVERS: /* --dns-servers */
if(!curlinfo->ares_num) /* c-ares is needed for this */ if(!curlinfo->ares_num) /* c-ares is needed for this */
@ -1248,7 +1248,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
} }
break; break;
case C_ALPN: /* --alpn */ case C_ALPN: /* --alpn */
config->noalpn = (!toggle) ? TRUE : FALSE; config->noalpn = !toggle;
break; break;
case C_LIMIT_RATE: /* --limit-rate */ case C_LIMIT_RATE: /* --limit-rate */
err = GetSizeParameter(global, nextarg, "rate", &value); err = GetSizeParameter(global, nextarg, "rate", &value);
@ -1371,7 +1371,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
config->disable_eprt = toggle; config->disable_eprt = toggle;
break; break;
case C_EPRT: /* --eprt */ case C_EPRT: /* --eprt */
config->disable_eprt = (!toggle) ? TRUE : FALSE; config->disable_eprt = !toggle;
break; break;
case C_XATTR: /* --xattr */ case C_XATTR: /* --xattr */
config->xattr = toggle; config->xattr = toggle;
@ -1552,7 +1552,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
config->ftp_ssl_reqd = toggle; config->ftp_ssl_reqd = toggle;
break; break;
case C_SESSIONID: /* --sessionid */ case C_SESSIONID: /* --sessionid */
config->disable_sessionid = (!toggle) ? TRUE : FALSE; config->disable_sessionid = !toggle;
break; break;
case C_FTP_SSL_CONTROL: /* --ftp-ssl-control */ case C_FTP_SSL_CONTROL: /* --ftp-ssl-control */
if(toggle && !feature_ssl) if(toggle && !feature_ssl)
@ -1582,7 +1582,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
config->raw = toggle; config->raw = toggle;
break; break;
case C_KEEPALIVE: /* --keepalive */ case C_KEEPALIVE: /* --keepalive */
config->nokeepalive = (!toggle) ? TRUE : FALSE; config->nokeepalive = !toggle;
break; break;
case C_KEEPALIVE_TIME: /* --keepalive-time */ case C_KEEPALIVE_TIME: /* --keepalive-time */
err = str2unum(&config->alivetime, nextarg); err = str2unum(&config->alivetime, nextarg);
@ -2167,7 +2167,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
nextarg, nextarg,
&config->mimeroot, &config->mimeroot,
&config->mimecurrent, &config->mimecurrent,
(cmd == C_FORM_STRING) ? TRUE : FALSE)) /* literal string */ (cmd == C_FORM_STRING))) /* literal string */
err = PARAM_BAD_USE; err = PARAM_BAD_USE;
else if(SetHTTPrequest(config, TOOL_HTTPREQ_MIMEPOST, &config->httpreq)) else if(SetHTTPrequest(config, TOOL_HTTPREQ_MIMEPOST, &config->httpreq))
err = PARAM_BAD_USE; err = PARAM_BAD_USE;

View File

@ -2456,7 +2456,7 @@ static CURLcode add_parallel_transfers(struct GlobalConfig *global,
all_added++; all_added++;
*addedp = TRUE; *addedp = TRUE;
} }
*morep = (per || sleeping) ? TRUE : FALSE; *morep = (per || sleeping);
return CURLE_OK; return CURLE_OK;
} }

View File

@ -66,8 +66,7 @@ bool output_expected(const char *url, const char *uploadfile)
bool stdin_upload(const char *uploadfile) bool stdin_upload(const char *uploadfile)
{ {
return (!strcmp(uploadfile, "-") || return (!strcmp(uploadfile, "-") || !strcmp(uploadfile, "."));
!strcmp(uploadfile, ".")) ? TRUE : FALSE;
} }
/* Convert a CURLUcode into a CURLcode */ /* Convert a CURLUcode into a CURLcode */

View File

@ -126,7 +126,7 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
option = line; option = line;
/* the option starts with a dash? */ /* the option starts with a dash? */
dashed_option = (option[0] == '-') ? TRUE : FALSE; dashed_option = (option[0] == '-');
while(*line && !ISSPACE(*line) && !ISSEP(*line, dashed_option)) while(*line && !ISSPACE(*line) && !ISSEP(*line, dashed_option))
line++; line++;
@ -311,7 +311,7 @@ static bool my_get_line(FILE *fp, struct curlx_dynbuf *db,
occurs while no characters have been read. */ occurs while no characters have been read. */
if(!fgets(buf, sizeof(buf), fp)) if(!fgets(buf, sizeof(buf), fp))
/* only if there is data in the line, return TRUE */ /* only if there is data in the line, return TRUE */
return curlx_dyn_len(db) ? TRUE : FALSE; return curlx_dyn_len(db);
if(curlx_dyn_add(db, buf)) { if(curlx_dyn_add(db, buf)) {
*error = TRUE; /* error */ *error = TRUE; /* error */
return FALSE; /* stop reading */ return FALSE; /* stop reading */