]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
src/lib: remove redundant ternary operators
authorDaniel Stenberg <daniel@haxx.se>
Mon, 28 Oct 2024 16:26:19 +0000 (17:26 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 29 Oct 2024 07:18:30 +0000 (08:18 +0100)
Closes #15435

32 files changed:
lib/cf-h1-proxy.c
lib/cf-socket.c
lib/cookie.c
lib/ftp.c
lib/hostip.c
lib/http.c
lib/http_digest.c
lib/imap.c
lib/krb5.c
lib/multi.c
lib/pop3.c
lib/smtp.c
lib/socks.c
lib/tftp.c
lib/url.c
lib/vauth/digest_sspi.c
lib/vauth/krb5_sspi.c
lib/vauth/ntlm.c
lib/vauth/ntlm_sspi.c
lib/vauth/spnego_sspi.c
lib/vauth/vauth.c
lib/vssh/libssh.c
lib/vssh/libssh2.c
lib/vssh/wolfssh.c
lib/vtls/openssl.c
lib/vtls/vtls.c
lib/vtls/wolfssl.c
src/tool_cb_dbg.c
src/tool_getparam.c
src/tool_operate.c
src/tool_operhlp.c
src/tool_parsecfg.c

index a9fd21fa4d6b8ca652ad4ea2c4cdfb616167769e..6b7f9831bcb0a0e1b2b560af3f5dade3c24c7c07 100644 (file)
@@ -299,7 +299,7 @@ static CURLcode on_resp_header(struct Curl_cfilter *cf,
      (checkprefix("Proxy-authenticate:", header) &&
       (407 == k->httpcode))) {
 
-    bool proxy = (k->httpcode == 407) ? TRUE : FALSE;
+    bool proxy = (k->httpcode == 407);
     char *auth = Curl_copy_header_value(header);
     if(!auth)
       return CURLE_OUT_OF_MEMORY;
index a3e3d5269736be9568a291ab72673cadd1aefd47..b4840f7ebc5607b0dbc0b8960f6d9b51f898229a 100644 (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->remote_addr = &ctx->addr;
   #ifdef USE_IPV6
-    cf->conn->bits.ipv6 = (ctx->addr.family == AF_INET6) ? TRUE : FALSE;
+    cf->conn->bits.ipv6 = (ctx->addr.family == AF_INET6);
   #endif
   }
   else {
@@ -1751,7 +1751,7 @@ static CURLcode cf_socket_query(struct Curl_cfilter *cf,
   }
   case CF_QUERY_IP_INFO:
 #ifdef USE_IPV6
-    *pres1 = (ctx->addr.family == AF_INET6) ? TRUE : FALSE;
+    *pres1 = (ctx->addr.family == AF_INET6);
 #else
     *pres1 = FALSE;
 #endif
index 34e4292d17397b1ae5dad801772f33a0b3a90e2d..ca8c3c5967ee1d3c1397be3abeb078d168ff67ea 100644 (file)
@@ -855,7 +855,7 @@ parse_netscape(struct Cookie *co,
        * 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");
       break;
     case 2:
       /* The file format allows the path field to remain not filled in */
index 49b490b1ae230773990bf46a3c88a1fb1039e4b3..16ab0af0de15ba6dd81f20ebaf4fab3dabb76f77 100644 (file)
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -2042,10 +2042,10 @@ static CURLcode client_write_header(struct Curl_easy *data,
    * headers from CONNECT should not automatically be part of the
    * output. */
   CURLcode result;
-  int save = data->set.include_header;
+  bool 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;
   return result;
 }
 
@@ -2793,7 +2793,7 @@ static CURLcode ftp_statemachine(struct Curl_easy *data,
       if(ftpcode/100 == 2)
         /* We have enabled SSL for the data connection! */
         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
          our 'P' request */
       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
      since at times we are in fact already in this state when this function
      gets called. */
-  *done = (ftpc->state == FTP_STOP) ? TRUE : FALSE;
+  *done = (ftpc->state == FTP_STOP);
 
   return result;
 }
index fae5541921fce11af736d06c651ef81d4b4e2fc7..fe8cc5cb97fd48652f7ff741cc58663d7b0bdf57 100644 (file)
@@ -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);
   }
 }
 #endif /* USE_IPV6 */
index 5f5ea2047217c89631bd203e90b4993f1aa4e48b..a94edd61c23ec311a9551535ca023243ebab0d6a 100644 (file)
@@ -677,7 +677,7 @@ output_auth_headers(struct Curl_easy *data,
           auth, data->state.aptr.user ?
           data->state.aptr.user : "");
 #endif
-    authstatus->multipass = (!authstatus->done) ? TRUE : FALSE;
+    authstatus->multipass = !authstatus->done;
   }
   else
     authstatus->multipass = FALSE;
