]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tidy-up: move literal to the right side of comparisons
authorViktor Szakats <commit@vsz.me>
Tue, 8 Jul 2025 12:10:35 +0000 (14:10 +0200)
committerViktor Szakats <commit@vsz.me>
Sun, 27 Jul 2025 20:35:17 +0000 (22:35 +0200)
Closes #17876

49 files changed:
docs/examples/anyauthput.c
docs/examples/block_ip.c
docs/examples/multithread.c
docs/examples/sftpuploadresume.c
docs/examples/smooth-gtk-thread.c
docs/examples/threaded-ssl.c
docs/internals/CODE_STYLE.md
lib/altsvc.c
lib/cf-socket.c
lib/conncache.c
lib/cookie.c
lib/curl_addrinfo.c
lib/curl_sha512_256.c
lib/curlx/timeval.c
lib/file.c
lib/ftp.c
lib/hostip6.c
lib/http.c
lib/http_chunks.c
lib/memdebug.c
lib/noproxy.c
lib/progress.c
lib/sendf.c
lib/setopt.c
lib/socks.c
lib/socks_gssapi.c
lib/socks_sspi.c
lib/strequal.c
lib/strerror.c
lib/transfer.c
lib/urlapi.c
lib/vtls/gtls.c
lib/vtls/openssl.c
lib/vtls/schannel.c
lib/vtls/vtls.c
lib/vtls/wolfssl.c
src/tool_dirhie.c
src/tool_filetime.c
src/tool_getparam.c
src/tool_getpass.c
src/tool_msgs.c
src/tool_operate.c
tests/libtest/lib1560.c
tests/server/dnsd.c
tests/server/mqttd.c
tests/server/rtspd.c
tests/server/socksd.c
tests/server/sws.c
tests/server/tftpd.c

