]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
checksrc: warn for assignments within if() expressions
authorDaniel Stenberg <daniel@haxx.se>
Wed, 14 Dec 2016 00:29:44 +0000 (01:29 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 14 Dec 2016 00:29:44 +0000 (01:29 +0100)
... they're already frowned upon in our source code style guide, this
now enforces the rule harder.

86 files changed:
docs/examples/curlx.c
docs/examples/externalsocket.c
docs/examples/rtsp.c
lib/checksrc.pl
lib/cookie.c
lib/curl_addrinfo.c
lib/curl_addrinfo.h
lib/curl_ntlm_wb.c
lib/formdata.c
lib/ftp.c
lib/http.c
lib/http_digest.c
lib/inet_pton.c
lib/md4.c
lib/md5.c
lib/nwlib.c
lib/ssh.c
lib/strerror.c
lib/telnet.c
lib/url.c
lib/vtls/gtls.c
lib/vtls/nss.c
lib/vtls/openssl.c
src/tool_getparam.c
src/tool_paramhlp.c
src/tool_writeout.c
tests/libtest/lib1515.c
tests/libtest/lib1520.c
tests/libtest/lib1525.c
tests/libtest/lib1526.c
tests/libtest/lib1527.c
tests/libtest/lib1528.c
tests/libtest/lib1529.c
tests/libtest/lib1530.c
tests/libtest/lib1533.c
tests/libtest/lib500.c
tests/libtest/lib501.c
tests/libtest/lib506.c
tests/libtest/lib508.c
tests/libtest/lib509.c
tests/libtest/lib510.c
tests/libtest/lib511.c
tests/libtest/lib513.c
tests/libtest/lib514.c
tests/libtest/lib515.c
tests/libtest/lib516.c
tests/libtest/lib518.c
tests/libtest/lib519.c
tests/libtest/lib520.c
tests/libtest/lib521.c
tests/libtest/lib523.c
tests/libtest/lib524.c
tests/libtest/lib537.c
tests/libtest/lib539.c
tests/libtest/lib541.c
tests/libtest/lib542.c
tests/libtest/lib543.c
tests/libtest/lib544.c
tests/libtest/lib547.c
tests/libtest/lib549.c
tests/libtest/lib552.c
tests/libtest/lib553.c
tests/libtest/lib554.c
tests/libtest/lib556.c
tests/libtest/lib562.c
tests/libtest/lib566.c
tests/libtest/lib567.c
tests/libtest/lib568.c
tests/libtest/lib569.c
tests/libtest/lib570.c
tests/libtest/lib571.c
tests/libtest/lib572.c
tests/libtest/lib574.c
tests/libtest/lib578.c
tests/libtest/lib579.c
tests/libtest/lib586.c
tests/libtest/lib590.c
tests/libtest/lib598.c
tests/libtest/lib599.c
tests/libtest/libauthretry.c
tests/server/getpart.c
tests/server/rtspd.c
tests/server/sockfilt.c
tests/server/sws.c
tests/server/tftpd.c
tests/unit/unit1305.c

index 3b11ef7372befd5f4d5830b9845e49acfa323999..cd1677af3b9a6624a3b6ba8dc8e2e73967c89e57 100644 (file)
@@ -200,7 +200,8 @@ static int ssl_app_verify_callback(X509_STORE_CTX *ctx, void *arg)
     if(p->verbose > 1)
       X509_print_ex(p->errorbio, ctx->cert, 0, 0);
 
-    if(accessinfo = my_get_ext(ctx->cert, p->accesstype, NID_sinfo_access)) {
+    accessinfo = my_get_ext(ctx->cert, p->accesstype, NID_sinfo_access);
+    if(accessinfo) {
       if(p->verbose)
         BIO_printf(p->errorbio, "Setting URL from SIA to: %s\n", accessinfo);
 
@@ -355,7 +356,8 @@ int main(int argc, char **argv)
     }
     else if(strcmp(*args, "-accesstype") == 0) {
       if(args[1]) {
-        if((p.accesstype = OBJ_obj2nid(OBJ_txt2obj(*++args, 0))) == 0)
+        p.accesstype = OBJ_obj2nid(OBJ_txt2obj(*++args, 0));
+        if(p.accesstype == 0)
           badarg=1;
       }
       else
@@ -410,16 +412,19 @@ int main(int argc, char **argv)
 
   p.errorbio = BIO_new_fp(stderr, BIO_NOCLOSE);
 
-  if(!(p.curl = curl_easy_init())) {
+  p.curl = curl_easy_init();
+  if(!p.curl) {
     BIO_printf(p.errorbio, "Cannot init curl lib\n");
     goto err;
   }
 
-  if(!(p12bio = BIO_new_file(p.p12file, "rb"))) {
+  p12bio = BIO_new_file(p.p12file, "rb");
+  if(!p12bio) {
     BIO_printf(p.errorbio, "Error opening P12 file %s\n", p.p12file);
     goto err;
   }
-  if(!(p.p12 = d2i_PKCS12_bio(p12bio, NULL))) {
+  p.p12 = d2i_PKCS12_bio(p12bio, NULL);
+  if(!p.p12) {
     BIO_printf(p.errorbio, "Cannot decode P12 structure %s\n", p.p12file);
     goto err;
   }
@@ -447,16 +452,19 @@ int main(int argc, char **argv)
   }
   else if(p.accesstype != 0) { /* see whether we can find an AIA or SIA for a
                                   given access type */
-    if(!(serverurl = my_get_ext(p.usercert, p.accesstype, NID_info_access))) {
+    serverurl = my_get_ext(p.usercert, p.accesstype, NID_info_access);
+    if(!serverurl) {
       int j=0;
       BIO_printf(p.errorbio, "no service URL in user cert "
                  "cherching in others certificats\n");
       for(j=0; j<sk_X509_num(p.ca); j++) {
-        if((serverurl = my_get_ext(sk_X509_value(p.ca, j), p.accesstype,
-                                    NID_info_access)))
+        serverurl = my_get_ext(sk_X509_value(p.ca, j), p.accesstype,
+                               NID_info_access);
+        if(serverurl)
           break;
-        if((serverurl = my_get_ext(sk_X509_value(p.ca, j), p.accesstype,
-                                    NID_sinfo_access)))
+        serverurl = my_get_ext(sk_X509_value(p.ca, j), p.accesstype,
+                               NID_sinfo_access);
+        if(serverurl)
           break;
       }
     }
index 9b144b42d5e36158cfa99bd5ba7b2ce84d378ed1..918f08218f559d04814fea77e62857d2ad48ec56 100644 (file)
@@ -90,9 +90,8 @@ int main(void)
 
 #ifdef WIN32
   WSADATA wsaData;
-  int initwsa;
-
-  if((initwsa = WSAStartup(MAKEWORD(2, 0), &wsaData)) != 0) {
+  int initwsa = WSAStartup(MAKEWORD(2, 0), &wsaData);
+  if(initwsa != 0) {
     printf("WSAStartup failed: %d\n", initwsa);
     return 1;
   }
@@ -107,7 +106,8 @@ int main(void)
     curl_easy_setopt(curl, CURLOPT_URL, "http://99.99.99.99:9999");
 
     /* Create the socket "manually" */
-    if((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == CURL_SOCKET_BAD) {
+    sockfd = socket(AF_INET, SOCK_STREAM, 0);
+    if(sockfd == CURL_SOCKET_BAD) {
       printf("Error creating listening socket.\n");
       return 3;
     }
@@ -116,7 +116,8 @@ int main(void)
     servaddr.sin_family = AF_INET;
     servaddr.sin_port   = htons(PORTNUM);
 
-    if(INADDR_NONE == (servaddr.sin_addr.s_addr = inet_addr(IPADDR)))
+    servaddr.sin_addr.s_addr = inet_addr(IPADDR);
+    if(INADDR_NONE == servaddr.sin_addr.s_addr)
       return 2;
 
     if(connect(sockfd, (struct sockaddr *) &servaddr, sizeof(servaddr)) ==
index bdab395428035f565101843ee99d65263c97a465..5c66aa6e5bded19922461b62362bd5ee2f768962 100644 (file)
@@ -61,13 +61,15 @@ static int _getch(void)
 #define VERSION_STR  "V1.0"
 
 /* error handling macros */
-#define my_curl_easy_setopt(A, B, C) \
-  if((res = curl_easy_setopt((A), (B), (C))) != CURLE_OK) \
+#define my_curl_easy_setopt(A, B, C)                             \
+  res = curl_easy_setopt((A), (B), (C));                         \
+  if(!res)                                                       \
     fprintf(stderr, "curl_easy_setopt(%s, %s, %s) failed: %d\n", \
             #A, #B, #C, res);
 
-#define my_curl_easy_perform(A) \
-  if((res = curl_easy_perform((A))) != CURLE_OK) \
+#define my_curl_easy_perform(A)                                     \
+  res = curl_easy_perform(A);                                       \
+  if(!res)                                                          \
     fprintf(stderr, "curl_easy_perform(%s) failed: %d\n", #A, res);
 
 
index 022b193aa980c3af7822c54b532b9905423b3412..c56e9c8416e888ee97e3feb09f4e1e0052f41f8c 100755 (executable)
@@ -356,6 +356,14 @@ sub scanfile {
             }
         }
 
+        if($nostr =~ /^((.*)(if) *\()(.*)\)/) {
+            my $pos = length($1);
+            if($4 =~ / = /) {
+                checkwarn("ASSIGNWITHINCONDITION",
+                          $line, $pos+1, $file, $l,
+                          "assignment within conditional expression");
+            }
+        }
         # check spaces after open parentheses
         if($l =~ /^(.*[a-z])\( /i) {
             checkwarn("SPACEAFTERPAREN",
index 24db9c6feb1a3ce80fae7f9ed40d2391419a372e..092a226f33bd891b36150ca6d6e364278ffb3206 100644 (file)
@@ -798,8 +798,8 @@ Curl_cookie_add(struct Curl_easy *data,
   /* Check if the domain is a Public Suffix and if yes, ignore the cookie.
      This needs a libpsl compiled with builtin data. */
   if(domain && co->domain && !isip(co->domain)) {
-    if(((psl = psl_builtin()) != NULL)
-        && !psl_is_cookie_domain_acceptable(psl, domain, co->domain)) {
+    psl = psl_builtin();
+    if(psl && !psl_is_cookie_domain_acceptable(psl, domain, co->domain)) {
       infof(data,
             "cookie '%s' dropped, domain '%s' must not set cookies for '%s'\n",
             co->name, domain, co->domain);
index c8ff83c799992f3d8ff2a45049a44d30527cce39..61cdaddc1bee93ae58a13772d3aa0dcea318d4b6 100644 (file)
@@ -146,7 +146,8 @@ Curl_getaddrinfo_ex(const char *nodename,
     if((size_t)ai->ai_addrlen < ss_size)
       continue;
 
-    if((ca = malloc(sizeof(Curl_addrinfo))) == NULL) {
+    ca = malloc(sizeof(Curl_addrinfo));
+    if(!ca) {
       error = EAI_MEMORY;
       break;
     }
@@ -163,7 +164,8 @@ Curl_getaddrinfo_ex(const char *nodename,
     ca->ai_canonname = NULL;
     ca->ai_next      = NULL;
 
-    if((ca->ai_addr = malloc(ss_size)) == NULL) {
+    ca->ai_addr = malloc(ss_size);
+    if(!ca->ai_addr) {
       error = EAI_MEMORY;
       free(ca);
       break;
@@ -171,7 +173,8 @@ Curl_getaddrinfo_ex(const char *nodename,
     memcpy(ca->ai_addr, ai->ai_addr, ss_size);
 
     if(ai->ai_canonname != NULL) {
-      if((ca->ai_canonname = strdup(ai->ai_canonname)) == NULL) {
+      ca->ai_canonname = strdup(ai->ai_canonname);
+      if(!ca->ai_canonname) {
         error = EAI_MEMORY;
         free(ca->ai_addr);
         free(ca);
@@ -291,16 +294,19 @@ Curl_he2ai(const struct hostent *he, int port)
 #endif
       ss_size = sizeof(struct sockaddr_in);
 
-    if((ai = calloc(1, sizeof(Curl_addrinfo))) == NULL) {
+    ai = calloc(1, sizeof(Curl_addrinfo));
+    if(!ai) {
       result = CURLE_OUT_OF_MEMORY;
       break;
     }
-    if((ai->ai_canonname = strdup(he->h_name)) == NULL) {
+    ai->ai_canonname = strdup(he->h_name);
+    if(!ai->ai_canonname) {
       result = CURLE_OUT_OF_MEMORY;
       free(ai);
       break;
     }
-    if((ai->ai_addr = calloc(1, ss_size)) == NULL) {
+    ai->ai_addr = calloc(1, ss_size);
+    if(!ai->ai_addr) {
       result = CURLE_OUT_OF_MEMORY;
       free(ai->ai_canonname);
       free(ai);
@@ -475,8 +481,9 @@ Curl_addrinfo *Curl_str2addr(char *address, int port)
 /**
  * Given a path to a Unix domain socket, return a newly allocated Curl_addrinfo
  * struct initialized with this path.
+ * Set '*longpath' to TRUE if the error is a too long path.
  */
-Curl_addrinfo *Curl_unix2addr(const char *path)
+Curl_addrinfo *Curl_unix2addr(const char *path, int *longpath)
 {
   Curl_addrinfo *ai;
   struct sockaddr_un *sa_un;
@@ -485,8 +492,10 @@ Curl_addrinfo *Curl_unix2addr(const char *path)
   ai = calloc(1, sizeof(Curl_addrinfo));
   if(!ai)
     return NULL;
-  if((ai->ai_addr = calloc(1, sizeof(struct sockaddr_un))) == NULL) {
+  ai->ai_addr = calloc(1, sizeof(struct sockaddr_un));
+  if(!ai->ai_addr) {
     free(ai);
+    *longpath = FALSE;
     return NULL;
   }
   /* sun_path must be able to store the NUL-terminated path */
@@ -494,6 +503,7 @@ Curl_addrinfo *Curl_unix2addr(const char *path)
   if(path_len >= sizeof(sa_un->sun_path)) {
     free(ai->ai_addr);
     free(ai);
+    *longpath = TRUE;
     return NULL;
   }
 
index 1a681e61efabb45e87978e61070b360259605259..4f24730af638a20e2400f3cad38f23a533a81762 100644 (file)
@@ -80,7 +80,7 @@ Curl_ip2addr(int af, const void *inaddr, const char *hostname, int port);
 Curl_addrinfo *Curl_str2addr(char *dotted, int port);
 
 #ifdef USE_UNIX_SOCKETS
-Curl_addrinfo *Curl_unix2addr(const char *path);
+Curl_addrinfo *Curl_unix2addr(const char *path, int *longpath);
 #endif
 
 #if defined(CURLDEBUG) && defined(HAVE_GETADDRINFO) && \
index 4699d8f4258e670d8bff79deddfb1dfe70771e0a..6a90e6236c292570f1d16e7ba6c7ce482cd73f64 100644 (file)
@@ -157,7 +157,8 @@ static CURLcode ntlm_wb_init(struct connectdata *conn, const char *userp)
   }
   slash = strpbrk(username, "\\/");
   if(slash) {
-    if((domain = strdup(username)) == NULL)
+    domain = strdup(username);
+    if(!domain)
       return CURLE_OUT_OF_MEMORY;
     slash = domain + (slash - username);
     *slash = '\0';
index 53dee39f455f626bca9942c5cae966124f2dacfd..abd2da0751d5aa5de3dea8a8a3b4b771252a0626 100644 (file)
@@ -949,8 +949,8 @@ void Curl_formclean(struct FormData **form_ptr)
     if(form->type <= FORM_CONTENT)
       free(form->line); /* free the line */
     free(form);       /* free the struct */
-
-  } while((form = next) != NULL); /* continue */
+    form = next;
+  } while(form); /* continue */
 
   *form_ptr = NULL;
 }
@@ -1031,8 +1031,8 @@ void curl_formfree(struct curl_httppost *form)
     free(form->contenttype); /* free the content type */
     free(form->showfilename); /* free the faked file name */
     free(form);       /* free the struct */
-
-  } while((form = next) != NULL); /* continue */
+    form = next;
+  } while(form); /* continue */
 }
 
 #ifndef HAVE_BASENAME
@@ -1374,8 +1374,8 @@ CURLcode Curl_getformdata(struct Curl_easy *data,
       if(result)
         break;
     }
-
-  } while((post = post->next) != NULL); /* for each field */
+    post = post->next;
+  } while(post); /* for each field */
 
   /* end-boundary for everything */
   if(!result)
index 683f05de49ac8a04fbd8f430063b4d2b380a66f8..c7c2755494d73d42876ec9c6b8cedb268d919b77 100644 (file)
--- a/lib/ftp.c
+++ b/lib/ftp.c
@@ -1035,7 +1035,8 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
     if(*string_ftpport == '[') {
       /* [ipv6]:port(-range) */
       ip_start = string_ftpport + 1;
-      if((ip_end = strchr(string_ftpport, ']')) != NULL)
+      ip_end = strchr(string_ftpport, ']');
+      if(ip_end)
         strncpy(addr, ip_start, ip_end - ip_start);
     }
     else
@@ -1043,30 +1044,35 @@ static CURLcode ftp_state_use_port(struct connectdata *conn,
       if(*string_ftpport == ':') {
         /* :port */
         ip_end = string_ftpport;
-    }
-    else if((ip_end = strchr(string_ftpport, ':')) != NULL) {
-        /* either ipv6 or (ipv4|domain|interface):port(-range) */
-#ifdef ENABLE_IPV6
-      if(Curl_inet_pton(AF_INET6, string_ftpport, sa6) == 1) {
-        /* ipv6 */
-        port_min = port_max = 0;
-        strcpy(addr, string_ftpport);
-        ip_end = NULL; /* this got no port ! */
       }
-      else
+      else {
+        ip_end = strchr(string_ftpport, ':');
+        if(ip_end) {
+          /* either ipv6 or (ipv4|domain|interface):port(-range) */
+#ifdef ENABLE_IPV6
+          if(Curl_inet_pton(AF_INET6, string_ftpport, sa6) == 1) {
+            /* ipv6 */
+            port_min = port_max = 0;
+            strcpy(addr, string_ftpport);
+            ip_end = NULL; /* this got no port ! */
+          }
+          else
 #endif
-        /* (ipv4|domain|interface):port(-range) */
-        strncpy(addr, string_ftpport, ip_end - ip_start);
-    }
-    else
-      /* ipv4|interface */
-      strcpy(addr, string_ftpport);
+            /* (ipv4|domain|interface):port(-range) */
+            strncpy(addr, string_ftpport, ip_end - ip_start);
+        }
+        else
+          /* ipv4|interface */
+          strcpy(addr, string_ftpport);
+      }
 
     /* parse the port */
     if(ip_end != NULL) {
-      if((port_start = strchr(ip_end, ':')) != NULL) {
+      port_start = strchr(ip_end, ':');
+      if(port_start) {
         port_min = curlx_ultous(strtoul(port_start+1, NULL, 10));
-        if((port_sep = strchr(port_start, '-')) != NULL) {
+        port_sep = strchr(port_start, '-');
+        if(port_sep) {
           port_max = curlx_ultous(strtoul(port_sep + 1, NULL, 10));
         }
         else
index fba33d8e600d32f98ef1c36ce0723652af7dad15..4c1c07fe746324089b9d45032ed64b3d36e94a2a 100644 (file)
@@ -840,9 +840,11 @@ CURLcode Curl_http_input_auth(struct connectdata *conn, bool proxy,
                   auth += strlen("NTLM");
                   while(*auth && ISSPACE(*auth))
                     auth++;
-                  if(*auth)
-                    if((conn->challenge_header = strdup(auth)) == NULL)
+                  if(*auth) {
+                    conn->challenge_header = strdup(auth);
+                    if(!conn->challenge_header)
                       return CURLE_OUT_OF_MEMORY;
+                  }
                 }
               }
 #endif
index 91b88a383bd9c6f6e7bc76e3f399b4a73b36bc63..0ed02493db497913095370dc455f0324d4d7b590 100644 (file)
@@ -75,7 +75,7 @@ CURLcode Curl_output_digest(struct connectdata *conn,
   CURLcode result;
   struct Curl_easy *data = conn->data;
   unsigned char *path;
-  char *tmp;
+  char *tmp = NULL;
   char *response;
   size_t len;
   bool have_chlg;
@@ -140,12 +140,14 @@ CURLcode Curl_output_digest(struct connectdata *conn,
      http://www.fngtps.com/2006/09/http-authentication
   */
 
-  if(authp->iestyle && ((tmp = strchr((char *)uripath, '?')) != NULL)) {
-    size_t urilen = tmp - (char *)uripath;
-
-    path = (unsigned char *) aprintf("%.*s", urilen, uripath);
+  if(authp->iestyle) {
+    tmp = strchr((char *)uripath, '?');
+    if(tmp) {
+      size_t urilen = tmp - (char *)uripath;
+      path = (unsigned char *) aprintf("%.*s", urilen, uripath);
+    }
   }
-  else
+  if(!tmp)
     path = (unsigned char *) strdup((char *) uripath);
 
   if(!path)
index bff8ddaddcd798a34531e7073f56500a53fe907c..475f44abc6bed29177e3369263e5f5254c9b7af3 100644 (file)
@@ -103,7 +103,8 @@ inet_pton4(const char *src, unsigned char *dst)
   while((ch = *src++) != '\0') {
     const char *pch;
 
-    if((pch = strchr(digits, ch)) != NULL) {
+    pch = strchr(digits, ch);
+    if(pch) {
       unsigned int val = *tp * 10 + (unsigned int)(pch - digits);
 
       if(saw_digit && *tp == 0)
@@ -169,7 +170,8 @@ inet_pton6(const char *src, unsigned char *dst)
   while((ch = *src++) != '\0') {
     const char *pch;
 
-    if((pch = strchr((xdigits = xdigits_l), ch)) == NULL)
+    pch = strchr((xdigits = xdigits_l), ch);
+    if(!pch)
       pch = strchr((xdigits = xdigits_u), ch);
     if(pch != NULL) {
       val <<= 4;
index 60f73a28bb203f35cde1008cc2ac32dfa9c2bd36..1bdc9f367cd19fcf0746734907ba37601fdc303c 100644 (file)
--- a/lib/md4.c
+++ b/lib/md4.c
@@ -213,7 +213,8 @@ static void MD4_Update(MD4_CTX *ctx, const void *data, unsigned long size)
   unsigned long used, available;
 
   saved_lo = ctx->lo;
-  if((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo)
+  ctx->lo = (saved_lo + size) & 0x1fffffff;
+  if(ctx->lo < saved_lo)
     ctx->hi++;
   ctx->hi += (MD4_u32plus)size >> 29;
 
index 7a1cac902bbcb664a35ae87b2ec23f331d9a967a..f2dc16c099e8374d2243e145446ee55def26611c 100644 (file)
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -402,7 +402,8 @@ static void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size)
   unsigned long used, available;
 
   saved_lo = ctx->lo;
-  if((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo)
+  ctx->lo = (saved_lo + size) & 0x1fffffff;
+  if(ctx->lo < saved_lo)
     ctx->hi++;
   ctx->hi += (MD5_u32plus)size >> 29;
 
index 27e33e472dc8dc07996b7ba9186f8468e921fb35..290cbe31f484bd5ac2a93e9110a481e331788162 100644 (file)
@@ -184,7 +184,8 @@ int GetOrSetUpData(int id, libdata_t **appData,
      */
     NXLock(gLibLock);
 
-    if(!(app_data = (libdata_t *) get_app_data(id))) {
+    app_data = (libdata_t *) get_app_data(id);
+    if(!app_data) {
       app_data = malloc(sizeof(libdata_t));
 
       if(app_data) {
@@ -259,7 +260,8 @@ int GetOrSetUpData(int id, libdata_t **appData,
           err         = ENOMEM;
         }
 
-        if((err = NXKeySetValue(key, thread_data))) {
+        err = NXKeySetValue(key, thread_data);
+        if(err) {
           free(thread_data->twentybytes);
           free(thread_data);
           thread_data = (libthreaddata_t *) NULL;
index 80831dbfad295cb8edb7f8d448b78f9d7afc9ca2..9b014a4ffe574b1a97fd9d8c0d037d5821a99e0b 100644 (file)
--- a/lib/ssh.c
+++ b/lib/ssh.c
@@ -782,14 +782,14 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
           state(conn, SSH_AUTH_DONE);
           break;
         }
-        else if((err = libssh2_session_last_errno(sshc->ssh_session)) ==
-           LIBSSH2_ERROR_EAGAIN) {
-          rc = LIBSSH2_ERROR_EAGAIN;
-          break;
-        }
         else {
-          state(conn, SSH_SESSION_FREE);
-          sshc->actualcode = libssh2_session_error_to_CURLE(err);
+          err = libssh2_session_last_errno(sshc->ssh_session);
+          if(err == LIBSSH2_ERROR_EAGAIN)
+            rc = LIBSSH2_ERROR_EAGAIN;
+          else {
+            state(conn, SSH_SESSION_FREE);
+            sshc->actualcode = libssh2_session_error_to_CURLE(err);
+          }
           break;
         }
       }
@@ -1987,12 +1987,14 @@ static CURLcode ssh_statemach_act(struct connectdata *conn, bool *block)
           break;
         }
       }
-      if((sshc->readdir_filename = malloc(PATH_MAX+1)) == NULL) {
+      sshc->readdir_filename = malloc(PATH_MAX+1);
+      if(!sshc->readdir_filename) {
         state(conn, SSH_SFTP_CLOSE);
         sshc->actualcode = CURLE_OUT_OF_MEMORY;
         break;
       }
-      if((sshc->readdir_longentry = malloc(PATH_MAX+1)) == NULL) {
+      sshc->readdir_longentry = malloc(PATH_MAX+1);
+      if(!sshc->readdir_longentry) {
         Curl_safefree(sshc->readdir_filename);
         state(conn, SSH_SFTP_CLOSE);
         sshc->actualcode = CURLE_OUT_OF_MEMORY;
@@ -2789,13 +2791,16 @@ static int ssh_getsock(struct connectdata *conn,
 static void ssh_block2waitfor(struct connectdata *conn, bool block)
 {
   struct ssh_conn *sshc = &conn->proto.sshc;
-  int dir;
-  if(block && (dir = libssh2_session_block_directions(sshc->ssh_session))) {
-    /* translate the libssh2 define bits into our own bit defines */
-    conn->waitfor = ((dir&LIBSSH2_SESSION_BLOCK_INBOUND)?KEEP_RECV:0) |
-      ((dir&LIBSSH2_SESSION_BLOCK_OUTBOUND)?KEEP_SEND:0);
+  int dir = 0;
+  if(block) {
+    dir = libssh2_session_block_directions(sshc->ssh_session);
+    if(dir) {
+      /* translate the libssh2 define bits into our own bit defines */
+      conn->waitfor = ((dir&LIBSSH2_SESSION_BLOCK_INBOUND)?KEEP_RECV:0) |
+        ((dir&LIBSSH2_SESSION_BLOCK_OUTBOUND)?KEEP_SEND:0);
+    }
   }
-  else
+  if(!dir)
     /* It didn't block or libssh2 didn't reveal in which direction, put back
        the original set */
     conn->waitfor = sshc->orig_waitfor;
index 8f8ce036c71cf1048b478244259e8a21032d66a2..7e5cde47b524232ec90480a2154db7df28148804 100644 (file)
@@ -715,10 +715,12 @@ const char *Curl_strerror(struct connectdata *conn, int err)
   buf[max] = '\0'; /* make sure the string is zero terminated */
 
   /* strip trailing '\r\n' or '\n'. */
-  if((p = strrchr(buf, '\n')) != NULL && (p - buf) >= 2)
-     *p = '\0';
-  if((p = strrchr(buf, '\r')) != NULL && (p - buf) >= 1)
-     *p = '\0';
+  p = strrchr(buf, '\n');
+  if(p && (p - buf) >= 2)
+    *p = '\0';
+  p = strrchr(buf, '\r');
+  if(p && (p - buf) >= 1)
+    *p = '\0';
 
   if(old_errno != ERRNO)
     SET_ERRNO(old_errno);
@@ -1035,10 +1037,12 @@ const char *Curl_sspi_strerror (struct connectdata *conn, int err)
     if(msg_formatted) {
       msgbuf[sizeof(msgbuf)-1] = '\0';
       /* strip trailing '\r\n' or '\n' */
-      if((p = strrchr(msgbuf, '\n')) != NULL && (p - msgbuf) >= 2)
-         *p = '\0';
-      if((p = strrchr(msgbuf, '\r')) != NULL && (p - msgbuf) >= 1)
-         *p = '\0';
+      p = strrchr(msgbuf, '\n');
+      if(p && (p - msgbuf) >= 2)
+        *p = '\0';
+      p = strrchr(msgbuf, '\r');
+      if(p && (p - msgbuf) >= 1)
+        *p = '\0';
       msg = msgbuf;
     }
     if(msg)
index 935cde35b15f836dcde2aa1e4c23292b398a9856..551af60f2a239812f25380ef3240a1a71c98b908 100644 (file)
@@ -1489,7 +1489,8 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
 
       events.lNetworkEvents = 0;
       if(SOCKET_ERROR == enum_netevents_func(sockfd, event_handle, &events)) {
-        if((err = SOCKERRNO) != EINPROGRESS) {
+        err = SOCKERRNO;
+        if(err != EINPROGRESS) {
           infof(data, "WSAEnumNetworkEvents failed (%d)", err);
           keepon = FALSE;
           result = CURLE_READ_ERROR;
index acdda631365e3d2ac043d16ba2a917f660398656..45262d8970a82b699b8c0a6144152a83921c77ad 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -5822,18 +5822,22 @@ static CURLcode resolve_server(struct Curl_easy *data,
       hostaddr = calloc(1, sizeof(struct Curl_dns_entry));
       if(!hostaddr)
         result = CURLE_OUT_OF_MEMORY;
-      else if((hostaddr->addr = Curl_unix2addr(path)) != NULL)
-        hostaddr->inuse++;
       else {
-        /* Long paths are not supported for now */
-        if(strlen(path) >= sizeof(((struct sockaddr_un *)0)->sun_path)) {
-          failf(data, "Unix socket path too long: '%s'", path);
-          result = CURLE_COULDNT_RESOLVE_HOST;
+        int longpath=0;
+        hostaddr->addr = Curl_unix2addr(path, &longpath);
+        if(hostaddr->addr)
+          hostaddr->inuse++;
+        else {
+          /* Long paths are not supported for now */
+          if(longpath) {
+            failf(data, "Unix socket path too long: '%s'", path);
+            result = CURLE_COULDNT_RESOLVE_HOST;
+          }
+          else
+            result = CURLE_OUT_OF_MEMORY;
+          free(hostaddr);
+          hostaddr = NULL;
         }
-        else
-          result = CURLE_OUT_OF_MEMORY;
-        free(hostaddr);
-        hostaddr = NULL;
       }
     }
     else
index 1435284b80d4a68821a1b706ebe63696386bcc56..0e308cb79f060c72dc4f21f0894d72a248bafa41 100644 (file)
@@ -242,7 +242,8 @@ static gnutls_datum_t load_file(const char *file)
   long filelen;
   void *ptr;
 
-  if(!(f = fopen(file, "rb")))
+  f = fopen(file, "rb");
+  if(!f)
     return loaded_file;
   if(fseek(f, 0, SEEK_END) != 0
      || (filelen = ftell(f)) < 0
index 455bad6418e264a8f6251c85fa7a512a0eec33ce..ba8d58260ba36847dc1f3f6a86b15c04c53a6922 100644 (file)
@@ -254,7 +254,8 @@ static SECStatus set_ciphers(struct Curl_easy *data, PRFileDesc * model,
     while((*cipher) && (ISSPACE(*cipher)))
       ++cipher;
 
-    if((cipher_list = strchr(cipher, ','))) {
+    cipher_list = strchr(cipher, ',');
+    if(cipher_list) {
       *cipher_list++ = '\0';
     }
 
index 75051d41ec11f4c95182d21d8d408fb82b9d1fd1..94410df4bdd4ae65a589bb9c584256462b565617 100644 (file)
@@ -2336,7 +2336,8 @@ static int asn1_object_dump(ASN1_OBJECT *a, char *buf, size_t len)
 {
   int i, ilen;
 
-  if((ilen = (int)len) < 0)
+  ilen = (int)len;
+  if(ilen < 0)
     return 1; /* buffer too big */
 
   i = i2t_ASN1_OBJECT(buf, ilen, a);
index 247f8d38c7abc626d9ec5c89ffd1a524803dac75..9b5c9a54c1142522a2b6a253767e620fa4eefa87 100644 (file)
@@ -757,7 +757,11 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
       case '@': /* the URL! */
       {
         struct getout *url;
-        if(config->url_get || ((config->url_get = config->url_list) != NULL)) {
+
+        if(!config->url_get)
+          config->url_get = config->url_list;
+
+        if(config->url_get) {
           /* there's a node here, if it already is filled-in continue to find
              an "empty" node */
           while(config->url_get && (config->url_get->flags & GETOUT_URL))
@@ -1687,7 +1691,9 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
       /* output file */
     {
       struct getout *url;
-      if(config->url_out || ((config->url_out = config->url_list) != NULL)) {
+      if(!config->url_out)
+        config->url_out = config->url_list;
+      if(config->url_out) {
         /* there's a node here, if it already is filled-in continue to find
            an "empty" node */
         while(config->url_out && (config->url_out->flags & GETOUT_OUTFILE))
@@ -1824,7 +1830,9 @@ ParameterError getparameter(char *flag,    /* f or -long-flag */
       /* we are uploading */
     {
       struct getout *url;
-      if(config->url_out || ((config->url_out = config->url_list) != NULL)) {
+      if(!config->url_out)
+        config->url_out = config->url_list;
+      if(config->url_out) {
         /* there's a node here, if it already is filled-in continue to find
            an "empty" node */
         while(config->url_out && (config->url_out->flags & GETOUT_UPLOAD))
index 09910a7848847f8765a1b5c9fa104cefd37f597a..257e5c697bf2bbcfeca6e3a771d1e2cb7f7fbce9 100644 (file)
@@ -66,12 +66,15 @@ ParameterError file2string(char **bufp, FILE *file)
 
   if(file) {
     while(fgets(buffer, sizeof(buffer), file)) {
-      if((ptr = strchr(buffer, '\r')) != NULL)
+      ptr = strchr(buffer, '\r');
+      if(ptr)
         *ptr = '\0';
-      if((ptr = strchr(buffer, '\n')) != NULL)
+      ptr = strchr(buffer, '\n');
+      if(ptr)
         *ptr = '\0';
       buflen = strlen(buffer);
-      if((ptr = realloc(string, stringlen+buflen+1)) == NULL) {
+      ptr = realloc(string, stringlen+buflen+1);
+      if(!ptr) {
         Curl_safefree(string);
         return PARAM_NO_MEM;
       }
@@ -102,7 +105,8 @@ ParameterError file2memory(char **bufp, size_t *size, FILE *file)
         }
         alloc *= 2;
         /* allocate an extra char, reserved space, for null termination */
-        if((newbuf = realloc(buffer, alloc+1)) == NULL) {
+        newbuf = realloc(buffer, alloc+1);
+        if(!newbuf) {
           Curl_safefree(buffer);
           return PARAM_NO_MEM;
         }
@@ -115,7 +119,8 @@ ParameterError file2memory(char **bufp, size_t *size, FILE *file)
     buffer[nused] = '\0';
     /* free trailing slack space, if possible */
     if(alloc != nused) {
-      if((newbuf = realloc(buffer, nused+1)) == NULL) {
+      newbuf = realloc(buffer, nused+1);
+      if(!newbuf) {
         Curl_safefree(buffer);
         return PARAM_NO_MEM;
       }
index e1b7819ed249191f4e3116b1d3ceeb2f9544dd6d..2fb77742ad4b2c8c7e6e9eb28c4a976587e1fbbc 100644 (file)
@@ -124,9 +124,14 @@ void ourWriteOut(CURL *curl, struct OutStruct *outs, const char *writeinfo)
         char *end;
         char keepit;
         int i;
-        if(('{' == ptr[1]) && ((end = strchr(ptr, '}')) != NULL)) {
+        if('{' == ptr[1]) {
           bool match = FALSE;
+          end = strchr(ptr, '}');
           ptr += 2; /* pass the % and the { */
+          if(!end) {
+            fputs("%{", stream);
+            continue;
+          }
           keepit = *end;
           *end = 0; /* zero terminate */
           for(i = 0; replacements[i].name; i++) {
index aeaf6b25e153da6a5089bca5bed23da60cec025c..7763c2233f46c625b7dd9798bfb4f0aa7b400f81 100644 (file)
@@ -136,7 +136,8 @@ int test(char *URL)
              "http://testserver.example.com:%s/%s%04d", port, path, i);
 
     /* second request must succeed like the first one */
-    if((res = do_one_request(multi, target_url, dns_entry)))
+    res = do_one_request(multi, target_url, dns_entry);
+    if(res)
       goto test_cleanup;
 
     if(i < count)
index a4ce79b506618c31e7d4e00408018fe2d0d94660..4d5b0c88c2fc954b9526c45e08baf62a4d998c0c 100644 (file)
@@ -81,7 +81,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index c58ebeda94d509e536b1603001a13dae3206eeb0..39d51bb114c0f6dd31997519c18a50bb267237a5 100644 (file)
@@ -56,7 +56,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index ef66a484da5a7bee4e9db2eb9267435f019ac61a..b2d2a4118c334f9ca9b6b242737695ab40e105c5 100644 (file)
@@ -54,7 +54,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index f008cf1e43b53d98dbd612dbd140f0082ac85a67..5dec7fcc0e24b80f93a5462549d202615473549c 100644 (file)
@@ -55,7 +55,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 09af481f43d1aebd2cd5102321a0e7b145d3f9ca..a130c49afc9dfba4de0e52c8f51f98e327a57d40 100644 (file)
@@ -37,7 +37,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 3333ae698a9111e2335b0918085d819f60c4da89..c63a109b816182d166332e1e982ac5cca1ffb4ed 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -36,7 +36,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index d1ca34c2a512769a683fa5d72fcee7e9265a647d..6fc69f25103311f5aa251f92dc9cb495bdf13458 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -46,7 +46,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index de403e195053503731adc59b1d99a17e54e75cdb..ada94b940323092f2a540ea1221d6e42a29dd334 100644 (file)
@@ -136,7 +136,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(curl == NULL) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 43b05982c475667ba87e8b196229a87a83c55f70..d17b24b20f4daa2870859210f209ab3464ac77fc 100644 (file)
@@ -68,7 +68,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 2a105f0cd1115c14a74cbee9ec299ea512c1daa0..7a23412465076c3b4e23b87d9cc9eab39f493818 100644 (file)
@@ -35,7 +35,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 32995e1dbcb4b70f3653018312f8a0677818ae6c..20d94877cca305b77e5a9b403acb2076790dc764 100644 (file)
@@ -195,7 +195,8 @@ int test(char *URL)
 
   /* prepare share */
   printf("SHARE_INIT\n");
-  if((share = curl_share_init()) == NULL) {
+  share = curl_share_init();
+  if(!share) {
     fprintf(stderr, "curl_share_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
@@ -230,7 +231,8 @@ int test(char *URL)
   }
 
   /* initial cookie manipulation */
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_share_cleanup(share);
     curl_global_cleanup();
@@ -275,7 +277,8 @@ int test(char *URL)
 
   /* fetch a another one and save cookies */
   printf("*** run %d\n", i);
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_share_cleanup(share);
     curl_global_cleanup();
@@ -302,7 +305,8 @@ int test(char *URL)
   curl_slist_free_all(headers);
 
   /* load cookies */
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_share_cleanup(share);
     curl_global_cleanup();
index cb60ce1bd694850c23fab12d54ee9734fa009862..1f6c6838aecf4488b82d61bc5fd4116e44e1c088 100644 (file)
@@ -62,7 +62,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 085a9753eaffd47277f7e8f39a61bdc24bbc7d9a..a2522eb853e135a6b44b91b8f77f26d23b744fdb 100644 (file)
@@ -122,7 +122,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index cb5296ec36c20ac430a9eab5317273602ef05957..68588cfe6c6caa56611b6e6d63959a8c696de801 100644 (file)
@@ -68,7 +68,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 0b7ae6f43b2ea8928e43ceb31dc48ec4b7fb04c7..2467bf0b09439aa418ab46d2f7df9dfea94ed60d 100644 (file)
@@ -33,7 +33,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 58091ef6aa15c8a45ff0dbbe90787025dcffc5cf..7c34bc4dbc412f2bbab6452110d13cf30d914ddb 100644 (file)
@@ -42,7 +42,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index f516d094229ea4c67e98e1dfc6707e60763433f4..7b33d52f9ac59eca6dd4efa860f6ea60226ba78e 100644 (file)
@@ -33,7 +33,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index d3e6e446a0c79bedeb171129dc028c2ac21c1de4..6fb1787205350b40c13aa902bdcc69df2efdfa92 100644 (file)
@@ -33,7 +33,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 9faf262c6d228cf887817a3de266ee9b021ef498..00c54c450f76797ee42546a9f50bd45e6d48d14b 100644 (file)
@@ -33,7 +33,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index e37a7771d131f07e255c114c652261477adb5d95..960fcfca2ef2c9d3b239e13fee08fb1abf38b43e 100644 (file)
@@ -489,7 +489,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     close_file_descriptors();
     curl_global_cleanup();
index 6e3059892d0d8f672bd58eecb369a29d93e4cd14..5c55aebe6c04897118b261520c549c12ceca8e89 100644 (file)
@@ -33,7 +33,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index b5a71da27a34ad32d449f76c3b26f210e55452d7..72b0875edf0211e6e8a5a954320634d8762540c5 100644 (file)
@@ -33,7 +33,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 40f4def4f4ab0e477e1e49b06f4cf4d51464611d..b7efca0be956e9a43966b0f342c01ee1adcd1e73 100644 (file)
@@ -33,7 +33,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index f3264690da815f803abeab7d1f40575326f66bf1..44aa2e2e923b6342fb4c159579bdf401d590b455 100644 (file)
@@ -33,7 +33,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 3440562b22904dbcbaafd66b5690825247a7de46..08fd34dfc05d91a66734bde43e3d4d5d9faf02ef 100644 (file)
@@ -33,7 +33,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index c1561419affbe360420b88498b0cf5dd7e4fe744..6d7c3e40fb02308c8647002a8134b4c749f48ced 100644 (file)
@@ -491,7 +491,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     close_file_descriptors();
     curl_global_cleanup();
index beee9140130e5ed0df6a58047a3312e73b8151b7..7c03dd2fd011426ed56a5bd102427663d92da18c 100644 (file)
@@ -35,7 +35,8 @@ int test(char *URL)
      return TEST_ERR_MAJOR_BAD;
    }
 
-   if((curl = curl_easy_init()) == NULL) {
+   curl = curl_easy_init();
+   if(!curl) {
      fprintf(stderr, "curl_easy_init() failed\n");
      curl_global_cleanup();
      return TEST_ERR_MAJOR_BAD;
index 604446a2ee30e5aba488011d0a114f77eb5a6f76..3e9cb3ccd410ca17be24d05a6cf5affa3b9db8c3 100644 (file)
@@ -79,7 +79,8 @@ int test(char *URL)
   }
 
   /* get a curl handle */
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     fclose(hd_src);
index c82ccd5b70318f00974f1e5ba870b0403865d61e..4016874e13bfdda3f266e1fa541e2fa444664d84 100644 (file)
@@ -42,7 +42,8 @@ int test(char *URL)
   }
 
   /* get a curl handle */
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 90aed21936048989d6b3aae5be0ba0a2970e548d..6d2532d1229c136052b2ab4264e904ed1e0834b3 100644 (file)
@@ -36,7 +36,8 @@ int test(char *URL)
   char *s;
   (void)URL;
 
-  if((easy = curl_easy_init()) == NULL) {
+  easy = curl_easy_init();
+  if(!easy) {
     fprintf(stderr, "curl_easy_init() failed\n");
     return TEST_ERR_MAJOR_BAD;
   }
index 4b08a0a76ff31bfcfb20dcc3252178e879a72e79..28eacdaf653bcf8a655457ece478068d49615c30 100644 (file)
@@ -47,7 +47,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 4ec42a3309d064d98d5ab2dce151564b95d84162..ce967c085828925bae037b9c1e8996bdfc7c02d2 100644 (file)
@@ -90,7 +90,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 137029548f7d56b411cebee6dfd8850c371a5dc9..1d832b536c981050cf12b00285054846b7fa1e6a 100644 (file)
@@ -38,7 +38,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index ae2e691f10e6bff23fcf9831f96bb73443c6051a..967e2114149144daf2069d036a4340fade6fb107 100644 (file)
@@ -172,7 +172,8 @@ int test(char *URL)
 
   config.trace_ascii = 1; /* enable ascii tracing */
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 9afaad48f55755c2aad86baf6cbb4afcb19c90ba..288f4c1d15684861aca7f22ccf6a4bb09be8d7b9 100644 (file)
@@ -67,7 +67,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 803df26d1b4e14776f1be7e544bc855ed5f8db01..083746243081a2e23335c45b3f644aaafc24017a 100644 (file)
@@ -162,7 +162,8 @@ static int once(char *URL, bool oldstyle)
   if(formrc)
     printf("curl_formadd(4) = %d\n", (int)formrc);
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_formfree(formpost);
     curl_global_cleanup();
index 527935396a0df3d3ad2440b3c1922510258cd446..a26101940bdcebdcf78a1aa51d9fe5643884d9e2 100644 (file)
@@ -45,7 +45,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 819b50759fdfbe8956cc0b348527528909cd22c3..285b9f5d0a7492fa8718ba4d8bd15c65ed8aacf4 100644 (file)
@@ -46,7 +46,8 @@ int test(char *URL)
   }
 
   /* get a curl handle */
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 94a91d5dd46cc43ad994c0172f632b0fa3965d1d..ecf8c5530b76f54c0fda602f531a1aea12313f0c 100644 (file)
@@ -35,7 +35,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 38e0c0b78ab3d8c3db8366779805a9ba1b8a06a4..f9f55e3c09cfc90cec14dff7d0a1a20fd4296a60 100644 (file)
@@ -37,7 +37,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 9b3a07787c9c5ae7253d76db0ea8e347662c6070..0cdef812b810d31cdb3967cd1f0abcc35d387994 100644 (file)
@@ -55,7 +55,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
@@ -66,7 +67,8 @@ int test(char *URL)
 
   test_setopt(curl, CURLOPT_URL, URL);
 
-  if((stream_uri = suburl(URL, request++)) == NULL) {
+  stream_uri = suburl(URL, request++);
+  if(!stream_uri) {
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
@@ -100,7 +102,8 @@ int test(char *URL)
   sdpf = NULL;
 
   /* Make sure we can do a normal request now */
-  if((stream_uri = suburl(URL, request++)) == NULL) {
+  stream_uri = suburl(URL, request++);
+  if(!stream_uri) {
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
@@ -115,7 +118,8 @@ int test(char *URL)
 
   /* Now do a POST style one */
 
-  if((stream_uri = suburl(URL, request++)) == NULL) {
+  stream_uri = suburl(URL, request++);
+  if(!stream_uri) {
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
@@ -144,7 +148,8 @@ int test(char *URL)
   custom_headers = NULL;
 
   /* Make sure we can do a normal request now */
-  if((stream_uri = suburl(URL, request++)) == NULL) {
+  stream_uri = suburl(URL, request++);
+  if(!stream_uri) {
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
index 55282b69b34ce9dc8b8a76ffaf731310a4abe283..d7381d9a23312f78739b85a6fd7f886c43d77194 100644 (file)
@@ -53,7 +53,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     fclose(idfile);
@@ -77,7 +78,8 @@ int test(char *URL)
 
   /* Go through the various Session IDs */
   for(i = 0; i < 3; i++) {
-    if((stream_uri = suburl(URL, request++)) == NULL) {
+    stream_uri = suburl(URL, request++);
+    if(!stream_uri) {
       res = TEST_ERR_MAJOR_BAD;
       goto test_cleanup;
     }
@@ -96,7 +98,8 @@ int test(char *URL)
     fprintf(idfile, "Got Session ID: [%s]\n", rtsp_session_id);
     rtsp_session_id = NULL;
 
-    if((stream_uri = suburl(URL, request++)) == NULL) {
+    stream_uri = suburl(URL, request++);
+    if(!stream_uri) {
       res = TEST_ERR_MAJOR_BAD;
       goto test_cleanup;
     }
index 2dc57b7612ba5ee160b259d2ec7e143821e38c63..9d9b5a1344e12940a64d84ec224515bacfcac6d0 100644 (file)
@@ -40,7 +40,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
@@ -54,7 +55,8 @@ int test(char *URL)
 
   test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_OPTIONS);
 
-  if((stream_uri = suburl(URL, request++)) == NULL) {
+  stream_uri = suburl(URL, request++);
+  if(!stream_uri) {
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
@@ -74,7 +76,8 @@ int test(char *URL)
                     "RAW/RAW/UDP;unicast;client_port=3056-3057");
   test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_SETUP);
 
-  if((stream_uri = suburl(URL, request++)) == NULL) {
+  stream_uri = suburl(URL, request++);
+  if(!stream_uri) {
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
@@ -88,7 +91,8 @@ int test(char *URL)
 
   test_setopt(curl, CURLOPT_RTSP_REQUEST, CURL_RTSPREQ_PLAY);
 
-  if((stream_uri = suburl(URL, request++)) == NULL) {
+  stream_uri = suburl(URL, request++);
+  if(!stream_uri) {
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
index 32648ad125321123934cd3b577e9bf84165785ff..40a78fa84e867e3df7a5daebfa7eff1bb2a7e5a1 100644 (file)
@@ -118,7 +118,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     fclose(protofile);
     curl_global_cleanup();
@@ -126,7 +127,8 @@ int test(char *URL)
   }
   test_setopt(curl, CURLOPT_URL, URL);
 
-  if((stream_uri = suburl(URL, request++)) == NULL) {
+  stream_uri = suburl(URL, request++);
+  if(!stream_uri) {
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
@@ -147,7 +149,8 @@ int test(char *URL)
     goto test_cleanup;
 
   /* This PLAY starts the interleave */
-  if((stream_uri = suburl(URL, request++)) == NULL) {
+  stream_uri = suburl(URL, request++);
+  if(!stream_uri) {
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
@@ -161,7 +164,8 @@ int test(char *URL)
     goto test_cleanup;
 
   /* The DESCRIBE request will try to consume data after the Content */
-  if((stream_uri = suburl(URL, request++)) == NULL) {
+  stream_uri = suburl(URL, request++);
+  if(!stream_uri) {
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
@@ -174,7 +178,8 @@ int test(char *URL)
   if(res)
     goto test_cleanup;
 
-  if((stream_uri = suburl(URL, request++)) == NULL) {
+  stream_uri = suburl(URL, request++);
+  if(!stream_uri) {
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
index 3475e8060e439797593df9a027bc58ad06ad28dd..47a9da535b6573310491851fe3e6c7b5768b16e3 100644 (file)
@@ -55,7 +55,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
@@ -69,7 +70,8 @@ int test(char *URL)
   test_setopt(curl, CURLOPT_URL, URL);
 
   /* SETUP */
-  if((stream_uri = suburl(URL, request++)) == NULL) {
+  stream_uri = suburl(URL, request++);
+  if(!stream_uri) {
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
@@ -83,7 +85,8 @@ int test(char *URL)
   if(res)
     goto test_cleanup;
 
-  if((stream_uri = suburl(URL, request++)) == NULL) {
+  stream_uri = suburl(URL, request++);
+  if(!stream_uri) {
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
@@ -117,7 +120,8 @@ int test(char *URL)
   paramsf = NULL;
 
   /* Heartbeat GET_PARAMETERS */
-  if((stream_uri = suburl(URL, request++)) == NULL) {
+  stream_uri = suburl(URL, request++);
+  if(!stream_uri) {
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
@@ -131,7 +135,8 @@ int test(char *URL)
 
   /* POST GET_PARAMETERS */
 
-  if((stream_uri = suburl(URL, request++)) == NULL) {
+  stream_uri = suburl(URL, request++);
+  if(!stream_uri) {
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
@@ -149,7 +154,8 @@ int test(char *URL)
   test_setopt(curl, CURLOPT_POSTFIELDS, NULL);
 
   /* Make sure we can do a normal request now */
-  if((stream_uri = suburl(URL, request++)) == NULL) {
+  stream_uri = suburl(URL, request++);
+  if(!stream_uri) {
     res = TEST_ERR_MAJOR_BAD;
     goto test_cleanup;
   }
index 9f9222b390e044eab3668f005ae01da7530a7cb6..a51cda05f4535e4f4238f04237ff845de4b9984b 100644 (file)
@@ -40,7 +40,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 5e01d36e084f3edb9afa84342be0fb182a58b3a7..9603b58d72a2afe7445c858735312e63c3f6ac8f 100644 (file)
@@ -58,7 +58,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index aae299cccb288b9b47831a17c88439d915cea89e..61aa4f5df00e6c036bfe7ca0568f5d0da668ee3e 100644 (file)
@@ -97,7 +97,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 9b789eec77a96c7d9377bdd833ccdc334ed83dcf..a4fc6feeeea2f464f92a59e67d36a73eaf13e311 100644 (file)
@@ -101,7 +101,8 @@ static void *fire(void *ptr)
   CURL *curl;
   int i=0;
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     return NULL;
   }
@@ -148,7 +149,8 @@ int test(char *URL)
 
   /* prepare share */
   printf("SHARE_INIT\n");
-  if((share = curl_share_init()) == NULL) {
+  share = curl_share_init();
+  if(!share) {
     fprintf(stderr, "curl_share_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
@@ -197,7 +199,8 @@ int test(char *URL)
 
   /* fetch a another one */
   printf("*** run %d\n", i);
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_share_cleanup(share);
     curl_global_cleanup();
index 7b863cc3fa9a9a7be320714114c9b9e835e8270c..cc3afdf06820bee4d772621ba070fb2b3446a764 100644 (file)
@@ -46,7 +46,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index b107f29d481156e70773b0f2e7baac1722902088..c27e60b144b3b16dacd858ffbade6f9eb93543d6 100644 (file)
@@ -33,7 +33,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 1dee0b9784de5d013f4ab3780a286d460b2faf2e..843fb212183321b49e27d68a70e3abc6da76361c 100644 (file)
@@ -50,7 +50,8 @@ int test(char *URL)
     return TEST_ERR_MAJOR_BAD;
   }
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 065a79d46fde35ff45977a9a2841b042d66b0355..139dab974523c36d6c867ae821a5d9febae1dca1 100644 (file)
@@ -101,7 +101,8 @@ int test(char *url)
 
   /* Send wrong password, then right password */
 
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
@@ -120,8 +121,8 @@ int test(char *url)
   curl_easy_cleanup(curl);
 
   /* Send wrong password twice, then right password */
-
-  if((curl = curl_easy_init()) == NULL) {
+  curl = curl_easy_init();
+  if(!curl) {
     fprintf(stderr, "curl_easy_init() failed\n");
     curl_global_cleanup();
     return TEST_ERR_MAJOR_BAD;
index 1952fbbe5cd733a8d4855c226ed6a2c741cad57e..25758bd4eaa250e4ce5681d17877787b5d4b6796 100644 (file)
@@ -309,7 +309,8 @@ int getpart(char **outbuf, size_t *outlen,
       ptr++;
       end = ptr;
       EAT_WORD(end);
-      if((len.sig = end - ptr) > MAX_TAG_LEN) {
+      len.sig = end - ptr;
+      if(len.sig > MAX_TAG_LEN) {
         error = GPE_NO_BUFFER_SPACE;
         break;
       }
@@ -370,7 +371,8 @@ int getpart(char **outbuf, size_t *outlen,
       /* get potential tag */
       end = ptr;
       EAT_WORD(end);
-      if((len.sig = end - ptr) > MAX_TAG_LEN) {
+      len.sig = end - ptr;
+      if(len.sig > MAX_TAG_LEN) {
         error = GPE_NO_BUFFER_SPACE;
         break;
       }
@@ -389,7 +391,8 @@ int getpart(char **outbuf, size_t *outlen,
       end = ptr;
       while(*end && ('>' != *end))
         end++;
-      if((len.sig = end - ptr) > MAX_TAG_LEN) {
+      len.sig = end - ptr;
+      if(len.sig > MAX_TAG_LEN) {
         error = GPE_NO_BUFFER_SPACE;
         break;
       }
index e759e8800a39cb07e599fb2bf0004c76a6fe31de..ea231da3d66c838ae495c765e47148a6a6e5239d 100644 (file)
@@ -260,36 +260,42 @@ static void install_signal_handlers(void)
 {
 #ifdef SIGHUP
   /* ignore SIGHUP signal */
-  if((old_sighup_handler = signal(SIGHUP, SIG_IGN)) == SIG_ERR)
+  old_sighup_handler = signal(SIGHUP, SIG_IGN);
+  if(old_sighup_handler == SIG_ERR)
     logmsg("cannot install SIGHUP handler: %s", strerror(errno));
 #endif
 #ifdef SIGPIPE
   /* ignore SIGPIPE signal */
-  if((old_sigpipe_handler = signal(SIGPIPE, SIG_IGN)) == SIG_ERR)
+  old_sigpipe_handler = signal(SIGPIPE, SIG_IGN);
+  if(old_sigpipe_handler == SIG_ERR)
     logmsg("cannot install SIGPIPE handler: %s", strerror(errno));
 #endif
 #ifdef SIGALRM
   /* ignore SIGALRM signal */
-  if((old_sigalrm_handler = signal(SIGALRM, SIG_IGN)) == SIG_ERR)
+  old_sigalrm_handler = signal(SIGALRM, SIG_IGN);
+  if(old_sigalrm_handler == SIG_ERR)
     logmsg("cannot install SIGALRM handler: %s", strerror(errno));
 #endif
 #ifdef SIGINT
   /* handle SIGINT signal with our exit_signal_handler */
-  if((old_sigint_handler = signal(SIGINT, exit_signal_handler)) == SIG_ERR)
+  old_sigint_handler = signal(SIGINT, exit_signal_handler);
+  if(old_sigint_handler == SIG_ERR)
     logmsg("cannot install SIGINT handler: %s", strerror(errno));
   else
     siginterrupt(SIGINT, 1);
 #endif
 #ifdef SIGTERM
   /* handle SIGTERM signal with our exit_signal_handler */
-  if((old_sigterm_handler = signal(SIGTERM, exit_signal_handler)) == SIG_ERR)
+  old_sigterm_handler = signal(SIGTERM, exit_signal_handler);
+  if(old_sigterm_handler == SIG_ERR)
     logmsg("cannot install SIGTERM handler: %s", strerror(errno));
   else
     siginterrupt(SIGTERM, 1);
 #endif
 #if defined(SIGBREAK) && defined(WIN32)
   /* handle SIGBREAK signal with our exit_signal_handler */
-  if((old_sigbreak_handler = signal(SIGBREAK, exit_signal_handler)) == SIG_ERR)
+  old_sigbreak_handler = signal(SIGBREAK, exit_signal_handler);
+  if(old_sigbreak_handler == SIG_ERR)
     logmsg("cannot install SIGBREAK handler: %s", strerror(errno));
   else
     siginterrupt(SIGBREAK, 1);
index e064b6c7dc722d9ac9b30d2425b858769eeaa496..78588d3ab9373d5ec7e0820f27f991e362d9a9ee 100644 (file)
@@ -206,36 +206,42 @@ static void install_signal_handlers(void)
 {
 #ifdef SIGHUP
   /* ignore SIGHUP signal */
-  if((old_sighup_handler = signal(SIGHUP, SIG_IGN)) == SIG_ERR)
+  old_sighup_handler = signal(SIGHUP, SIG_IGN);
+  if(old_sighup_handler == SIG_ERR)
     logmsg("cannot install SIGHUP handler: %s", strerror(errno));
 #endif
 #ifdef SIGPIPE
   /* ignore SIGPIPE signal */
-  if((old_sigpipe_handler = signal(SIGPIPE, SIG_IGN)) == SIG_ERR)
+  old_sigpipe_handler = signal(SIGPIPE, SIG_IGN);
+  if(old_sigpipe_handler == SIG_ERR)
     logmsg("cannot install SIGPIPE handler: %s", strerror(errno));
 #endif
 #ifdef SIGALRM
   /* ignore SIGALRM signal */
-  if((old_sigalrm_handler = signal(SIGALRM, SIG_IGN)) == SIG_ERR)
+  old_sigalrm_handler = signal(SIGALRM, SIG_IGN);
+  if(old_sigalrm_handler == SIG_ERR)
     logmsg("cannot install SIGALRM handler: %s", strerror(errno));
 #endif
 #ifdef SIGINT
   /* handle SIGINT signal with our exit_signal_handler */
-  if((old_sigint_handler = signal(SIGINT, exit_signal_handler)) == SIG_ERR)
+  old_sigint_handler = signal(SIGINT, exit_signal_handler);
+  if(old_sigint_handler == SIG_ERR)
     logmsg("cannot install SIGINT handler: %s", strerror(errno));
   else
     siginterrupt(SIGINT, 1);
 #endif
 #ifdef SIGTERM
   /* handle SIGTERM signal with our exit_signal_handler */
-  if((old_sigterm_handler = signal(SIGTERM, exit_signal_handler)) == SIG_ERR)
+  old_sigterm_handler = signal(SIGTERM, exit_signal_handler);
+  if(old_sigterm_handler == SIG_ERR)
     logmsg("cannot install SIGTERM handler: %s", strerror(errno));
   else
     siginterrupt(SIGTERM, 1);
 #endif
 #if defined(SIGBREAK) && defined(WIN32)
   /* handle SIGBREAK signal with our exit_signal_handler */
-  if((old_sigbreak_handler = signal(SIGBREAK, exit_signal_handler)) == SIG_ERR)
+  old_sigbreak_handler = signal(SIGBREAK, exit_signal_handler);
+  if(old_sigbreak_handler == SIG_ERR)
     logmsg("cannot install SIGBREAK handler: %s", strerror(errno));
   else
     siginterrupt(SIGBREAK, 1);
index af0904e293c4b24fffd8293312465dbb7cc7e21d..c4125a0a8101e25145436ec2b52edbf1fdf2a1ce 100644 (file)
@@ -265,36 +265,42 @@ static void install_signal_handlers(void)
 {
 #ifdef SIGHUP
   /* ignore SIGHUP signal */
-  if((old_sighup_handler = signal(SIGHUP, SIG_IGN)) == SIG_ERR)
+  old_sighup_handler = signal(SIGHUP, SIG_IGN);
+  if(old_sighup_handler == SIG_ERR)
     logmsg("cannot install SIGHUP handler: %s", strerror(errno));
 #endif
 #ifdef SIGPIPE
   /* ignore SIGPIPE signal */
-  if((old_sigpipe_handler = signal(SIGPIPE, SIG_IGN)) == SIG_ERR)
+  old_sigpipe_handler = signal(SIGPIPE, SIG_IGN);
+  if(old_sigpipe_handler == SIG_ERR)
     logmsg("cannot install SIGPIPE handler: %s", strerror(errno));
 #endif
 #ifdef SIGALRM
   /* ignore SIGALRM signal */
-  if((old_sigalrm_handler = signal(SIGALRM, SIG_IGN)) == SIG_ERR)
+  old_sigalrm_handler = signal(SIGALRM, SIG_IGN);
+  if(old_sigalrm_handler == SIG_ERR)
     logmsg("cannot install SIGALRM handler: %s", strerror(errno));
 #endif
 #ifdef SIGINT
   /* handle SIGINT signal with our exit_signal_handler */
-  if((old_sigint_handler = signal(SIGINT, exit_signal_handler)) == SIG_ERR)
+  old_sigint_handler = signal(SIGINT, exit_signal_handler);
+  if(old_sigint_handler == SIG_ERR)
     logmsg("cannot install SIGINT handler: %s", strerror(errno));
   else
     siginterrupt(SIGINT, 1);
 #endif
 #ifdef SIGTERM
   /* handle SIGTERM signal with our exit_signal_handler */
-  if((old_sigterm_handler = signal(SIGTERM, exit_signal_handler)) == SIG_ERR)
+  old_sigterm_handler = signal(SIGTERM, exit_signal_handler);
+  if(old_sigterm_handler == SIG_ERR)
     logmsg("cannot install SIGTERM handler: %s", strerror(errno));
   else
     siginterrupt(SIGTERM, 1);
 #endif
 #if defined(SIGBREAK) && defined(WIN32)
   /* handle SIGBREAK signal with our exit_signal_handler */
-  if((old_sigbreak_handler = signal(SIGBREAK, exit_signal_handler)) == SIG_ERR)
+  old_sigbreak_handler = signal(SIGBREAK, exit_signal_handler);
+  if(old_sigbreak_handler == SIG_ERR)
     logmsg("cannot install SIGBREAK handler: %s", strerror(errno));
   else
     siginterrupt(SIGBREAK, 1);
index 8a4ed0b196d37f90b3ec6e94cb8506b92e2d51c7..c8667437ec086ed0682ffa0b2431afd7f04e7a8c 100644 (file)
@@ -367,31 +367,36 @@ static void install_signal_handlers(void)
 {
 #ifdef SIGHUP
   /* ignore SIGHUP signal */
-  if((old_sighup_handler = signal(SIGHUP, SIG_IGN)) == SIG_ERR)
+  old_sighup_handler = signal(SIGHUP, SIG_IGN);
+  if(old_sighup_handler == SIG_ERR)
     logmsg("cannot install SIGHUP handler: %s", strerror(errno));
 #endif
 #ifdef SIGPIPE
   /* ignore SIGPIPE signal */
-  if((old_sigpipe_handler = signal(SIGPIPE, SIG_IGN)) == SIG_ERR)
+  old_sigpipe_handler = signal(SIGPIPE, SIG_IGN);
+  if(old_sigpipe_handler == SIG_ERR)
     logmsg("cannot install SIGPIPE handler: %s", strerror(errno));
 #endif
 #ifdef SIGINT
   /* handle SIGINT signal with our exit_signal_handler */
-  if((old_sigint_handler = signal(SIGINT, exit_signal_handler)) == SIG_ERR)
+  old_sigint_handler = signal(SIGINT, exit_signal_handler);
+  if(old_sigint_handler == SIG_ERR)
     logmsg("cannot install SIGINT handler: %s", strerror(errno));
   else
     siginterrupt(SIGINT, 1);
 #endif
 #ifdef SIGTERM
   /* handle SIGTERM signal with our exit_signal_handler */
-  if((old_sigterm_handler = signal(SIGTERM, exit_signal_handler)) == SIG_ERR)
+  old_sigterm_handler = signal(SIGTERM, exit_signal_handler);
+  if(old_sigterm_handler == SIG_ERR)
     logmsg("cannot install SIGTERM handler: %s", strerror(errno));
   else
     siginterrupt(SIGTERM, 1);
 #endif
 #if defined(SIGBREAK) && defined(WIN32)
   /* handle SIGBREAK signal with our exit_signal_handler */
-  if((old_sigbreak_handler = signal(SIGBREAK, exit_signal_handler)) == SIG_ERR)
+  old_sigbreak_handler = signal(SIGBREAK, exit_signal_handler);
+  if(old_sigbreak_handler == SIG_ERR)
     logmsg("cannot install SIGBREAK handler: %s", strerror(errno));
   else
     siginterrupt(SIGBREAK, 1);
index 9af0727c344fff9a3d00681e70210c661e51acbf..db0a44c5f714fa962f59931bc8478e923fe391f5 100644 (file)
@@ -80,15 +80,18 @@ static Curl_addrinfo *fake_ai(void)
 
   ss_size = sizeof(struct sockaddr_in);
 
-  if((ai = calloc(1, sizeof(Curl_addrinfo))) == NULL)
+  ai = calloc(1, sizeof(Curl_addrinfo));
+  if(!ai)
     return NULL;
 
-  if((ai->ai_canonname = strdup("dummy")) == NULL) {
+  ai->ai_canonname = strdup("dummy");
+  if(!ai->ai_canonname) {
     free(ai);
     return NULL;
   }
 
-  if((ai->ai_addr = calloc(1, ss_size)) == NULL) {
+  ai->ai_addr = calloc(1, ss_size);
+  if(!ai->ai_addr) {
     free(ai->ai_canonname);
     free(ai);
     return NULL;