@@ -2259,7 +2259,7 @@ CURLcode Curl_http_cookies(struct Curl_easy *data,
         conn->handler->protocol&(CURLPROTO_HTTPS|CURLPROTO_WSS) ||
         strcasecompare("localhost", host) ||
         !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);
       rc = Curl_cookie_getlist(data, data->cookies, host, data->state.up.path,
                                secure_context, &list);
@@ -3041,8 +3041,7 @@ 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);
         negdata->havenoauthpersist = TRUE;
         infof(data, "Negotiate: noauthpersist -> %d, header part: %s",
               negdata->noauthpersist, persistentauth);
@@ -3083,7 +3082,7 @@ CURLcode Curl_http_header(struct Curl_easy *data,
         conn->handler->protocol&(CURLPROTO_HTTPS|CURLPROTO_WSS) ||
         strcasecompare("localhost", host) ||
         !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);
@@ -4544,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;
 }
 
 #endif /* CURL_DISABLE_HTTP */
index 2db3125a8e665623b683ad1f8b7939775eda9515..a3ba17a51fa1b221128ba5c203f7c80436f4deee 100644 (file)
@@ -121,9 +121,9 @@ CURLcode Curl_output_digest(struct Curl_easy *data,
     passwdp = "";
 
 #if defined(USE_WINDOWS_SSPI)
-  have_chlg = digest->input_token ? TRUE : FALSE;
+  have_chlg = !!digest->input_token;
 #else
-  have_chlg = digest->nonce ? TRUE : FALSE;
+  have_chlg = !!digest->nonce;
 #endif
 
   if(!have_chlg) {
index 77e527aaf195ca5763051a4206d7e39e7074ccd7..e424cdb056a40f00d0019f06fd3989af474f62bd 100644 (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);
-  *done = (imapc->state == IMAP_STOP) ? TRUE : FALSE;
+  *done = (imapc->state == IMAP_STOP);
 
   return result;
 }
index d586498640f5056d0cbb3fd2667a2b5662bbf564..c953da6050a0596058b1e2fe3f7cc93a807fdfeb 100644 (file)
@@ -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);
 
   DEBUGASSERT(prot_level > PROT_NONE && prot_level < PROT_LAST);
 
index 5db8b495b57943dfb602df2e9abe17300ad1699d..9bf338e404ccf1b571fabee92e699c27d8169391 100644 (file)
@@ -80,7 +80,7 @@
  * are not NULL, but no longer have the MAGIC touch. This gives
  * us early warning on things only discovered by valgrind otherwise. */
 #define GOOD_MULTI_HANDLE(x) \
-  (((x) && (x)->magic == CURL_MULTI_HANDLE)? TRUE: \
+  (((x) && (x)->magic == CURL_MULTI_HANDLE)? TRUE:      \
   (DEBUGASSERT(!(x)), FALSE))
 #else
 #define GOOD_MULTI_HANDLE(x) \
@@ -801,7 +801,7 @@ CURLMcode curl_multi_remove_handle(CURLM *m, CURL *d)
   if(multi->in_callback)
     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
      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);
     if(!ret)
-      retry = (newurl) ? TRUE : FALSE;
+      retry = !!newurl;
     else if(!result)
       result = ret;
 
index 5df59be3e9e54af8170c33886e7fceeada7dfa5f..db6ec04c7bff407811478a494e6ac88998643cb3 100644 (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);
-  *done = (pop3c->state == POP3_STOP) ? TRUE : FALSE;
+  *done = (pop3c->state == POP3_STOP);
 
   return result;
 }