index 550c827693ffb9b559073f2027bdf9112826da7b..7106c32eb6bccd4e027350d7e41126e81bb18d7f 100644 (file)
@@ -61,7 +61,7 @@ static int my_seek(void *userp, curl_off_t offset, int origin)
 {
   FILE *fp = (FILE *) userp;
 
-  if(-1 == fseek(fp, (long) offset, origin))
+  if(fseek(fp, (long) offset, origin) == -1)
     /* could not seek */
     return CURL_SEEKFUNC_CANTSEEK;
 
index bff7b6353c3c7ae7f874e85eea269363fa858a9c..a6609d3428b337f4b3be9a1a6196fa3aef1f13da 100644 (file)
@@ -155,7 +155,7 @@ static struct ip *ip_list_append(struct ip *list, const char *data)
     ip->maskbits = 128;
 #endif
 
-  if(1 != inet_pton(ip->family, ip->str, &ip->netaddr)) {
+  if(inet_pton(ip->family, ip->str, &ip->netaddr) != 1) {
     free(ip->str);
     free(ip);
     return NULL;
index 7978419bdc57a2ec51379612a3a8063c1665ce68..ceee94022a394d6bd9cb83f5df369f33130c4218 100644 (file)
@@ -80,7 +80,7 @@ int main(void)
                                NULL, /* default attributes please */
                                pull_one_url,
                                (void *)urls[i]);
-    if(0 != error)
+    if(error)
       fprintf(stderr, "Couldn't run thread number %d, errno %d\n", i, error);
     else
       fprintf(stderr, "Thread %d, gets %s\n", i, urls[i]);
index 2803da33e0f8f75f2eaedf627212ad100ba9cecb..f1f7b0c275a3abd73a6d65cd4eb27ed7ab3dab19 100644 (file)
@@ -83,7 +83,7 @@ static int sftpResumeUpload(CURL *curlhandle, const char *remotepath,
   CURLcode result = CURLE_GOT_NOTHING;
 
   curl_off_t remoteFileSizeByte = sftpGetRemoteFileSize(remotepath);
-  if(-1 == remoteFileSizeByte) {
+  if(remoteFileSizeByte == -1) {
     printf("Error reading the remote file size: unable to resume upload\n");
     return -1;
   }
index c53951262afe580e395cf9f297cd551dbf5a1b7b..49a412d95843ef7b0c40debb054795f7d312f549 100644 (file)
@@ -130,7 +130,7 @@ void *create_thread(void *progress_bar)
                                NULL, /* default attributes please */
                                pull_one_url,
                                NULL);
-    if(0 != error)
+    if(error)
       fprintf(stderr, "Couldn't run thread number %d, errno %d\n", i, error);
     else
       fprintf(stderr, "Thread %d, gets %s\n", i, urls[i]);
index 263400afd8a2999b8953e23fd1cebd883a85d7fe..96681290553bbe89a1bdc8d23576039e03bfcd9e 100644 (file)
@@ -83,7 +83,7 @@ int main(int argc, char **argv)
                                NULL, /* default attributes please */
                                pull_one_url,
                                (void *)urls[i]);
-    if(0 != error)
+    if(error)
       fprintf(stderr, "Couldn't run thread number %d, errno %d\n", i, error);
     else
       fprintf(stderr, "Thread %d, gets %s\n", i, urls[i]);
index 24e669c35b725d3a8239518cef8f16d8b2c59a4f..dadec934ddc4fa6c72060d6300b1702e0c642e11 100644 (file)
@@ -253,7 +253,7 @@ If no parenthesis, use the default indent:
 
 ```c
 data->set.http_disable_hostname_check_before_authentication =
-  (0 != va_arg(param, long)) ? TRUE : FALSE;
+  va_arg(param, long) ? TRUE : FALSE;
 ```
 
 Function invoke with an open parenthesis:
index 59476d7325a49f459e6629f10dbfb35cab31934a..a06f40bc2a2b5cbb97f3184474e47b72fc1f7b8c 100644 (file)
@@ -260,11 +260,11 @@ static CURLcode altsvc_out(struct altsvc *as, FILE *fp)
 #ifdef USE_IPV6
   else {
     char ipv6_unused[16];
-    if(1 == curlx_inet_pton(AF_INET6, as->dst.host, ipv6_unused)) {
+    if(curlx_inet_pton(AF_INET6, as->dst.host, ipv6_unused) == 1) {
       dst6_pre = "[";
       dst6_post = "]";
     }
-    if(1 == curlx_inet_pton(AF_INET6, as->src.host, ipv6_unused)) {
+    if(curlx_inet_pton(AF_INET6, as->src.host, ipv6_unused) == 1) {
       src6_pre = "[";
       src6_post = "]";
     }
index 3d535a0e10061c0fcd3f337e98c307b8280e087f..49bc611fb9086e24f81bf77e0e0a7e213c8a3f05 100644 (file)
@@ -844,7 +844,7 @@ static bool verifyconnect(curl_socket_t sockfd, int *error)
 
 #endif
 
-  if(0 != getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (void *)&err, &errSize))
+  if(getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (void *)&err, &errSize))
     err = SOCKERRNO;
 #ifdef UNDER_CE
   /* Old Windows CE versions do not support SO_ERROR */
@@ -860,7 +860,7 @@ static bool verifyconnect(curl_socket_t sockfd, int *error)
     err = 0;
   }
 #endif
-  if((0 == err) || (SOCKEISCONN == err))
+  if((err == 0) || (SOCKEISCONN == err))
     /* we are connected, awesome! */
     rc = TRUE;
   else
@@ -2111,7 +2111,7 @@ static CURLcode cf_tcp_accept_connect(struct Curl_cfilter *cf,
     return CURLE_OK;
   }
 
-  if(0 == getsockname(ctx->sock, (struct sockaddr *) &add, &size)) {
+  if(!getsockname(ctx->sock, (struct sockaddr *) &add, &size)) {
     size = sizeof(add);
 #ifdef HAVE_ACCEPT4
     s_accepted = accept4(ctx->sock, (struct sockaddr *) &add, &size,
index fd6776e34c6f523024b570969e9945ba6423eb99..f77a7468740eebbeacdfb52f00a11aa32d004a65 100644 (file)
@@ -515,7 +515,7 @@ static bool cpool_foreach(struct Curl_easy *data,
       struct connectdata *conn = Curl_node_elem(curr);
       curr = Curl_node_next(curr);
 
-      if(1 == func(data, conn, param)) {
+      if(func(data, conn, param) == 1) {
         return TRUE;
       }
     }
index 9221871e4b430ccecae612354be371546bebc67c..914a4aca12acf1728d55658103988b05cb0c5ca9 100644 (file)
@@ -167,13 +167,13 @@ static bool pathmatch(const char *cookie_path, const char *uri_path)
 
   /* cookie_path must not have last '/' separator. ex: /sample */
   cookie_path_len = strlen(cookie_path);
-  if(1 == cookie_path_len) {
+  if(cookie_path_len == 1) {
     /* cookie_path must be '/' */
     return TRUE;
   }
 
   /* #-fragments are already cut off! */
-  if(0 == strlen(uri_path) || uri_path[0] != '/')
+  if(strlen(uri_path) == 0 || uri_path[0] != '/')
     uri_path = "/";
 
   /*
@@ -872,7 +872,7 @@ parse_netscape(struct Cookie *co,
       break;
     }
   }
-  if(6 == fields) {
+  if(fields == 6) {
     /* we got a cookie with blank contents, fix it */
     co->value = strdup("");
     if(!co->value)
@@ -881,7 +881,7 @@ parse_netscape(struct Cookie *co,
       fields++;
   }
 
-  if(7 != fields)
+  if(fields != 7)
     /* we did not find the sufficient number of fields */
     return CERR_FIELDS;
 
index 310a5b6ab859d909e06bc54668ae76653c4adfda..61db84ab19c7fbf7a5fc4542741b3b5346f98927 100644 (file)
@@ -544,7 +544,7 @@ curl_dbg_getaddrinfo(const char *hostname,
 #else
   int res = getaddrinfo(hostname, service, hints, result);
 #endif
-  if(0 == res)
+  if(res == 0)
     /* success */
     curl_dbg_log("ADDR %s:%d getaddrinfo() = %p\n",
                  source, line, (void *)*result);
index d730c59a1b4099cf08c3cb7cc25c9e16a848a42f..fad43d2a331818196dbe96842a0649afcd520f98 100644 (file)
@@ -317,7 +317,7 @@ static CURL_FORCEINLINE curl_uint64_t Curl_rotr64(curl_uint64_t value,
                                                   unsigned int bits)
 {
   bits %= 64;
-  if(0 == bits)
+  if(bits == 0)
     return value;
   /* Defined in a form which modern compiler could optimize. */
   return (value >> bits) | (value << (64 - bits));
@@ -621,7 +621,7 @@ static CURLcode Curl_sha512_256_update(void *context,
 
   DEBUGASSERT((data != NULL) || (length == 0));
 
-  if(0 == length)
+  if(length == 0)
     return CURLE_OK; /* Shortcut, do nothing */
 
   /* Note: (count & (CURL_SHA512_256_BLOCK_SIZE-1))
@@ -633,7 +633,7 @@ static CURLcode Curl_sha512_256_update(void *context,
   ctx->count_bits_hi += ctx->count >> 61;
   ctx->count &= CURL_UINT64_C(0x1FFFFFFFFFFFFFFF);
 
-  if(0 != bytes_have) {
+  if(bytes_have) {
     unsigned int bytes_left = CURL_SHA512_256_BLOCK_SIZE - bytes_have;
     if(length >= bytes_left) {
       /* Combine new data with data in the buffer and process the full
@@ -656,7 +656,7 @@ static CURLcode Curl_sha512_256_update(void *context,
     length -= CURL_SHA512_256_BLOCK_SIZE;
   }
 
-  if(0 != length) {
+  if(length) {
     /* Copy incomplete block of new data (if any)
        to the buffer. */
     memcpy(((unsigned char *) ctx_buf) + bytes_have, data, length);
index 01393bd528701e039b0955529b19350f63931b8d..bd8b9bcee27b182674a5c727cf6da2e3cd2b6c53 100644 (file)
@@ -115,7 +115,7 @@ struct curltime curlx_now(void)
         (HAVE_BUILTIN_AVAILABLE == 1)
     have_clock_gettime &&
 #endif
-    (0 == clock_gettime(CLOCK_MONOTONIC_RAW, &tsnow))) {
+    (clock_gettime(CLOCK_MONOTONIC_RAW, &tsnow) == 0)) {
     cnow.tv_sec = tsnow.tv_sec;
     cnow.tv_usec = (int)(tsnow.tv_nsec / 1000);
   }
@@ -127,7 +127,7 @@ struct curltime curlx_now(void)
         (HAVE_BUILTIN_AVAILABLE == 1)
     have_clock_gettime &&
 #endif
-    (0 == clock_gettime(CLOCK_MONOTONIC, &tsnow))) {
+    (clock_gettime(CLOCK_MONOTONIC, &tsnow) == 0)) {
     cnow.tv_sec = tsnow.tv_sec;
     cnow.tv_usec = (int)(tsnow.tv_nsec / 1000);
   }
@@ -168,7 +168,7 @@ struct curltime curlx_now(void)
   struct curltime cnow;
   uint64_t usecs;
 
-  if(0 == timebase.denom)
+  if(timebase.denom == 0)
     (void)mach_timebase_info(&timebase);
 
   usecs = mach_absolute_time();
index b88f61230566ea737de6f797d875b7bbb602e47e..297503edcccf5cfde17191e45060494bb4324bd7 100644 (file)
@@ -358,7 +358,7 @@ static CURLcode file_upload(struct Curl_easy *data,
     return CURLE_WRITE_ERROR;
   }
 
-  if(-1 != data->state.infilesize)
+  if(data->state.infilesize != -1)
     /* known size of data to "upload" */
     Curl_pgrsSetUploadSize(data, data->state.infilesize);
 
@@ -470,7 +470,7 @@ static CURLcode file_do(struct Curl_easy *data, bool *done)
   fd = file->fd;
 
   /* VMS: This only works reliable for STREAMLF files */
-  if(-1 != fstat(fd, &statbuf)) {
+  if(fstat(fd, &statbuf) != -1) {
     if(!S_ISDIR(statbuf.st_mode))
       expected_size = statbuf.st_size;
     /* and store the modification time */
index f763b183b13971c102eab2954c46ff955e0188cd..a82cb473ef89b2b970bfcd70bd1c63d5354f645a 100644 (file)
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -615,7 +615,7 @@ static CURLcode ftp_readresp(struct Curl_easy *data,
   if(ftpcode)
     *ftpcode = code;
 
-  if(421 == code) {
+  if(code == 421) {
     /* 421 means "Service not available, closing control connection." and FTP
      * servers use it to signal that idle session timeout has been exceeded.
      * If we ignored the response, it could end up hanging in some cases.
@@ -2356,7 +2356,7 @@ static CURLcode ftp_state_size_resp(struct Curl_easy *data,
 
   if(instate == FTP_SIZE) {
 #ifdef CURL_FTP_HTTPSTYLE_HEAD
-    if(-1 != filesize) {
+    if(filesize != -1) {
       char clbuf[128];
       int clbuflen = msnprintf(clbuf, sizeof(clbuf),
                 "Content-Length: %" FMT_OFF_T "\r\n", filesize);
@@ -3439,7 +3439,7 @@ static CURLcode ftp_done(struct Curl_easy *data, CURLcode status,
     }
   }
   else {
-    if((-1 != data->req.size) &&
+    if((data->req.size != -1) &&
        (data->req.size != data->req.bytecount) &&
        (data->req.maxdownload != data->req.bytecount)) {
       failf(data, "Received only partial file: %" FMT_OFF_T " bytes",
index ce7f5050ea8bb8d49998b1783730c48d59cb27e3..fa2ff33b2c09c49d7a10d566f489e03658810937 100644 (file)
@@ -114,8 +114,8 @@ struct Curl_addrinfo *Curl_sync_getaddrinfo(struct Curl_easy *data,
    * The AI_NUMERICHOST must not be set to get synthesized IPv6 address from
    * an IPv4 address on iOS and macOS.
    */
-  if((1 == curlx_inet_pton(AF_INET, hostname, addrbuf)) ||
-     (1 == curlx_inet_pton(AF_INET6, hostname, addrbuf))) {
+  if((curlx_inet_pton(AF_INET, hostname, addrbuf) == 1) ||
+     (curlx_inet_pton(AF_INET6, hostname, addrbuf) == 1)) {
     /* the given address is numerical only, prevent a reverse lookup */
     hints.ai_flags = AI_NUMERICHOST;
   }
index 71a48572490af67c8bc4afcb91910940e8fa9a54..78c9a2dccba5df598b78f19f7e8dc20b95081bcb 100644 (file)
@@ -3949,7 +3949,7 @@ static CURLcode http_on_response(struct Curl_easy *data,
      like to call http2_handle_stream_close to properly close a
      stream. In order to do this, we keep reading until we
      close the stream. */
-  if((0 == k->maxdownload) && (k->httpversion_sent < 20))
+  if((k->maxdownload == 0) && (k->httpversion_sent < 20))
     k->download_done = TRUE;
 
   /* final response without error, prepare to receive the body */
index 63e477c48a68b3b0cd21ac9948d07c692a18cd78..f014a256ab8ce83e2403fad97fc3a4f4a5446813 100644 (file)
@@ -159,7 +159,7 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
       }
       else {
         const char *p;
-        if(0 == ch->hexindex) {
+        if(ch->hexindex == 0) {
           /* This is illegal data, we received junk where we expected
              a hexadecimal digit. */
           failf(data, "chunk hex-length char not a hex digit: 0x%x", *buf);
@@ -184,7 +184,7 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
       /* waiting for the LF after a chunk size */
       if(*buf == 0x0a) {
         /* we are now expecting data to come, unless size was zero! */
-        if(0 == ch->datasize) {
+        if(ch->datasize == 0) {
           ch->state = CHUNK_TRAILER; /* now check for trailers */
         }
         else {
@@ -229,7 +229,7 @@ static CURLcode httpchunk_readwrite(struct Curl_easy *data,
                      FMT_OFF_T " bytes in chunk remain",
                      piece, ch->datasize);
 
-      if(0 == ch->datasize)
+      if(ch->datasize == 0)
         /* end of data this round, we now expect a trailing CRLF */
         ch->state = CHUNK_POSTLF;
       break;
index bdcdcbb9074f7d44d6b5f19cc47d2c417f32788f..d063f94c321f12253eb5d5fe126770958c9a4585 100644 (file)
@@ -356,7 +356,7 @@ int curl_dbg_socketpair(int domain, int type, int protocol,
 {
   int res = (socketpair)(domain, type, protocol, socket_vector);
 
-  if(source && (0 == res))
+  if(source && (res == 0))
     curl_dbg_log("FD %s:%d socketpair() = "
                  "%" FMT_SOCKET_T " %" FMT_SOCKET_T "\n",
                  source, line, socket_vector[0], socket_vector[1]);
index 306cd6d1f98571ce43a331e6f9ace389664322a0..22b067ad1b026569f4c35c13ec7ac7ceec891b91 100644 (file)
@@ -54,9 +54,9 @@ UNITTEST bool Curl_cidr4_match(const char *ipv4,    /* 1.2.3.4 address */
     /* strange input */
     return FALSE;
 
-  if(1 != curlx_inet_pton(AF_INET, ipv4, &address))
+  if(curlx_inet_pton(AF_INET, ipv4, &address) != 1)
     return FALSE;
-  if(1 != curlx_inet_pton(AF_INET, network, &check))
+  if(curlx_inet_pton(AF_INET, network, &check) != 1)
     return FALSE;
 
   if(bits && (bits != 32)) {
@@ -92,9 +92,9 @@ UNITTEST bool Curl_cidr6_match(const char *ipv6,
   rest = bits & 0x07;
   if((bytes > 16) || ((bytes == 16) && rest))
     return FALSE;
-  if(1 != curlx_inet_pton(AF_INET6, ipv6, address))
+  if(curlx_inet_pton(AF_INET6, ipv6, address) != 1)
     return FALSE;
-  if(1 != curlx_inet_pton(AF_INET6, network, check))
+  if(curlx_inet_pton(AF_INET6, network, check) != 1)
     return FALSE;
   if(bytes && memcmp(address, check, bytes))
     return FALSE;
@@ -163,7 +163,7 @@ bool Curl_check_noproxy(const char *name, const char *no_proxy)
     else {
       unsigned int address;
       namelen = strlen(name);
-      if(1 == curlx_inet_pton(AF_INET, name, &address))
+      if(curlx_inet_pton(AF_INET, name, &address) == 1)
         type = TYPE_IPV4;
       else {
         /* ignore trailing dots in the hostname */
index 746805f20fa365090d08b99cc35946a5a9ec8eeb..1a3f4334ca9e8b4420b5cdea1835d0805fe3aa21 100644 (file)
@@ -449,7 +449,7 @@ static bool progress_calc(struct Curl_easy *data, struct curltime now)
 
       /* Figure out the exact time for the time span */
       span_ms = curlx_timediff(now, p->speeder_time[checkindex]);
-      if(0 == span_ms)
+      if(span_ms == 0)
         span_ms = 1; /* at least one millisecond MUST have passed */
 
       /* Calculate the average speed the last 'span_ms' milliseconds */
index 9b6908f92d1e08e6aea796d03b8589e5e26f50b3..6bd4b1bfbaf4b2ccdf87198f0b0ac6a8a10be3b6 100644 (file)
@@ -281,7 +281,7 @@ static CURLcode cw_download_write(struct Curl_easy *data,
    * This gives deterministic BODY writes on varying buffer receive
    * lengths. */
   nwrite = nbytes;
-  if(-1 != data->req.maxdownload) {
+  if(data->req.maxdownload != -1) {
     size_t wmax = get_max_body_write_len(data, data->req.maxdownload);
     if(nwrite > wmax) {
       excess_len = nbytes - wmax;
@@ -879,7 +879,7 @@ static CURLcode cr_in_rewind(struct Curl_easy *data,
       int err = fseek(data->state.in, 0, SEEK_SET);
       CURL_TRC_READ(data, "cr_in, rewind via fseek -> %d(%d)",
                     (int)err, (int)errno);
-      if(-1 != err)
+      if(err != -1)
         /* successful rewind */
         return CURLE_OK;
     }
index 1be45dc05bc66611e3ef87e190b575aceedf660a..ca03fa371c11095b0abaedd179b5669a101841ae 100644 (file)
@@ -443,7 +443,7 @@ static void set_ssl_options(struct ssl_config_data *ssl,
 static CURLcode setopt_long(struct Curl_easy *data, CURLoption option,
                             long arg)
 {
-  bool enabled = (0 != arg);
+  bool enabled = !!arg;
   unsigned long uarg = (unsigned long)arg;
   switch(option) {
   case CURLOPT_DNS_CACHE_TIMEOUT:
index 58132cb42d17fe0225de16cffca2afbd4a5c7521..46daf53baa187a4fa4411dec0d7d27b6cb6e7b22 100644 (file)
@@ -876,7 +876,7 @@ CONNECT_RESOLVE_REMOTE:
 #ifdef USE_IPV6
       if(conn->bits.ipv6_ip) {
         char ip6[16];
-        if(1 != curlx_inet_pton(AF_INET6, sx->hostname, ip6))
+        if(curlx_inet_pton(AF_INET6, sx->hostname, ip6) != 1)
           return CURLPX_BAD_ADDRESS_TYPE;
         socksreq[len++] = 4;
         memcpy(&socksreq[len], ip6, sizeof(ip6));
@@ -884,7 +884,7 @@ CONNECT_RESOLVE_REMOTE:
       }
       else
 #endif
-      if(1 == curlx_inet_pton(AF_INET, sx->hostname, ip4)) {
+      if(curlx_inet_pton(AF_INET, sx->hostname, ip4) == 1) {
         socksreq[len++] = 1;
         memcpy(&socksreq[len], ip4, sizeof(ip4));
         len += sizeof(ip4);
index f23a1ae6edf93cdda7347f00db4c15f15e09ba32..0a7ddd5ff1dc9177c51ac11568f30c3d4d07826d 100644 (file)
@@ -212,7 +212,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
 
       code = Curl_conn_cf_send(cf->next, data, (char *)socksreq, 4,
                                FALSE, &nwritten);
-      if(code || (4 != nwritten)) {
+      if(code || (nwritten != 4)) {
         failf(data, "Failed to send GSS-API authentication request.");
         gss_release_name(&gss_status, &server);
         gss_release_buffer(&gss_status, &gss_recv_token);
@@ -420,7 +420,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
 
   code = Curl_conn_cf_send(cf->next, data, (char *)socksreq, 4, FALSE,
                            &nwritten);
-  if(code || (4 != nwritten)) {
+  if(code || (nwritten != 4)) {
     failf(data, "Failed to send GSS-API encryption request.");
     gss_release_buffer(&gss_status, &gss_w_token);
     Curl_gss_delete_sec_context(&gss_status, &gss_context, NULL);
@@ -431,7 +431,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
     memcpy(socksreq, &gss_enc, 1);
     code = Curl_conn_cf_send(cf->next, data, (char *)socksreq, 1, FALSE,
                              &nwritten);
-    if(code || (1 != nwritten)) {
+    if(code || (nwritten != 1)) {
       failf(data, "Failed to send GSS-API encryption type.");
       Curl_gss_delete_sec_context(&gss_status, &gss_context, NULL);
       return CURLE_COULDNT_CONNECT;
index 82147562b766fb749b62e2dd1c02a3b8e0fde2dc..1e80ee18d907e86616874f657eb9f86f542abd2c 100644 (file)
@@ -209,7 +209,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
 
       code = Curl_conn_cf_send(cf->next, data, (char *)socksreq, 4, FALSE,
                                &written);
-      if(code || (4 != written)) {
+      if(code || (written != 4)) {
         failf(data, "Failed to send SSPI authentication request.");
         free(service_name);
         if(sspi_send_token.pvBuffer)
@@ -480,7 +480,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
 
   code = Curl_conn_cf_send(cf->next, data, (char *)socksreq, 4, FALSE,
                            &written);
-  if(code || (4 != written)) {
+  if(code || (written != 4)) {
     failf(data, "Failed to send SSPI encryption request.");
     if(sspi_send_token.pvBuffer)
       Curl_pSecFn->FreeContextBuffer(sspi_send_token.pvBuffer);
@@ -492,7 +492,7 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
     memcpy(socksreq, &gss_enc, 1);
     code = Curl_conn_cf_send(cf->next, data, (char *)socksreq, 1, FALSE,
                              &written);
-    if(code || (1 != written)) {
+    if(code || (written != 1)) {
       failf(data, "Failed to send SSPI encryption type.");
       Curl_pSecFn->DeleteSecurityContext(&sspi_context);
       return CURLE_COULDNT_CONNECT;
index fb6be51dd5dba254569c2b819a2619282435fbe9..17dd34b7f3af9a1ad27780c5732f5df949dc3dab 100644 (file)
@@ -59,7 +59,7 @@ static int ncasecompare(const char *first, const char *second, size_t max)
     first++;
     second++;
   }
-  if(0 == max)
+  if(max == 0)
     return 1; /* they are equal this far */
 
   return Curl_raw_toupper(*first) == Curl_raw_toupper(*second);
index 90694882c3c11a9492c32588ef50239d325939d2..f0f36ed1b716df8b47ef4079a4a6dbae4c108d4d 100644 (file)
@@ -809,7 +809,7 @@ const char *Curl_strerror(int err, char *buf, size_t buflen)
   * storage is supplied via 'strerrbuf' and 'buflen' to hold the generated
   * message string, or EINVAL if 'errnum' is not a valid error number.
   */
-  if(0 != strerror_r(err, buf, buflen)) {
+  if(strerror_r(err, buf, buflen)) {
     if('\0' == buf[0])
       curl_msnprintf(buf, buflen, "Unknown error %d", err);
   }
index 15a61f6997891b51526d8787af2f635491995059..84e4c5e9275be50d0190a71cc9fedec9b995203a 100644 (file)
@@ -481,7 +481,7 @@ CURLcode Curl_sendrecv(struct Curl_easy *data, struct curltime *nowp)
   }
 
   /* If there is nothing more to send/recv, the request is done */
-  if(0 == (k->keepon&(KEEP_RECVBITS|KEEP_SENDBITS)))
+  if((k->keepon & (KEEP_RECVBITS|KEEP_SENDBITS)) == 0)
     data->req.done = TRUE;
 
 out:
index c266fd3ebc2554d110771c245b911f2a92dcc6b6..2ed1a9b0d675440eac8a40b68edfc2bf321ad6d6 100644 (file)
@@ -511,7 +511,7 @@ static CURLUcode ipv6_parse(struct Curl_URL *u, char *hostname,
   {
     char dest[16]; /* fits a binary IPv6 address */
     hostname[hlen] = 0; /* end the address there */
-    if(1 != curlx_inet_pton(AF_INET6, hostname, dest))
+    if(curlx_inet_pton(AF_INET6, hostname, dest) != 1)
       return CURLUE_BAD_IPV6;
     if(curlx_inet_ntop(AF_INET6, dest, hostname, hlen)) {
       hlen = strlen(hostname); /* might be shorter now */
index 405c8e7ff3bd84912ad245c9da6b21249e139818..052e18de6ca6a1d853e5cedb0a4bdb2811c03fc3 100644 (file)
@@ -1967,7 +1967,7 @@ static bool gtls_data_pending(struct Curl_cfilter *cf,
   DEBUGASSERT(ctx && ctx->backend);
   backend = (struct gtls_ssl_backend_data *)ctx->backend;
   if(backend->gtls.session &&
-     0 != gnutls_record_check_pending(backend->gtls.session))
+     gnutls_record_check_pending(backend->gtls.session) != 0)
     return TRUE;
   return FALSE;
 }
index 76c4968d8b8fa8494bf67b1c0c02b88364e229e7..1385f3cf19e358f0bf03c171c6fcdd745f3fe626 100644 (file)
@@ -958,7 +958,7 @@ static char *ossl_strerror(unsigned long error, char *buf, size_t size)
 static int passwd_callback(char *buf, int num, int encrypting,
                            void *password)
 {
-  DEBUGASSERT(0 == encrypting);
+  DEBUGASSERT(encrypting == 0);
 
   if(!encrypting && num >= 0 && password) {
     int klen = curlx_uztosi(strlen((char *)password));
@@ -975,7 +975,7 @@ static int passwd_callback(char *buf, int num, int encrypting,
  */
 static bool rand_enough(void)
 {
-  return 0 != RAND_status();
+  return RAND_status() != 0;
 }
 
 static CURLcode ossl_seed(struct Curl_easy *data)
@@ -4487,7 +4487,7 @@ static CURLcode ossl_connect_step2(struct Curl_cfilter *cf,
   /* 1  is fine
      0  is "not successful but was shut down controlled"
      <0 is "handshake was not successful, because a fatal error occurred" */
-  if(1 != err) {
+  if(err != 1) {
     int detail = SSL_get_error(octx->ssl, err);
     CURL_TRC_CF(data, cf, "SSL_connect() -> err=%d, detail=%d", err, detail);
 
index 8d16d703925d6b3794bd17e12e9c0a19995b70a0..fe997ee200a313170681f0af308b5e525118ea87 100644 (file)
@@ -379,7 +379,7 @@ set_ssl_ciphers(SCHANNEL_CRED *schannel_cred, char *ciphers,
 {
   const char *startCur = ciphers;
   int algCount = 0;
-  while(startCur && (0 != *startCur) && (algCount < NUM_CIPHERS)) {
+  while(startCur && *startCur && (algCount < NUM_CIPHERS)) {
     curl_off_t alg;
     if(curlx_str_number(&startCur, &alg, INT_MAX) || !alg)
       alg = get_alg_id_by_name(startCur);
@@ -1816,7 +1816,7 @@ schannel_send(struct Curl_cfilter *cf, struct Curl_easy *data,
         result = CURLE_SEND_ERROR;
         break;
       }
-      else if(0 == what) {
+      else if(what == 0) {
         failf(data, "schannel: timed out sending data "
               "(bytes sent: %zu)", *pnwritten);
         result = CURLE_OPERATION_TIMEDOUT;
index 942224feff1ffddd38519f7b354b481a1a07e082..e4d20e2123bc7dfccc0d05df2ce60f68cac9420c 100644 (file)
@@ -670,7 +670,7 @@ static CURLcode pubkey_pem_to_der(const char *pem,
 
   pem_count = begin_pos - pem;
   /* Invalid if not at beginning AND not directly following \n */
-  if(0 != pem_count && '\n' != pem[pem_count - 1])
+  if(pem_count && '\n' != pem[pem_count - 1])
     return CURLE_BAD_CONTENT_ENCODING;
 
   /* 26 is length of "-----BEGIN PUBLIC KEY-----" */
@@ -1790,7 +1790,7 @@ static CURLcode vtls_shutdown_blocking(struct Curl_cfilter *cf,
         result = CURLE_RECV_ERROR;
         goto out;
       }
-      else if(0 == what) {
+      else if(what == 0) {
         /* timeout */
         failf(data, "SSL shutdown timeout");
         result = CURLE_OPERATION_TIMEDOUT;
index f6e1e6446a72659b7644571a2fc06cccf988a260..9d5366dfe73c6870de94d906e26460b9f0c0282d 100644 (file)
@@ -1759,7 +1759,7 @@ static CURLcode wssl_handshake(struct Curl_cfilter *cf,
       }
     }
 #ifdef USE_ECH_WOLFSSL
-    else if(-1 == detail) {
+    else if(detail == -1) {
       /* try access a retry_config ECHConfigList for tracing */
       byte echConfigs[1000];
       word32 echConfigsLen = 1000;
index 24759a642b551309f11a63aeeb8fed8b91a42f49..2c8aba362b8a0d2593a61e143dcfa3e7f432cc93 100644 (file)
@@ -126,7 +126,7 @@ CURLcode create_dir_hierarchy(const char *outfile, struct GlobalConfig *global)
 
     /* Create directory. Ignore access denied error to allow traversal. */
     /* !checksrc! disable ERRNOVAR 1 */
-    if(!skip && (-1 == mkdir(curlx_dyn_ptr(&dirbuf), (mode_t)0000750)) &&
+    if(!skip && (mkdir(curlx_dyn_ptr(&dirbuf), (mode_t)0000750) == -1) &&
        (errno != EACCES) && (errno != EEXIST)) {
       show_dir_errno(global, curlx_dyn_ptr(&dirbuf));
       result = CURLE_WRITE_ERROR;
index f4ff3a42917abca83e3cd67068b3be054b219b11..d94df35346d60be6ee145a2c3ddf5e45fabdf487 100644 (file)
@@ -76,7 +76,7 @@ int getfiletime(const char *filename, struct GlobalConfig *global,
   }
 #else
   struct_stat statbuf;
-  if(-1 != stat(filename, &statbuf)) {
+  if(stat(filename, &statbuf) != -1) {
     *stamp = (curl_off_t)statbuf.st_mtime;
     rc = 0;
   }
index c78494f76d6f226977c60ff0185a54249efd5ddf..f45959068f96b73659204e5bb823aa939d2cb469 100644 (file)
@@ -1585,7 +1585,7 @@ static ParameterError parse_time_cond(struct OperationConfig *config,
     break;
   }
   config->condtime = (curl_off_t)curl_getdate(nextarg, NULL);
-  if(-1 == config->condtime) {
+  if(config->condtime == -1) {
     curl_off_t value;
     /* now let's see if it is a filename to get the time from instead! */
     int rc = getfiletime(nextarg, config->global, &value);
index eea46fb52672b916447d140474feb06216b22a6d..fc59accc07acd476ac349b73580654468593a362 100644 (file)
@@ -179,7 +179,7 @@ char *getpass_r(const char *prompt, /* prompt to display */
   ssize_t nread;
   bool disabled;
   int fd = open("/dev/tty", O_RDONLY);
-  if(-1 == fd)
+  if(fd == -1)
     fd = STDIN_FILENO; /* use stdin if the tty could not be used */
 
   disabled = ttyecho(FALSE, fd); /* disable terminal echo */
index 294e27ad43847a36c827838a2e4c181ea604470f..8c954cced0d77c70cc89e810226f9eb194e05412 100644 (file)
@@ -66,7 +66,7 @@ static void voutf(struct GlobalConfig *global,
         while(!ISBLANK(ptr[cut]) && cut) {
           cut--;
         }
-        if(0 == cut)
+        if(cut == 0)
           /* not a single cutting position was found, just cut it at the
              max text width then! */
           cut = width-1;
index 7abad907bcd5c34870472a478ff3fcaf3c70b2b8..764c98b5873bd65e702abb0befb927e859eb9e72 100644 (file)
@@ -1009,7 +1009,7 @@ static CURLcode setup_outfile(struct OperationConfig *config,
        of the file as it is now and open it for append instead */
     struct_stat fileinfo;
     /* VMS -- Danger, the filesize is only valid for stream files */
-    if(0 == stat(per->outfile, &fileinfo))
+    if(stat(per->outfile, &fileinfo) == 0)
       /* set offset to current file size: */
       config->resume_from = fileinfo.st_size;
     else
index 26a98de286eff3eb8a8a931741c8adfe9d638e94..62e1cdd6d5c40144f7850d6e37d2e1c35bbd806e 100644 (file)
@@ -1194,7 +1194,7 @@ static CURLUcode updateurl(CURLU *u, const char *cmd, unsigned int setflags)
       memset(value, 0, sizeof(value)); /* Avoid valgrind false positive. */
       memcpy(buf, p, n);
       buf[n] = 0;
-      if(2 == sscanf(buf, "%79[^=]=%79[^,]", part, value)) {
+      if(sscanf(buf, "%79[^=]=%79[^,]", part, value) == 2) {
         CURLUPart what = part2id(part);
 #if 0
         /* for debugging this */
@@ -1888,8 +1888,8 @@ static int clear_url(void)
         curl_mfprintf(stderr, "unexpected return code line %u\n", __LINE__);
 
       rc = curl_url_get(u, clear_url_list[i].part, &p, 0);
-      if(rc != clear_url_list[i].ucode || (clear_url_list[i].out &&
-         0 != strcmp(p, clear_url_list[i].out))) {
+      if(rc != clear_url_list[i].ucode ||
+         (clear_url_list[i].out && strcmp(p, clear_url_list[i].out) != 0)) {
 
         curl_mfprintf(stderr, "unexpected return code line %u\n", __LINE__);
         error++;
index 389c066c8264a7472e2fac4c69adbf67fa618c70..745fbeb59bd543cc93d9adee7778f96464c44b22 100644 (file)
@@ -477,8 +477,8 @@ static int test_dnsd(int argc, char **argv)
   }
 
   flag = 1;
-  if(0 != setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
-            (void *)&flag, sizeof(flag))) {
+  if(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
+                (void *)&flag, sizeof(flag))) {
     error = SOCKERRNO;
     logmsg("setsockopt(SO_REUSEADDR) failed with error (%d) %s",
            error, sstrerror(error));
index 76ef71501156f02bb02efa07d969c2f02eccc77a..8bdf0a5fe41c16fc1160596c70212cb57dfcc567 100644 (file)
@@ -81,7 +81,7 @@ static void mqttd_getconfig(void)
     while(fgets(buffer, sizeof(buffer), fp)) {
       char key[32];
       char value[32];
-      if(2 == sscanf(buffer, "%31s %31s", key, value)) {
+      if(sscanf(buffer, "%31s %31s", key, value) == 2) {
         if(!strcmp(key, "version")) {
           m_config.version = byteval(value);
           logmsg("version [%d] set", m_config.version);
index 7f1ce810221768986e9fdedd57b35e251734f3c1..b6dd5ead1e0e5e04badfc45bd93b874692fc2245 100644 (file)
@@ -269,7 +269,7 @@ static int rtspd_ProcessRequest(struct rtspd_httprequest *req)
               logmsg("instructed to stream");
               req->rcmd = RCMD_STREAM;
             }
-            else if(1 == sscanf(ptr, "pipe: %d", &num)) {
+            else if(sscanf(ptr, "pipe: %d", &num) == 1) {
               logmsg("instructed to allow a pipe size of %d", num);
               if(num < 0)
                 logmsg("negative pipe size ignored");
@@ -277,7 +277,7 @@ static int rtspd_ProcessRequest(struct rtspd_httprequest *req)
                 req->pipe = num-1; /* decrease by one since we don't count the
                                       first request in this number */
             }
-            else if(1 == sscanf(ptr, "skip: %d", &num)) {
+            else if(sscanf(ptr, "skip: %d", &num) == 1) {
               logmsg("instructed to skip this number of bytes %d", num);
               req->skip = num;
             }
@@ -784,7 +784,7 @@ static int rtspd_send_doc(curl_socket_t sock, struct rtspd_httprequest *req)
   else {
     FILE *stream = test2fopen(req->testno, logdir);
     char partbuf[80]="data";
-    if(0 != req->partno)
+    if(req->partno)
       snprintf(partbuf, sizeof(partbuf), "data%ld", req->partno);
     if(!stream) {
       error = errno;
@@ -935,7 +935,7 @@ static int rtspd_send_doc(curl_socket_t sock, struct rtspd_httprequest *req)
     int num;
     ptr = cmd;
     do {
-      if(2 == sscanf(ptr, "%31s %d", command, &num)) {
+      if(sscanf(ptr, "%31s %d", command, &num) == 2) {
         if(!strcmp("wait", command)) {
           logmsg("Told to sleep for %d seconds", num);
           quarters = num * 4;
@@ -1099,8 +1099,8 @@ static int test_rtspd(int argc, char *argv[])
   }
 
   flag = 1;
-  if(0 != setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
-            (void *)&flag, sizeof(flag))) {
+  if(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
+                (void *)&flag, sizeof(flag))) {
     error = SOCKERRNO;
     logmsg("setsockopt(SO_REUSEADDR) failed with error (%d) %s",
            error, sstrerror(error));
index 70e27af2ff4c5d16e735903fa6661f383a43b33a..eb681bc9474c5562e033bc3628254efaa06fbc51 100644 (file)
@@ -122,7 +122,7 @@ static void socksd_getconfig(void)
     while(fgets(buffer, sizeof(buffer), fp)) {
       char key[32];
       char value[260];
-      if(2 == sscanf(buffer, "%31s %259s", key, value)) {
+      if(sscanf(buffer, "%31s %259s", key, value) == 2) {
         if(!strcmp(key, "version")) {
           s_config.version = byteval(value);
           logmsg("version [%d] set", s_config.version);
index f49f22339d5ad202d54c87db015230eafed59cfa..1572c2855f6fa72d3e5de911f0da703aa375c98a 100644 (file)
@@ -183,7 +183,7 @@ static int parse_cmdfile(struct sws_httprequest *req)
     int testnum = DOCNUMBER_NOTHING;
     char buf[256];
     while(fgets(buf, sizeof(buf), f)) {
-      if(1 == sscanf(buf, "Testnum %d", &testnum)) {
+      if(sscanf(buf, "Testnum %d", &testnum) == 1) {
         logmsg("[%s] cmdfile says testnum %d", cmdfile, testnum);
         req->testno = testnum;
       }
@@ -255,7 +255,7 @@ static int sws_parse_servercmd(struct sws_httprequest *req)
         logmsg("swsclose: close this connection after response");
         req->close = TRUE;
       }
-      else if(1 == sscanf(cmd, "skip: %d", &num)) {
+      else if(sscanf(cmd, "skip: %d", &num) == 1) {
         logmsg("instructed to skip this number of bytes %d", num);
         req->skip = num;
       }
@@ -263,11 +263,11 @@ static int sws_parse_servercmd(struct sws_httprequest *req)
         logmsg("instructed to reject Expect: 100-continue");
         req->noexpect = TRUE;
       }
-      else if(1 == sscanf(cmd, "delay: %d", &num)) {
+      else if(sscanf(cmd, "delay: %d", &num) == 1) {
         logmsg("instructed to delay %d msecs after connect", num);
         req->delay = num;
       }
-      else if(1 == sscanf(cmd, "writedelay: %d", &num)) {
+      else if(sscanf(cmd, "writedelay: %d", &num) == 1) {
         logmsg("instructed to delay %d msecs between packets", num);
         req->writedelay = num;
       }
@@ -1171,7 +1171,7 @@ retry:
     int num;
     ptr = cmd;
     do {
-      if(2 == sscanf(ptr, "%31s %d", command, &num)) {
+      if(sscanf(ptr, "%31s %d", command, &num) == 2) {
         if(!strcmp("wait", command)) {
           logmsg("Told to sleep for %d seconds", num);
           quarters = num * 4;
@@ -1243,8 +1243,8 @@ static curl_socket_t connect_to(const char *ipaddr, unsigned short port)
   if(socket_domain_is_ip()) {
     /* Disable the Nagle algorithm */
     curl_socklen_t flag = 1;
-    if(0 != setsockopt(serverfd, IPPROTO_TCP, TCP_NODELAY,
-                       (void *)&flag, sizeof(flag)))
+    if(setsockopt(serverfd, IPPROTO_TCP, TCP_NODELAY,
+                  (void *)&flag, sizeof(flag)))
       logmsg("====> TCP_NODELAY for server connection failed");
   }
 #endif
@@ -1252,7 +1252,7 @@ static curl_socket_t connect_to(const char *ipaddr, unsigned short port)
   /* We want to do the connect() in a non-blocking mode, since
    * Windows has an internal retry logic that may lead to long
    * timeouts if the peer is not listening. */
-  if(0 != curlx_nonblock(serverfd, TRUE)) {
+  if(curlx_nonblock(serverfd, TRUE)) {
     error = SOCKERRNO;
     logmsg("curlx_nonblock(TRUE) failed with error (%d) %s",
            error, sstrerror(error));
@@ -1321,10 +1321,10 @@ static curl_socket_t connect_to(const char *ipaddr, unsigned short port)
           goto error;
         else if(rc > 0) {
           curl_socklen_t errSize = sizeof(error);
-          if(0 != getsockopt(serverfd, SOL_SOCKET, SO_ERROR,
-                             (void *)&error, &errSize))
+          if(getsockopt(serverfd, SOL_SOCKET, SO_ERROR,
+                        (void *)&error, &errSize))
             error = SOCKERRNO;
-          if((0 == error) || (SOCKEISCONN == error))
+          if((error == 0) || (SOCKEISCONN == error))
             goto success;
           else if((error != SOCKEINPROGRESS) && (error != SOCKEWOULDBLOCK))
             goto error;
@@ -1346,7 +1346,7 @@ success:
   logmsg("connected fine to %s%s%s:%hu, now tunnel",
          op_br, ipaddr, cl_br, port);
 
-  if(0 != curlx_nonblock(serverfd, FALSE)) {
+  if(curlx_nonblock(serverfd, FALSE)) {
     error = SOCKERRNO;
     logmsg("curlx_nonblock(FALSE) failed with error (%d) %s",
            error, sstrerror(error));
@@ -1549,8 +1549,8 @@ static void http_connect(curl_socket_t *infdp,
           if(socket_domain_is_ip()) {
             /* Disable the Nagle algorithm */
             curl_socklen_t flag = 1;
-            if(0 != setsockopt(datafd, IPPROTO_TCP, TCP_NODELAY,
-                               (void *)&flag, sizeof(flag)))
+            if(setsockopt(datafd, IPPROTO_TCP, TCP_NODELAY,
+                          (void *)&flag, sizeof(flag)))
               logmsg("====> TCP_NODELAY for client DATA connection failed");
           }
 #endif
@@ -1839,7 +1839,7 @@ static curl_socket_t accept_connection(curl_socket_t sock)
     return CURL_SOCKET_BAD;
   }
 
-  if(0 != curlx_nonblock(msgsock, TRUE)) {
+  if(curlx_nonblock(msgsock, TRUE)) {
     error = SOCKERRNO;
     logmsg("curlx_nonblock failed with error (%d) %s",
            error, sstrerror(error));
@@ -1847,8 +1847,8 @@ static curl_socket_t accept_connection(curl_socket_t sock)
     return CURL_SOCKET_BAD;
   }
 
-  if(0 != setsockopt(msgsock, SOL_SOCKET, SO_KEEPALIVE,
-                     (void *)&flag, sizeof(flag))) {
+  if(setsockopt(msgsock, SOL_SOCKET, SO_KEEPALIVE,
+                (void *)&flag, sizeof(flag))) {
     error = SOCKERRNO;
     logmsg("setsockopt(SO_KEEPALIVE) failed with error (%d) %s",
            error, sstrerror(error));
@@ -1877,8 +1877,8 @@ static curl_socket_t accept_connection(curl_socket_t sock)
      * Disable the Nagle algorithm to make it easier to send out a large
      * response in many small segments to torture the clients more.
      */
-    if(0 != setsockopt(msgsock, IPPROTO_TCP, TCP_NODELAY,
-                       (void *)&flag, sizeof(flag)))
+    if(setsockopt(msgsock, IPPROTO_TCP, TCP_NODELAY,
+                  (void *)&flag, sizeof(flag)))
       logmsg("====> TCP_NODELAY failed");
   }
 #endif
@@ -2162,14 +2162,14 @@ static int test_sws(int argc, char *argv[])
   }
 
   flag = 1;
-  if(0 != setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
-                     (void *)&flag, sizeof(flag))) {
+  if(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
+                (void *)&flag, sizeof(flag))) {
     error = SOCKERRNO;
     logmsg("setsockopt(SO_REUSEADDR) failed with error (%d) %s",
            error, sstrerror(error));
     goto sws_cleanup;
   }
-  if(0 != curlx_nonblock(sock, TRUE)) {
+  if(curlx_nonblock(sock, TRUE)) {
     error = SOCKERRNO;
     logmsg("curlx_nonblock failed with error (%d) %s",
            error, sstrerror(error));
index bd2d42bd6f9dc38dc7bc63095a9c8bb73855fd14..1f14ee67a53567b90b54e752ff7379190adc205a 100644 (file)
@@ -481,7 +481,7 @@ static ssize_t write_behind(struct testcase *test, int convert)
     }
     /* formerly
        putc(c, file); */
-    if(1 != write(test->ofile, &c, 1))
+    if(write(test->ofile, &c, 1) != 1)
       break;
 skipit:
     prevchar = c;
@@ -662,8 +662,8 @@ static int test_tftpd(int argc, char **argv)
   }
 
   flag = 1;
-  if(0 != setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
-            (void *)&flag, sizeof(flag))) {
+  if(setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
+                (void *)&flag, sizeof(flag))) {
     error = SOCKERRNO;
     logmsg("setsockopt(SO_REUSEADDR) failed with error (%d) %s",
            error, sstrerror(error));
@@ -1029,7 +1029,7 @@ static int tftpd_parse_servercmd(struct testcase *req)
     cmd = orgcmd;
     while(cmd && cmdsize) {
       char *check;
-      if(1 == sscanf(cmd, "writedelay: %d", &num)) {
+      if(sscanf(cmd, "writedelay: %d", &num) == 1) {
         logmsg("instructed to delay %d secs between packets", num);
         req->writedelay = num;
       }
@@ -1118,7 +1118,7 @@ static int validate_access(struct testcase *test,
 
     stream = test2fopen(testno, logdir);
 
-    if(0 != partno)
+    if(partno)
       snprintf(partbuf, sizeof(partbuf), "data%ld", partno);
 
     if(!stream) {