summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2016-12-14 01:29:44 +0100
committerDaniel Stenberg <daniel@haxx.se>2016-12-14 01:29:44 +0100
commit1c3e8bbfedcd3822aeb1bab22fb56c5ecff4295b (patch)
treec1606588aeae4535f0faa7942fcbe50e6e340f8b
parentb228d2952b6762b5c9b851fba0cf391e80c6761a (diff)
downloadcurl-1c3e8bbfedcd3822aeb1bab22fb56c5ecff4295b.tar.gz
checksrc: warn for assignments within if() expressions
... they're already frowned upon in our source code style guide, this now enforces the rule harder.
-rw-r--r--docs/examples/curlx.c28
-rw-r--r--docs/examples/externalsocket.c11
-rw-r--r--docs/examples/rtsp.c10
-rwxr-xr-xlib/checksrc.pl8
-rw-r--r--lib/cookie.c4
-rw-r--r--lib/curl_addrinfo.c26
-rw-r--r--lib/curl_addrinfo.h2
-rw-r--r--lib/curl_ntlm_wb.c3
-rw-r--r--lib/formdata.c12
-rw-r--r--lib/ftp.c44
-rw-r--r--lib/http.c6
-rw-r--r--lib/http_digest.c14
-rw-r--r--lib/inet_pton.c6
-rw-r--r--lib/md4.c3
-rw-r--r--lib/md5.c3
-rw-r--r--lib/nwlib.c6
-rw-r--r--lib/ssh.c35
-rw-r--r--lib/strerror.c20
-rw-r--r--lib/telnet.c3
-rw-r--r--lib/url.c24
-rw-r--r--lib/vtls/gtls.c3
-rw-r--r--lib/vtls/nss.c3
-rw-r--r--lib/vtls/openssl.c3
-rw-r--r--src/tool_getparam.c14
-rw-r--r--src/tool_paramhlp.c15
-rw-r--r--src/tool_writeout.c7
-rw-r--r--tests/libtest/lib1515.c3
-rw-r--r--tests/libtest/lib1520.c3
-rw-r--r--tests/libtest/lib1525.c3
-rw-r--r--tests/libtest/lib1526.c3
-rw-r--r--tests/libtest/lib1527.c3
-rw-r--r--tests/libtest/lib1528.c3
-rw-r--r--tests/libtest/lib1529.c5
-rw-r--r--tests/libtest/lib1530.c5
-rw-r--r--tests/libtest/lib1533.c3
-rw-r--r--tests/libtest/lib500.c3
-rw-r--r--tests/libtest/lib501.c3
-rw-r--r--tests/libtest/lib506.c12
-rw-r--r--tests/libtest/lib508.c3
-rw-r--r--tests/libtest/lib509.c3
-rw-r--r--tests/libtest/lib510.c3
-rw-r--r--tests/libtest/lib511.c3
-rw-r--r--tests/libtest/lib513.c3
-rw-r--r--tests/libtest/lib514.c3
-rw-r--r--tests/libtest/lib515.c3
-rw-r--r--tests/libtest/lib516.c3
-rw-r--r--tests/libtest/lib518.c3
-rw-r--r--tests/libtest/lib519.c3
-rw-r--r--tests/libtest/lib520.c3
-rw-r--r--tests/libtest/lib521.c3
-rw-r--r--tests/libtest/lib523.c3
-rw-r--r--tests/libtest/lib524.c3
-rw-r--r--tests/libtest/lib537.c3
-rw-r--r--tests/libtest/lib539.c3
-rw-r--r--tests/libtest/lib541.c3
-rw-r--r--tests/libtest/lib542.c3
-rw-r--r--tests/libtest/lib543.c3
-rw-r--r--tests/libtest/lib544.c3
-rw-r--r--tests/libtest/lib547.c3
-rw-r--r--tests/libtest/lib549.c3
-rw-r--r--tests/libtest/lib552.c3
-rw-r--r--tests/libtest/lib553.c3
-rw-r--r--tests/libtest/lib554.c3
-rw-r--r--tests/libtest/lib556.c3
-rw-r--r--tests/libtest/lib562.c3
-rw-r--r--tests/libtest/lib566.c3
-rw-r--r--tests/libtest/lib567.c3
-rw-r--r--tests/libtest/lib568.c15
-rw-r--r--tests/libtest/lib569.c9
-rw-r--r--tests/libtest/lib570.c12
-rw-r--r--tests/libtest/lib571.c15
-rw-r--r--tests/libtest/lib572.c18
-rw-r--r--tests/libtest/lib574.c3
-rw-r--r--tests/libtest/lib578.c3
-rw-r--r--tests/libtest/lib579.c3
-rw-r--r--tests/libtest/lib586.c9
-rw-r--r--tests/libtest/lib590.c3
-rw-r--r--tests/libtest/lib598.c3
-rw-r--r--tests/libtest/lib599.c3
-rw-r--r--tests/libtest/libauthretry.c7
-rw-r--r--tests/server/getpart.c9
-rw-r--r--tests/server/rtspd.c18
-rw-r--r--tests/server/sockfilt.c18
-rw-r--r--tests/server/sws.c18
-rw-r--r--tests/server/tftpd.c15
-rw-r--r--tests/unit/unit1305.c9
86 files changed, 413 insertions, 226 deletions
diff --git a/docs/examples/curlx.c b/docs/examples/curlx.c
index 3b11ef737..cd1677af3 100644
--- a/docs/examples/curlx.c
+++ b/docs/examples/curlx.c
@@ -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;
}
}
diff --git a/docs/examples/externalsocket.c b/docs/examples/externalsocket.c
index 9b144b42d..918f08218 100644
--- a/docs/examples/externalsocket.c
+++ b/docs/examples/externalsocket.c
@@ -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)) ==
diff --git a/docs/examples/rtsp.c b/docs/examples/rtsp.c
index bdab39542..5c66aa6e5 100644
--- a/docs/examples/rtsp.c
+++ b/docs/examples/rtsp.c
@@ -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);
diff --git a/lib/checksrc.pl b/lib/checksrc.pl
index 022b193aa..c56e9c841 100755
--- a/lib/checksrc.pl
+++ b/lib/checksrc.pl
@@ -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",
diff --git a/lib/cookie.c b/lib/cookie.c
index 24db9c6fe..092a226f3 100644
--- a/lib/cookie.c
+++ b/lib/cookie.c
@@ -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);
diff --git a/lib/curl_addrinfo.c b/lib/curl_addrinfo.c
index c8ff83c79..61cdaddc1 100644
--- a/lib/curl_addrinfo.c
+++ b/lib/curl_addrinfo.c
@@ -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;
}
diff --git a/lib/curl_addrinfo.h b/lib/curl_addrinfo.h
index 1a681e61e..4f24730af 100644
--- a/lib/curl_addrinfo.h
+++ b/lib/curl_addrinfo.h
@@ -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) && \
diff --git a/lib/curl_ntlm_wb.c b/lib/curl_ntlm_wb.c
index 4699d8f42..6a90e6236 100644
--- a/lib/curl_ntlm_wb.c
+++ b/lib/curl_ntlm_wb.c
@@ -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';
diff --git a/lib/formdata.c b/lib/formdata.c
index 53dee39f4..abd2da075 100644
--- a/lib/formdata.c
+++ b/lib/formdata.c
@@ -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)
diff --git a/lib/ftp.c b/lib/ftp.c
index 683f05de4..c7c275549 100644
--- 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
diff --git a/lib/http.c b/lib/http.c
index fba33d8e6..4c1c07fe7 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -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
diff --git a/lib/http_digest.c b/lib/http_digest.c
index 91b88a383..0ed02493d 100644
--- a/lib/http_digest.c
+++ b/lib/http_digest.c
@@ -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)
diff --git a/lib/inet_pton.c b/lib/inet_pton.c
index bff8ddadd..475f44abc 100644
--- a/lib/inet_pton.c
+++ b/lib/inet_pton.c
@@ -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;
diff --git a/lib/md4.c b/lib/md4.c
index 60f73a28b..1bdc9f367 100644
--- 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;
diff --git a/lib/md5.c b/lib/md5.c
index 7a1cac902..f2dc16c09 100644
--- 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;
diff --git a/lib/nwlib.c b/lib/nwlib.c
index 27e33e472..290cbe31f 100644
--- a/lib/nwlib.c
+++ b/lib/nwlib.c
@@ -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;
diff --git a/lib/ssh.c b/lib/ssh.c
index 80831dbfa..9b014a4ff 100644
--- 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;
diff --git a/lib/strerror.c b/lib/strerror.c
index 8f8ce036c..7e5cde47b 100644
--- a/lib/strerror.c
+++ b/lib/strerror.c
@@ -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)
diff --git a/lib/telnet.c b/lib/telnet.c
index 935cde35b..551af60f2 100644
--- a/lib/telnet.c
+++ b/lib/telnet.c
@@ -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;
diff --git a/lib/url.c b/lib/url.c
index acdda6313..45262d897 100644
--- 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
diff --git a/lib/vtls/gtls.c b/lib/vtls/gtls.c
index 1435284b8..0e308cb79 100644
--- a/lib/vtls/gtls.c
+++ b/lib/vtls/gtls.c
@@ -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
diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c
index 455bad641..ba8d58260 100644
--- a/lib/vtls/nss.c
+++ b/lib/vtls/nss.c
@@ -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';
}
diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c
index 75051d41e..94410df4b 100644
--- a/lib/vtls/openssl.c
+++ b/lib/vtls/openssl.c
@@ -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);
diff --git a/src/tool_getparam.c b/src/tool_getparam.c
index 247f8d38c..9b5c9a54c 100644
--- a/src/tool_getparam.c
+++ b/src/tool_getparam.c
@@ -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))
diff --git a/src/tool_paramhlp.c b/src/tool_paramhlp.c
index 09910a784..257e5c697 100644
--- a/src/tool_paramhlp.c
+++ b/src/tool_paramhlp.c
@@ -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;
}
diff --git a/src/tool_writeout.c b/src/tool_writeout.c
index e1b7819ed..2fb77742a 100644
--- a/src/tool_writeout.c
+++ b/src/tool_writeout.c
@@ -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++) {
diff --git a/tests/libtest/lib1515.c b/tests/libtest/lib1515.c
index aeaf6b25e..7763c2233 100644
--- a/tests/libtest/lib1515.c
+++ b/tests/libtest/lib1515.c
@@ -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)
diff --git a/tests/libtest/lib1520.c b/tests/libtest/lib1520.c
index a4ce79b50..4d5b0c88c 100644
--- a/tests/libtest/lib1520.c
+++ b/tests/libtest/lib1520.c
@@ -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;
diff --git a/tests/libtest/lib1525.c b/tests/libtest/lib1525.c
index c58ebeda9..39d51bb11 100644
--- a/tests/libtest/lib1525.c
+++ b/tests/libtest/lib1525.c
@@ -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;
diff --git a/tests/libtest/lib1526.c b/tests/libtest/lib1526.c
index ef66a484d..b2d2a4118 100644
--- a/tests/libtest/lib1526.c
+++ b/tests/libtest/lib1526.c
@@ -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;
diff --git a/tests/libtest/lib1527.c b/tests/libtest/lib1527.c
index f008cf1e4..5dec7fcc0 100644
--- a/tests/libtest/lib1527.c
+++ b/tests/libtest/lib1527.c
@@ -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;
diff --git a/tests/libtest/lib1528.c b/tests/libtest/lib1528.c
index 09af481f4..a130c49af 100644
--- a/tests/libtest/lib1528.c
+++ b/tests/libtest/lib1528.c
@@ -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;
diff --git a/tests/libtest/lib1529.c b/tests/libtest/lib1529.c
index 3333ae698..c63a109b8 100644
--- a/tests/libtest/lib1529.c
+++ b/tests/libtest/lib1529.c
@@ -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;
diff --git a/tests/libtest/lib1530.c b/tests/libtest/lib1530.c
index d1ca34c2a..6fc69f251 100644
--- a/tests/libtest/lib1530.c
+++ b/tests/libtest/lib1530.c
@@ -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;
diff --git a/tests/libtest/lib1533.c b/tests/libtest/lib1533.c
index de403e195..ada94b940 100644
--- a/tests/libtest/lib1533.c
+++ b/tests/libtest/lib1533.c
@@ -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;
diff --git a/tests/libtest/lib500.c b/tests/libtest/lib500.c
index 43b05982c..d17b24b20 100644
--- a/tests/libtest/lib500.c
+++ b/tests/libtest/lib500.c
@@ -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;
diff --git a/tests/libtest/lib501.c b/tests/libtest/lib501.c
index 2a105f0cd..7a2341246 100644
--- a/tests/libtest/lib501.c
+++ b/tests/libtest/lib501.c
@@ -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;
diff --git a/tests/libtest/lib506.c b/tests/libtest/lib506.c
index 32995e1db..20d94877c 100644
--- a/tests/libtest/lib506.c
+++ b/tests/libtest/lib506.c
@@ -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();
diff --git a/tests/libtest/lib508.c b/tests/libtest/lib508.c
index cb60ce1bd..1f6c6838a 100644
--- a/tests/libtest/lib508.c
+++ b/tests/libtest/lib508.c
@@ -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;
diff --git a/tests/libtest/lib509.c b/tests/libtest/lib509.c
index 085a9753e..a2522eb85 100644
--- a/tests/libtest/lib509.c
+++ b/tests/libtest/lib509.c
@@ -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;
diff --git a/tests/libtest/lib510.c b/tests/libtest/lib510.c
index cb5296ec3..68588cfe6 100644
--- a/tests/libtest/lib510.c
+++ b/tests/libtest/lib510.c
@@ -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;
diff --git a/tests/libtest/lib511.c b/tests/libtest/lib511.c
index 0b7ae6f43..2467bf0b0 100644
--- a/tests/libtest/lib511.c
+++ b/tests/libtest/lib511.c
@@ -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;
diff --git a/tests/libtest/lib513.c b/tests/libtest/lib513.c
index 58091ef6a..7c34bc4db 100644
--- a/tests/libtest/lib513.c
+++ b/tests/libtest/lib513.c
@@ -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;
diff --git a/tests/libtest/lib514.c b/tests/libtest/lib514.c
index f516d0942..7b33d52f9 100644
--- a/tests/libtest/lib514.c
+++ b/tests/libtest/lib514.c
@@ -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;
diff --git a/tests/libtest/lib515.c b/tests/libtest/lib515.c
index d3e6e446a..6fb178720 100644
--- a/tests/libtest/lib515.c
+++ b/tests/libtest/lib515.c
@@ -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;
diff --git a/tests/libtest/lib516.c b/tests/libtest/lib516.c
index 9faf262c6..00c54c450 100644
--- a/tests/libtest/lib516.c
+++ b/tests/libtest/lib516.c
@@ -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;
diff --git a/tests/libtest/lib518.c b/tests/libtest/lib518.c
index e37a7771d..960fcfca2 100644
--- a/tests/libtest/lib518.c
+++ b/tests/libtest/lib518.c
@@ -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();
diff --git a/tests/libtest/lib519.c b/tests/libtest/lib519.c
index 6e3059892..5c55aebe6 100644
--- a/tests/libtest/lib519.c
+++ b/tests/libtest/lib519.c
@@ -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;
diff --git a/tests/libtest/lib520.c b/tests/libtest/lib520.c
index b5a71da27..72b0875ed 100644
--- a/tests/libtest/lib520.c
+++ b/tests/libtest/lib520.c
@@ -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;
diff --git a/tests/libtest/lib521.c b/tests/libtest/lib521.c
index 40f4def4f..b7efca0be 100644
--- a/tests/libtest/lib521.c
+++ b/tests/libtest/lib521.c
@@ -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;
diff --git a/tests/libtest/lib523.c b/tests/libtest/lib523.c
index f3264690d..44aa2e2e9 100644
--- a/tests/libtest/lib523.c
+++ b/tests/libtest/lib523.c
@@ -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;
diff --git a/tests/libtest/lib524.c b/tests/libtest/lib524.c
index 3440562b2..08fd34dfc 100644
--- a/tests/libtest/lib524.c
+++ b/tests/libtest/lib524.c
@@ -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;
diff --git a/tests/libtest/lib537.c b/tests/libtest/lib537.c
index c1561419a..6d7c3e40f 100644
--- a/tests/libtest/lib537.c
+++ b/tests/libtest/lib537.c
@@ -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();
diff --git a/tests/libtest/lib539.c b/tests/libtest/lib539.c
index beee91401..7c03dd2fd 100644
--- a/tests/libtest/lib539.c
+++ b/tests/libtest/lib539.c
@@ -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;
diff --git a/tests/libtest/lib541.c b/tests/libtest/lib541.c
index 604446a2e..3e9cb3ccd 100644
--- a/tests/libtest/lib541.c
+++ b/tests/libtest/lib541.c
@@ -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);
diff --git a/tests/libtest/lib542.c b/tests/libtest/lib542.c
index c82ccd5b7..4016874e1 100644
--- a/tests/libtest/lib542.c
+++ b/tests/libtest/lib542.c
@@ -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;
diff --git a/tests/libtest/lib543.c b/tests/libtest/lib543.c
index 90aed2193..6d2532d12 100644
--- a/tests/libtest/lib543.c
+++ b/tests/libtest/lib543.c
@@ -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;
}
diff --git a/tests/libtest/lib544.c b/tests/libtest/lib544.c
index 4b08a0a76..28eacdaf6 100644
--- a/tests/libtest/lib544.c
+++ b/tests/libtest/lib544.c
@@ -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;
diff --git a/tests/libtest/lib547.c b/tests/libtest/lib547.c
index 4ec42a330..ce967c085 100644
--- a/tests/libtest/lib547.c
+++ b/tests/libtest/lib547.c
@@ -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;
diff --git a/tests/libtest/lib549.c b/tests/libtest/lib549.c
index 137029548..1d832b536 100644
--- a/tests/libtest/lib549.c
+++ b/tests/libtest/lib549.c
@@ -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;
diff --git a/tests/libtest/lib552.c b/tests/libtest/lib552.c
index ae2e691f1..967e21141 100644
--- a/tests/libtest/lib552.c
+++ b/tests/libtest/lib552.c
@@ -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;
diff --git a/tests/libtest/lib553.c b/tests/libtest/lib553.c
index 9afaad48f..288f4c1d1 100644
--- a/tests/libtest/lib553.c
+++ b/tests/libtest/lib553.c
@@ -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;
diff --git a/tests/libtest/lib554.c b/tests/libtest/lib554.c
index 803df26d1..083746243 100644
--- a/tests/libtest/lib554.c
+++ b/tests/libtest/lib554.c
@@ -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();
diff --git a/tests/libtest/lib556.c b/tests/libtest/lib556.c
index 527935396..a26101940 100644
--- a/tests/libtest/lib556.c
+++ b/tests/libtest/lib556.c
@@ -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;
diff --git a/tests/libtest/lib562.c b/tests/libtest/lib562.c
index 819b50759..285b9f5d0 100644
--- a/tests/libtest/lib562.c
+++ b/tests/libtest/lib562.c
@@ -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;
diff --git a/tests/libtest/lib566.c b/tests/libtest/lib566.c
index 94a91d5dd..ecf8c5530 100644
--- a/tests/libtest/lib566.c
+++ b/tests/libtest/lib566.c
@@ -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;
diff --git a/tests/libtest/lib567.c b/tests/libtest/lib567.c
index 38e0c0b78..f9f55e3c0 100644
--- a/tests/libtest/lib567.c
+++ b/tests/libtest/lib567.c
@@ -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;
diff --git a/tests/libtest/lib568.c b/tests/libtest/lib568.c
index 9b3a07787..0cdef812b 100644
--- a/tests/libtest/lib568.c
+++ b/tests/libtest/lib568.c
@@ -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;
}
diff --git a/tests/libtest/lib569.c b/tests/libtest/lib569.c
index 55282b69b..d7381d9a2 100644
--- a/tests/libtest/lib569.c
+++ b/tests/libtest/lib569.c
@@ -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;
}
diff --git a/tests/libtest/lib570.c b/tests/libtest/lib570.c
index 2dc57b761..9d9b5a134 100644
--- a/tests/libtest/lib570.c
+++ b/tests/libtest/lib570.c
@@ -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;
}
diff --git a/tests/libtest/lib571.c b/tests/libtest/lib571.c
index 32648ad12..40a78fa84 100644
--- a/tests/libtest/lib571.c
+++ b/tests/libtest/lib571.c
@@ -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;
}
diff --git a/tests/libtest/lib572.c b/tests/libtest/lib572.c
index 3475e8060..47a9da535 100644
--- a/tests/libtest/lib572.c
+++ b/tests/libtest/lib572.c
@@ -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;
}
diff --git a/tests/libtest/lib574.c b/tests/libtest/lib574.c
index 9f9222b39..a51cda05f 100644
--- a/tests/libtest/lib574.c
+++ b/tests/libtest/lib574.c
@@ -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;
diff --git a/tests/libtest/lib578.c b/tests/libtest/lib578.c
index 5e01d36e0..9603b58d7 100644
--- a/tests/libtest/lib578.c
+++ b/tests/libtest/lib578.c
@@ -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;
diff --git a/tests/libtest/lib579.c b/tests/libtest/lib579.c
index aae299ccc..61aa4f5df 100644
--- a/tests/libtest/lib579.c
+++ b/tests/libtest/lib579.c
@@ -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;
diff --git a/tests/libtest/lib586.c b/tests/libtest/lib586.c
index 9b789eec7..a4fc6feee 100644
--- a/tests/libtest/lib586.c
+++ b/tests/libtest/lib586.c
@@ -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();
diff --git a/tests/libtest/lib590.c b/tests/libtest/lib590.c
index 7b863cc3f..cc3afdf06 100644
--- a/tests/libtest/lib590.c
+++ b/tests/libtest/lib590.c
@@ -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;
diff --git a/tests/libtest/lib598.c b/tests/libtest/lib598.c
index b107f29d4..c27e60b14 100644
--- a/tests/libtest/lib598.c
+++ b/tests/libtest/lib598.c
@@ -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;
diff --git a/tests/libtest/lib599.c b/tests/libtest/lib599.c
index 1dee0b978..843fb2121 100644
--- a/tests/libtest/lib599.c
+++ b/tests/libtest/lib599.c
@@ -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;
diff --git a/tests/libtest/libauthretry.c b/tests/libtest/libauthretry.c
index 065a79d46..139dab974 100644
--- a/tests/libtest/libauthretry.c
+++ b/tests/libtest/libauthretry.c
@@ -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;
diff --git a/tests/server/getpart.c b/tests/server/getpart.c
index 1952fbbe5..25758bd4e 100644
--- a/tests/server/getpart.c
+++ b/tests/server/getpart.c
@@ -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;
}
diff --git a/tests/server/rtspd.c b/tests/server/rtspd.c
index e759e8800..ea231da3d 100644
--- a/tests/server/rtspd.c
+++ b/tests/server/rtspd.c
@@ -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);
diff --git a/tests/server/sockfilt.c b/tests/server/sockfilt.c
index e064b6c7d..78588d3ab 100644
--- a/tests/server/sockfilt.c
+++ b/tests/server/sockfilt.c
@@ -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);
diff --git a/tests/server/sws.c b/tests/server/sws.c
index af0904e29..c4125a0a8 100644
--- a/tests/server/sws.c
+++ b/tests/server/sws.c
@@ -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);
diff --git a/tests/server/tftpd.c b/tests/server/tftpd.c
index 8a4ed0b19..c8667437e 100644
--- a/tests/server/tftpd.c
+++ b/tests/server/tftpd.c
@@ -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);
diff --git a/tests/unit/unit1305.c b/tests/unit/unit1305.c
index 9af0727c3..db0a44c5f 100644
--- a/tests/unit/unit1305.c
+++ b/tests/unit/unit1305.c
@@ -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;