index 3c5893284bd97978ea5ec6e8df5ccb7a83949f54..d854d364f8555f37a67adac6041796db2180b41b 100644 (file)
@@ -1100,12 +1100,11 @@ static CURLcode smtp_state_rcpt_resp(struct Curl_easy *data,
 
   (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
      and proceed with only the valid addresses. */
-  is_smtp_blocking_err =
-    (is_smtp_err && !data->set.mail_rcpt_allowfails) ? TRUE : FALSE;
+  is_smtp_blocking_err = (is_smtp_err && !data->set.mail_rcpt_allowfails);
 
   if(is_smtp_err) {
     /* 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);
-  *done = (smtpc->state == SMTP_STOP) ? TRUE : FALSE;
+  *done = (smtpc->state == SMTP_STOP);
 
   return result;
 }
index 733d047eb229c50c8812c5562ccd3788d73fbb7a..d16a30b90adbef17d12a5719248e4eae429f9ed8 100644 (file)
@@ -286,7 +286,7 @@ static CURLproxycode do_SOCKS4(struct Curl_cfilter *cf,
 {
   struct connectdata *conn = cf->conn;
   const bool protocol4a =
-    (conn->socks_proxy.proxytype == CURLPROXY_SOCKS4A) ? TRUE : FALSE;
+    (conn->socks_proxy.proxytype == CURLPROXY_SOCKS4A);
   unsigned char *socksreq = sx->buffer;
   CURLcode result;
   CURLproxycode presult;
@@ -583,7 +583,7 @@ static CURLproxycode do_SOCKS5(struct Curl_cfilter *cf,
   CURLcode result;
   CURLproxycode presult;
   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);
   size_t len = 0;
   const unsigned char auth = data->set.socks5auth;
index 07fad523c57df22add5fa5e86588b237c6c0a75f..e92e5127a56bde76934bb2a2d676511c401b594a 100644 (file)
@@ -205,7 +205,7 @@ static CURLcode tftp_set_timeouts(struct tftp_state_data *state)
 {
   time_t maxtime, timeout;
   timediff_t timeout_ms;
-  bool start = (state->state == TFTP_STATE_START) ? TRUE : FALSE;
+  bool start = (state->state == TFTP_STATE_START);
 
   /* Compute drop-dead time */
   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);
     if(result)
       return result;
-    *done = (state->state == TFTP_STATE_FIN) ? TRUE : FALSE;
+    *done = (state->state == TFTP_STATE_FIN);
     if(*done)
       /* Tell curl we are done */
       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);
       if(result)
         return result;
-      *done = (state->state == TFTP_STATE_FIN) ? TRUE : FALSE;
+      *done = (state->state == TFTP_STATE_FIN);
       if(*done)
         /* Tell curl we are done */
         Curl_xfer_setup_nop(data);
index 68e96136a6593170befb8622e4e26b0da8720232..f9bb05f793e5e92babe4c53063d2903fbc84dcd8 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -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
      requested, they may be altered down the road */
   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->http_proxy.proxytype == CURLPROXY_HTTP ||
                            conn->http_proxy.proxytype == CURLPROXY_HTTP_1_0 ||
-                           IS_HTTPS_PROXY(conn->http_proxy.proxytype))) ?
-    TRUE : FALSE;
-  conn->bits.socksproxy = (conn->bits.proxy &&
-                           !conn->bits.httpproxy) ? TRUE : FALSE;
+                           IS_HTTPS_PROXY(conn->http_proxy.proxytype)));
+  conn->bits.socksproxy = (conn->bits.proxy && !conn->bits.httpproxy);
 
   if(data->set.str[STRING_PRE_PROXY] && *data->set.str[STRING_PRE_PROXY]) {
     conn->bits.proxy = TRUE;
     conn->bits.socksproxy = TRUE;
   }
 
-  conn->bits.proxy_user_passwd =
-    (data->state.aptr.proxyuser) ? TRUE : FALSE;
+  conn->bits.proxy_user_passwd = !!data->state.aptr.proxyuser;
   conn->bits.tunnel_proxy = data->set.tunnel_thru_httpproxy;
 #endif /* CURL_DISABLE_PROXY */
 
@@ -1961,11 +1958,11 @@ static CURLcode setup_range(struct Curl_easy *data)
     else
       s->range = strdup(data->set.str[STRING_SET_RANGE]);
 
-    s->rangestringalloc = (s->range) ? TRUE : FALSE;
-
     if(!s->range)
       return CURLE_OUT_OF_MEMORY;
 
+    s->rangestringalloc = TRUE;
+
     /* tell ourselves to fetch this range */
     s->use_range = TRUE;        /* enable range download */
   }
index e686b0aaf90edb012d15b61ec2e59bb1262be9d2..2ae6fb30c93c110314af284a33de3a26002d6e91 100644 (file)
@@ -69,7 +69,7 @@ bool Curl_auth_is_digest_supported(void)
     Curl_pSecFn->FreeContextBuffer(SecurityPackage);
   }
 
-  return (status == SEC_E_OK ? TRUE : FALSE);
+  return (status == SEC_E_OK);
 }
 
 /*
index b168a27ad882052dbcc3e8bda7e3e2fb218306e7..4af0bd1e134d86ba532d892169d213083cb0a08c 100644 (file)
@@ -64,7 +64,7 @@ bool Curl_auth_is_gssapi_supported(void)
     Curl_pSecFn->FreeContextBuffer(SecurityPackage);
   }
 
-  return (status == SEC_E_OK ? TRUE : FALSE);
+  return (status == SEC_E_OK);
 }
 
 /*
index 0e3d98aa9c96a1e80dc946d0713717b99ca010a6..f8f6aea0e9e25c04c0c813bb1ebadc839d40edb6 100644 (file)
@@ -485,7 +485,7 @@ CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data,
   unsigned char ntresp[24]; /* fixed-size */
   unsigned char *ptr_ntresp = &ntresp[0];
   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
      name. Copy the name used by Firefox. */
   static const char host[] = "WORKSTATION";
index 55ec8201d82689118dead726016b779b5c821b64..a2e5bc102696beab6fdc408fb25020adccd0bb3e 100644 (file)
@@ -63,7 +63,7 @@ bool Curl_auth_is_ntlm_supported(void)
     Curl_pSecFn->FreeContextBuffer(SecurityPackage);
   }
 
-  return (status == SEC_E_OK ? TRUE : FALSE);
+  return (status == SEC_E_OK);
 }
 
 /*
index 38b26ab90ca80d66913e8bd57f126372120ea95d..7a27c298fc11a9d33c945ca3c86ad58354494bd4 100644 (file)
@@ -67,7 +67,7 @@ bool Curl_auth_is_spnego_supported(void)
   }
 
 
-  return (status == SEC_E_OK ? TRUE : FALSE);
+  return (status == SEC_E_OK);
 }
 
 /*
index ace43c47d1ebafbe3f1608191f15bce1442bb29f..a7e7e17f3b236d77b487138d094dbf9186d2f608 100644 (file)
@@ -134,8 +134,7 @@ bool Curl_auth_user_contains_domain(const char *user)
     /* Check we have a domain name or UPN present */
     char *p = strpbrk(user, "\\/@");
 
-    valid = (p != NULL && p > user && p < user + strlen(user) - 1 ? TRUE :
-                                                                    FALSE);
+    valid = (p != NULL && p > user && p < user + strlen(user) - 1);
   }
 #if defined(HAVE_GSSAPI) || defined(USE_WINDOWS_SSPI)
   else
index b8319ff94b5df6e81fcf35b9406af4913726b320..2781365bf481e9121d9b7adc590fea407fe9ccdb 100644 (file)
@@ -695,7 +695,7 @@ static CURLcode myssh_statemach_act(struct Curl_easy *data, bool *block)
     case SSH_S_STARTUP:
       rc = ssh_connect(sshc->ssh_session);
 
-      myssh_block2waitfor(conn, (rc == SSH_AGAIN) ? TRUE : FALSE);
+      myssh_block2waitfor(conn, (rc == SSH_AGAIN));
       if(rc == SSH_AGAIN) {
         DEBUGF(infof(data, "ssh_connect -> EAGAIN"));
         break;
@@ -2085,7 +2085,7 @@ static CURLcode myssh_multi_statemach(struct Curl_easy *data,
                     implementation */
   CURLcode result = myssh_statemach_act(data, &block);
 
-  *done = (sshc->state == SSH_STOP) ? TRUE : FALSE;
+  *done = (sshc->state == SSH_STOP);
   myssh_block2waitfor(conn, block);
 
   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
    * 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. */
-  myssh_block2waitfor(conn, (rc == SSH_AGAIN) ? TRUE : FALSE);
+  myssh_block2waitfor(conn, (rc == SSH_AGAIN));
 
   if(rc == SSH_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.
    * 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) {
     *err = CURLE_AGAIN;
     nread = -1;
@@ -2614,7 +2614,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));
 
       if(nread == SSH_AGAIN) {
         *err = CURLE_AGAIN;
index c41ae9f90ad85e8a106a68408d85841046acbb2a..e19ffefe8b5f16b1fbcf46e696f236f3eb5682fb 100644 (file)
@@ -3067,7 +3067,7 @@ static CURLcode ssh_multi_statemach(struct Curl_easy *data, bool *done)
                  implementation */
   do {
     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
        try again */
   } while(!result && !*done && !block);
@@ -3512,7 +3512,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));
 
   if(nwrite == LIBSSH2_ERROR_EAGAIN) {
     *err = CURLE_AGAIN;
@@ -3537,7 +3537,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));
   if(nread == LIBSSH2_ERROR_EAGAIN) {
     *err = CURLE_AGAIN;
     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);
 
-  ssh_block2waitfor(data, (nwrite == LIBSSH2_ERROR_EAGAIN) ? TRUE : FALSE);
+  ssh_block2waitfor(data, (nwrite == LIBSSH2_ERROR_EAGAIN));
 
   if(nwrite == LIBSSH2_ERROR_EAGAIN) {
     *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);
 
-  ssh_block2waitfor(data, (nread == LIBSSH2_ERROR_EAGAIN) ? TRUE : FALSE);
+  ssh_block2waitfor(data, (nread == LIBSSH2_ERROR_EAGAIN));
 
   if(nread == LIBSSH2_ERROR_EAGAIN) {
     *err = CURLE_AGAIN;
index 2f1d556d4b4982378e5f86885c2ab457c94716a7..5400821129b3ce3c5f74bc20903a1c9ea0f85aa5 100644 (file)
@@ -908,7 +908,7 @@ static CURLcode wssh_multi_statemach(struct Curl_easy *data, bool *done)
                  implementation */
   do {
     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
        try again */
     if(*done) {
index 67c7fd0f790086d2f66b02c0a4270ac8827b85bd..b60869ddad8edda761b369f58e54326380156b13 100644 (file)
@@ -1015,7 +1015,7 @@ static int passwd_callback(char *buf, int num, int encrypting,
  */
 static bool rand_enough(void)
 {
-  return (0 != RAND_status()) ? TRUE : FALSE;
+  return (0 != RAND_status());
 }
 
 static CURLcode ossl_seed(struct Curl_easy *data)
index 55c71411692c5bde19cccb45b108732a733d524e..6d12dfd73e956d8638264048cbb2a6febed26b13 100644 (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)
 {
   (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)
index c636e4788ef55e47c3023813ca31e6f9da01495a..bc383ec5cbc88872b0bd4a2c7a7af7fcbdfec323 100644 (file)
@@ -1799,7 +1799,7 @@ static bool wolfssl_data_pending(struct Curl_cfilter *cf,
 
   backend = (struct wolfssl_ctx *)ctx->backend;
   if(backend->handle)   /* SSL is in use */
-    return (0 != wolfSSL_pending(backend->handle)) ? TRUE : FALSE;
+    return wolfSSL_pending(backend->handle);
   else
     return FALSE;
 }
index 6d2a6178358336e2551f58e71b866cb8f9ee743d..195127bd8bad051fd59a3bf7057cd98c3cc7f411 100644 (file)
@@ -173,7 +173,7 @@ int tool_debug_cb(CURL *handle, curl_infotype type,
           log_line_start(output, timebuf, idsbuf, type);
         (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;
       break;
     case CURLINFO_TEXT:
@@ -181,7 +181,7 @@ int tool_debug_cb(CURL *handle, curl_infotype type,
       if(!newl)
         log_line_start(output, timebuf, idsbuf, type);
       (void)fwrite(data, size, 1, output);
-      newl = (size && (data[size - 1] != '\n')) ? TRUE : FALSE;
+      newl = (size && (data[size - 1] != '\n'));
       traced_data = FALSE;
       break;
     case CURLINFO_DATA_OUT:
index f3ab493d1ea44df2145566ecb9423ec0bfe84339..1231b3bd60d4dc3494db1ea0025c1aeeb9bda2f9 100644 (file)
@@ -1218,7 +1218,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
       config->disallow_username_in_url = toggle;
       break;
     case C_EPSV: /* --epsv */
-      config->disable_epsv = (!toggle) ? TRUE : FALSE;
+      config->disable_epsv = !toggle;
       break;
     case C_DNS_SERVERS: /* --dns-servers */
       if(!curlinfo->ares_num) /* c-ares is needed for this */
@@ -1248,7 +1248,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
       }
       break;
     case C_ALPN: /* --alpn */
-      config->noalpn = (!toggle) ? TRUE : FALSE;
+      config->noalpn = !toggle;
       break;
     case C_LIMIT_RATE: /* --limit-rate */
       err = GetSizeParameter(global, nextarg, "rate", &value);
@@ -1371,7 +1371,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
       config->disable_eprt = toggle;
       break;
     case C_EPRT: /* --eprt */
-      config->disable_eprt = (!toggle) ? TRUE : FALSE;
+      config->disable_eprt = !toggle;
       break;
     case C_XATTR: /* --xattr */
       config->xattr = toggle;
@@ -1552,7 +1552,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
       config->ftp_ssl_reqd = toggle;
       break;
     case C_SESSIONID: /* --sessionid */
-      config->disable_sessionid = (!toggle) ? TRUE : FALSE;
+      config->disable_sessionid = !toggle;
       break;
     case C_FTP_SSL_CONTROL: /* --ftp-ssl-control */
       if(toggle && !feature_ssl)
@@ -1582,7 +1582,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
       config->raw = toggle;
       break;
     case C_KEEPALIVE: /* --keepalive */
-      config->nokeepalive = (!toggle) ? TRUE : FALSE;
+      config->nokeepalive = !toggle;
       break;
     case C_KEEPALIVE_TIME: /* --keepalive-time */
       err = str2unum(&config->alivetime, nextarg);
@@ -2167,7 +2167,7 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
                    nextarg,
                    &config->mimeroot,
                    &config->mimecurrent,
-                   (cmd == C_FORM_STRING) ? TRUE : FALSE)) /* literal string */
+                   (cmd == C_FORM_STRING))) /* literal string */
         err = PARAM_BAD_USE;
       else if(SetHTTPrequest(config, TOOL_HTTPREQ_MIMEPOST, &config->httpreq))
         err = PARAM_BAD_USE;
index b98ec0139431bf098d055fc60914936ec0ec3112..18de4e2fa4533c51b0430a9e13f513ca4027f128 100644 (file)
@@ -2456,7 +2456,7 @@ static CURLcode add_parallel_transfers(struct GlobalConfig *global,
     all_added++;
     *addedp = TRUE;
   }
-  *morep = (per || sleeping) ? TRUE : FALSE;
+  *morep = (per || sleeping);
   return CURLE_OK;
 }
 
index fbddb027cf8772c0af0d4c904296c82bc9f30a38..e4cdb45aa7bd5bc9939ea60a05dfd9bceef7c495 100644 (file)
@@ -66,8 +66,7 @@ bool output_expected(const char *url, const char *uploadfile)
 
 bool stdin_upload(const char *uploadfile)
 {
-  return (!strcmp(uploadfile, "-") ||
-          !strcmp(uploadfile, ".")) ? TRUE : FALSE;
+  return (!strcmp(uploadfile, "-") || !strcmp(uploadfile, "."));
 }
 
 /* Convert a CURLUcode into a CURLcode */
index a267dccbe7a795367def91e02805aab67ebee5d2..d79e869f023b85acc65634ae8d5595ad9a553d66 100644 (file)
@@ -126,7 +126,7 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
       option = line;
 
       /* the option starts with a dash? */
-      dashed_option = (option[0] == '-') ? TRUE : FALSE;
+      dashed_option = (option[0] == '-');
 
       while(*line && !ISSPACE(*line) && !ISSEP(*line, dashed_option))
         line++;
@@ -311,7 +311,7 @@ static bool my_get_line(FILE *fp, struct curlx_dynbuf *db,
        occurs while no characters have been read. */
     if(!fgets(buf, sizeof(buf), fp))
       /* 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)) {
       *error = TRUE; /* error */
       return FALSE; /* stop reading */