args++;
}
- if(mimetype == NULL || mimetypeaccept == NULL || p.p12file == NULL)
+ if(!mimetype || !mimetypeaccept || !p.p12file)
badarg = 1;
if(badarg) {
/* set input */
in = BIO_new(BIO_s_file());
- if(in == NULL) {
+ if(!in) {
BIO_printf(p.errorbio, "Error setting input bio\n");
goto err;
}
- else if(infile == NULL)
+ else if(!infile)
BIO_set_fp(in, stdin, BIO_NOCLOSE|BIO_FP_TEXT);
else if(BIO_read_filename(in, infile) <= 0) {
BIO_printf(p.errorbio, "Error opening input file %s\n", infile);
/* set output */
out = BIO_new(BIO_s_file());
- if(out == NULL) {
+ if(!out) {
BIO_printf(p.errorbio, "Error setting output bio.\n");
goto err;
}
- else if(outfile == NULL)
+ else if(!outfile)
BIO_set_fp(out, stdout, BIO_NOCLOSE|BIO_FP_TEXT);
else if(BIO_write_filename(out, outfile) <= 0) {
BIO_printf(p.errorbio, "Error opening output file %s\n", outfile);
serverurl = malloc(len);
snprintf(serverurl, len, "https://%s", hostporturl);
}
- else if(p.accesstype != 0) { /* see whether we can find an AIA or SIA for a
- given access type */
+ else if(p.accesstype) { /* see whether we can find an AIA or SIA for a
+ given access type */
serverurl = my_get_ext(p.usercert, p.accesstype, NID_info_access);
if(!serverurl) {
int j = 0;
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, 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
#ifdef WIN32
WSADATA wsaData;
int initwsa = WSAStartup(MAKEWORD(2, 0), &wsaData);
- if(initwsa != 0) {
+ if(initwsa) {
printf("WSAStartup failed: %d\n", initwsa);
return 1;
}
* See the main() function at the bottom that shows an app that retrieves from
* a specified url using fgets() and fread() and saves as two output files.
*
- * Copyright (c) 2003 - 2019 Simtec Electronics
+ * Copyright (c) 2003 - 2021 Simtec Electronics
*
* Re-implemented by Vincent Sanders <vince@kyllikki.org> with extensive
* reference to original curl example code
if(size > rembuff) {
/* not enough space in buffer */
newbuff = realloc(url->buffer, url->buffer_len + (size - rembuff));
- if(newbuff == NULL) {
+ if(!newbuff) {
fprintf(stderr, "callback buffer grow failed\n");
size = rembuff;
}
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, 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
struct MemoryStruct *mem = (struct MemoryStruct *)userp;
char *ptr = realloc(mem->memory, mem->size + realsize + 1);
- if(ptr == NULL) {
+ if(!ptr) {
/* out of memory! */
printf("not enough memory (realloc returned NULL)\n");
return 0;
/*
- * Copyright (c) 2011 - 2020, Jim Hollinger
+ * Copyright (c) 2011 - 2021, Jim Hollinger
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
CURLcode res = CURLE_OK;
FILE *sdp_fp = fopen(sdp_filename, "wb");
printf("\nRTSP: DESCRIBE %s\n", uri);
- if(sdp_fp == NULL) {
+ if(!sdp_fp) {
fprintf(stderr, "Could not open '%s' for writing\n", sdp_filename);
sdp_fp = stdout;
}
/* check command line */
if((argc != 2) && (argc != 3)) {
base_name = strrchr(argv[0], '/');
- if(base_name == NULL) {
+ if(!base_name) {
base_name = strrchr(argv[0], '\\');
}
- if(base_name == NULL) {
+ if(!base_name) {
base_name = argv[0];
}
else {
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2013 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 2013 - 2021, 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
/* get a BIO */
bio = BIO_new_mem_buf((char *)mypem, -1);
- if(bio == NULL) {
+ if(!bio) {
printf("BIO_new_mem_buf failed\n");
}
* structure that SSL can use
*/
cert = PEM_read_bio_X509(bio, NULL, 0, NULL);
- if(cert == NULL) {
+ if(!cert) {
printf("PEM_read_bio_X509 failed...\n");
}
/*create a bio for the RSA key*/
kbio = BIO_new_mem_buf((char *)mykey, -1);
- if(kbio == NULL) {
+ if(!kbio) {
printf("BIO_new_mem_buf failed\n");
}
/*read the key bio into an RSA object*/
rsa = PEM_read_bio_RSAPrivateKey(kbio, NULL, 0, NULL);
- if(rsa == NULL) {
+ if(!rsa) {
printf("Failed to create key bio\n");
}
pfd[i].fd = socks[i];
pfd[i].events |= POLLWRNORM|POLLOUT;
}
- if(pfd[i].events != 0)
+ if(pfd[i].events)
num++;
else
break;
#endif
tsd->mtx = malloc(sizeof(curl_mutex_t));
- if(tsd->mtx == NULL)
+ if(!tsd->mtx)
goto err_exit;
Curl_mutex_init(tsd->mtx);
rc = Curl_getaddrinfo_ex(tsd->hostname, service, &tsd->hints, &tsd->res);
- if(rc != 0) {
+ if(rc) {
tsd->sock_error = SOCKERRNO?SOCKERRNO:rc;
if(tsd->sock_error == 0)
tsd->sock_error = RESOLVER_ENOMEM;
/* Dynamically allocate a buffer for decompression because it's uncommonly
large to hold on the stack */
decomp = malloc(DSIZ);
- if(decomp == NULL)
+ if(!decomp)
return exit_zlib(data, z, &zp->zlib_init, CURLE_OUT_OF_MEMORY);
/* because the buffer size is fixed, iteratively decompress and transfer to
*/
z->avail_in = (uInt) nbytes;
z->next_in = malloc(z->avail_in);
- if(z->next_in == NULL) {
+ if(!z->next_in) {
return exit_zlib(data, z, &zp->zlib_init, CURLE_OUT_OF_MEMORY);
}
memcpy(z->next_in, buf, z->avail_in);
ssize_t hlen;
z->avail_in += (uInt) nbytes;
z->next_in = Curl_saferealloc(z->next_in, z->avail_in);
- if(z->next_in == NULL) {
+ if(!z->next_in) {
return exit_zlib(data, z, &zp->zlib_init, CURLE_OUT_OF_MEMORY);
}
/* Append the new block of data to the previous one */
for(i = 0; i < nvalid; i++) {
char *format_ptr = get_netscape_format(array[i]);
- if(format_ptr == NULL) {
+ if(!format_ptr) {
fprintf(out, "#\n# Fatal libcurl error\n");
free(array);
goto error;
char *line;
unsigned int i;
- if((data->cookies == NULL) ||
- (data->cookies->numcookies == 0))
+ if(!data->cookies || (data->cookies->numcookies == 0))
return NULL;
for(i = 0; i < COOKIE_HASH_SIZE; i++) {
continue;
/* ignore elements without required address info */
- if((ai->ai_addr == NULL) || !(ai->ai_addrlen > 0))
+ if(!ai->ai_addr || !(ai->ai_addrlen > 0))
continue;
/* ignore elements with bogus address size */
(char *)status_string.value);
}
gss_release_buffer(&min_stat, &status_string);
- } while(!GSS_ERROR(maj_stat) && msg_ctx != 0);
+ } while(!GSS_ERROR(maj_stat) && msg_ctx);
return len;
}
/* Check for /~/, indicating relative to the user's home directory */
if(data->conn->handler->protocol & CURLPROTO_SCP) {
real_path = malloc(working_path_len + 1);
- if(real_path == NULL) {
+ if(!real_path) {
free(working_path);
return CURLE_OUT_OF_MEMORY;
}
if((working_path_len > 1) && (working_path[1] == '~')) {
size_t homelen = strlen(homedir);
real_path = malloc(homelen + working_path_len + 1);
- if(real_path == NULL) {
+ if(!real_path) {
free(working_path);
return CURLE_OUT_OF_MEMORY;
}
}
else {
real_path = malloc(working_path_len + 1);
- if(real_path == NULL) {
+ if(!real_path) {
free(working_path);
return CURLE_OUT_OF_MEMORY;
}
/* Allocate enough space for home directory and filename + separator */
fullPathLength = strlen(cp) + strlen(homedir) + 2;
*path = malloc(fullPathLength);
- if(*path == NULL)
+ if(!*path)
return CURLE_OUT_OF_MEMORY;
/* Check for quoted filenames */
else {
/* Read to end of filename - either to whitespace or terminator */
end = strpbrk(cp, WHITESPACE);
- if(end == NULL)
+ if(!end)
end = strchr(cp, '\0');
/* return pointer to second parameter if it exists */
*cpp = end + strspn(end, WHITESPACE);
}
}
- if((word == NULL) || (*word == (char)0)) {
+ if(!word || (*word == (char)0)) {
infof(data, "lookup word is missing\n");
word = (char *)"default";
}
- if((database == NULL) || (*database == (char)0)) {
+ if(!database || (*database == (char)0)) {
database = (char *)"!";
}
- if((strategy == NULL) || (*strategy == (char)0)) {
+ if(!strategy || (*strategy == (char)0)) {
strategy = (char *)".";
}
}
}
- if((word == NULL) || (*word == (char)0)) {
+ if(!word || (*word == (char)0)) {
infof(data, "lookup word is missing\n");
word = (char *)"default";
}
- if((database == NULL) || (*database == (char)0)) {
+ if(!database || (*database == (char)0)) {
database = (char *)"!";
}
curl_socket_t *sfd,
struct connectdata **connp)
{
- if(data == NULL)
+ if(!data)
return CURLE_BAD_FUNCTION_ARGUMENT;
/* only allow these to be called on handles with CURLOPT_CONNECT_ONLY */
else
res = NULL; /* failure! */
- if(res == NULL) {
+ if(!res) {
failf(data, "failed to resolve the address provided to PORT: %s", host);
free(addr);
return CURLE_FTP_PORT_FAILED;
endptr++;
while(ISDIGIT(*endptr))
endptr++;
- if(*endptr != 0) {
+ if(*endptr) {
parser->error = CURLE_FTP_BAD_FILE_LIST;
goto fail;
}
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, 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
struct Curl_hash_element *he = le->ptr;
lnext = le->next;
/* ask the callback function if we shall remove this entry or not */
- if(comp == NULL || comp(user, he->ptr)) {
+ if(!comp || comp(user, he->ptr)) {
Curl_llist_remove(list, le, (void *) h);
--h->size; /* one less entry in the hash now */
}
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, 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
pattern[len-1] = 0;
pattern_wildcard = strchr(pattern, '*');
- if(pattern_wildcard == NULL)
+ if(!pattern_wildcard)
return strcasecompare(pattern, hostname) ?
CURL_HOST_MATCH : CURL_HOST_NOMATCH;
match. */
wildcard_enabled = 1;
pattern_label_end = strchr(pattern, '.');
- if(pattern_label_end == NULL || strchr(pattern_label_end + 1, '.') == NULL ||
+ if(!pattern_label_end || strchr(pattern_label_end + 1, '.') == NULL ||
pattern_wildcard > pattern_label_end ||
strncasecompare(pattern, "xn--", 4)) {
wildcard_enabled = 0;
CURL_HOST_MATCH : CURL_HOST_NOMATCH;
hostname_label_end = strchr(hostname, '.');
- if(hostname_label_end == NULL ||
+ if(!hostname_label_end ||
!strcasecompare(pattern_label_end, hostname_label_end))
return CURL_HOST_NOMATCH;
nghttp2_session_callbacks *callbacks;
conn->proto.httpc.inbuf = malloc(H2_BUFSIZE);
- if(conn->proto.httpc.inbuf == NULL)
+ if(!conn->proto.httpc.inbuf)
return CURLE_OUT_OF_MEMORY;
rc = nghttp2_session_callbacks_new(&callbacks);
}
rv = h2_session_send(data, httpc->h2);
- if(rv != 0) {
+ if(rv) {
*err = CURLE_SEND_ERROR;
return -1;
}
/* and attempt to send the pending frames */
rv = h2_session_send(data, h2);
- if(rv != 0)
+ if(rv)
result = CURLE_SEND_ERROR;
if(nghttp2_session_want_write(h2)) {
more space. */
nheader += 1;
nva = malloc(sizeof(nghttp2_nv) * nheader);
- if(nva == NULL) {
+ if(!nva) {
*err = CURLE_OUT_OF_MEMORY;
return -1;
}
}
/* :authority must come before non-pseudo header fields */
- if(authority_idx != 0 && authority_idx != AUTHORITY_DST_IDX) {
+ if(authority_idx && authority_idx != AUTHORITY_DST_IDX) {
nghttp2_nv authority = nva[authority_idx];
for(i = authority_idx; i > AUTHORITY_DST_IDX; --i) {
nva[i] = nva[i - 1];
stream->stream_id = stream_id;
rv = h2_session_send(data, h2);
- if(rv != 0) {
+ if(rv) {
H2BUGF(infof(data,
"http2_send() nghttp2_session_send error (%s)%d\n",
nghttp2_strerror(rv), rv));
/* queue SETTINGS frame (again) */
rv = nghttp2_session_upgrade(httpc->h2, httpc->binsettings,
httpc->binlen, NULL);
- if(rv != 0) {
+ if(rv) {
failf(data, "nghttp2_session_upgrade() failed: %s(%d)",
nghttp2_strerror(rv), rv);
return CURLE_HTTP2;
rv = nghttp2_submit_settings(httpc->h2, NGHTTP2_FLAG_NONE,
httpc->local_settings,
httpc->local_settings_num);
- if(rv != 0) {
+ if(rv) {
failf(data, "nghttp2_submit_settings() failed: %s(%d)",
nghttp2_strerror(rv), rv);
return CURLE_HTTP2;
rv = nghttp2_session_set_local_window_size(httpc->h2, NGHTTP2_FLAG_NONE, 0,
HTTP2_HUGE_WINDOW_SIZE);
- if(rv != 0) {
+ if(rv) {
failf(data, "nghttp2_session_set_local_window_size() failed: %s(%d)",
nghttp2_strerror(rv), rv);
return CURLE_HTTP2;
free(base64);
- if(userp == NULL) {
+ if(!userp) {
return CURLE_OUT_OF_MEMORY;
}
passwdp = "";
#ifdef USE_WINDOWS_SSPI
- if(s_hSecDll == NULL) {
+ if(!s_hSecDll) {
/* not thread safe and leaks - use curl_global_init() to avoid */
CURLcode err = Curl_sspi_global_init();
- if(s_hSecDll == NULL)
+ if(!s_hSecDll)
return err;
}
#ifdef SECPKG_ATTR_ENDPOINT_BINDINGS
/*
- * Copyright (C) 1996-2019 Internet Software Consortium.
+ * Copyright (C) 1996-2021 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
/* Are we following an initial run of 0x00s or any real hex?
*/
- if(i != 0)
+ if(i)
*tp++ = ':';
/* Is this address an encapsulated IPv4?
break;
}
- if(output_buffer.length != 0) {
+ if(output_buffer.length) {
char *cmd;
result = Curl_base64_encode(data, (char *)output_buffer.value,
const struct Curl_sec_client_mech *mech = &Curl_krb5_client_mech;
tmp_allocation = realloc(conn->app_data, mech->size);
- if(tmp_allocation == NULL) {
+ if(!tmp_allocation) {
failf(data, "Failed realloc of size %zu", mech->size);
mech = NULL;
return CURLE_OUT_OF_MEMORY;
#else
rc = _ldap_url_parse(data, conn, &ludp);
#endif
- if(rc != 0) {
+ if(rc) {
failf(data, "LDAP local: %s", ldap_err2string(rc));
result = CURLE_LDAP_INVALID_URL;
goto quit;
goto quit;
}
server = ldapssl_init(host, (int)conn->port, 1);
- if(server == NULL) {
+ if(!server) {
failf(data, "LDAP local: Cannot connect to %s:%ld",
conn->host.dispname, conn->port);
result = CURLE_COULDNT_CONNECT;
goto quit;
}
server = ldap_init(host, (int)conn->port);
- if(server == NULL) {
+ if(!server) {
failf(data, "LDAP local: Cannot connect to %s:%ld",
conn->host.dispname, conn->port);
result = CURLE_COULDNT_CONNECT;
}
else {
server = ldap_init(host, (int)conn->port);
- if(server == NULL) {
+ if(!server) {
failf(data, "LDAP local: Cannot connect to %s:%ld",
conn->host.dispname, conn->port);
result = CURLE_COULDNT_CONNECT;
#else
rc = ldap_simple_bind_s(server, user, passwd);
#endif
- if(!ldap_ssl && rc != 0) {
+ if(!ldap_ssl && rc) {
ldap_proto = LDAP_VERSION2;
ldap_set_option(server, LDAP_OPT_PROTOCOL_VERSION, &ldap_proto);
#ifdef USE_WIN32_LDAP
rc = ldap_simple_bind_s(server, user, passwd);
#endif
}
- if(rc != 0) {
+ if(rc) {
#ifdef USE_WIN32_LDAP
failf(data, "LDAP local: bind via ldap_win_bind %s",
ldap_err2string(rc));
rc = ldap_search_s(server, ludp->lud_dn, ludp->lud_scope,
ludp->lud_filter, ludp->lud_attrs, 0, &ldapmsg);
- if(rc != 0 && rc != LDAP_SIZELIMIT_EXCEEDED) {
+ if(rc && rc != LDAP_SIZELIMIT_EXCEEDED) {
failf(data, "LDAP remote: %s", ldap_err2string(rc));
result = CURLE_LDAP_SEARCH_FAILED;
goto quit;
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, 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
void *user)
{
void *ptr;
- if(e == NULL || list->size == 0)
+ if(!e || list->size == 0)
return;
if(e == list->head) {
list->head = e->next;
- if(list->head == NULL)
+ if(!list->head)
list->tail = NULL;
else
e->next->prev = NULL;
static void MD4_Update(MD4_CTX *ctx, const void *data, unsigned long size)
{
- if(ctx->data == NULL) {
+ if(!ctx->data) {
ctx->data = malloc(size);
if(ctx->data != NULL) {
memcpy(ctx->data, data, size);
FILE * file;
file = fopen(name, FOPEN_READTEXT); /* VMS */
- if(file == NULL)
+ if(!file)
return 0;
count = 0;
ret_stat = 1;
while(ret_stat > 0) {
ret_stat = fread(buffer, 1, sizeof(buffer), file);
- if(ret_stat != 0)
+ if(ret_stat)
count += ret_stat;
}
fclose(file);
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1999 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1999 - 2021, 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
size_t len;
str = (char *) p->data.str;
- if(str == NULL) {
+ if(!str) {
/* Write null[] if there's space. */
if(prec == -1 || prec >= (long) sizeof(null) - 1) {
str = null;
mask |= CURL_WAIT_POLLOUT;
if(wsa_events.lNetworkEvents & FD_OOB)
mask |= CURL_WAIT_POLLPRI;
- if(ret && pollrc <= 0 && wsa_events.lNetworkEvents != 0)
+ if(ret && pollrc <= 0 && wsa_events.lNetworkEvents)
retcode++;
}
WSAEventSelect(extra_fds[i].fd, multi->wsa_event, 0);
if(bitmap & (GETSOCK_READSOCK(i) | GETSOCK_WRITESOCK(i))) {
wsa_events.lNetworkEvents = 0;
if(WSAEnumNetworkEvents(sockbunch[i], NULL, &wsa_events) == 0) {
- if(ret && pollrc <= 0 && wsa_events.lNetworkEvents != 0)
+ if(ret && pollrc <= 0 && wsa_events.lNetworkEvents)
retcode++;
}
WSAEventSelect(sockbunch[i], multi->wsa_event, 0);
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, 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
&output_ptr, &out_bytes);
if(!data)
iconv_close(tmpcd);
- if((rc == ICONV_ERROR) || (in_bytes != 0)) {
+ if((rc == ICONV_ERROR) || (in_bytes)) {
failf(data,
"The Curl_convert_to_network iconv call failed with errno %i: %s",
errno, strerror(errno));
&output_ptr, &out_bytes);
if(!data)
iconv_close(tmpcd);
- if((rc == ICONV_ERROR) || (in_bytes != 0)) {
+ if((rc == ICONV_ERROR) || (in_bytes)) {
failf(data,
"Curl_convert_from_network iconv call failed with errno %i: %s",
errno, strerror(errno));
&output_ptr, &out_bytes);
if(!data)
iconv_close(tmpcd);
- if((rc == ICONV_ERROR) || (in_bytes != 0)) {
+ if((rc == ICONV_ERROR) || (in_bytes)) {
failf(data,
"The Curl_convert_from_utf8 iconv call failed with errno %i: %s",
errno, strerror(errno));
rc = ldap_get_attribute_ber(li->ld, ent, ber, &bv, &bvals)) {
int i;
- if(bv.bv_val == NULL)
+ if(!bv.bv_val)
break;
if(bv.bv_len > 7 && !strncmp(bv.bv_val + bv.bv_len - 7, ";binary", 7))
else
binary = 0;
- if(bvals == NULL) {
+ if(!bvals) {
writeerr = Curl_client_write(data, CLIENTWRITE_BODY, (char *)"\t", 1);
if(writeerr) {
*err = writeerr;
}
}
- if(rtp_dataleft != 0 && rtp[0] == '$') {
+ if(rtp_dataleft && rtp[0] == '$') {
DEBUGF(infof(data, "RTP Rewinding %zd %s\n", rtp_dataleft,
*readmore ? "(READMORE)" : ""));
/* Copy the id substring into a new buffer */
data->set.str[STRING_RTSP_SESSION_ID] = malloc(idlen + 1);
- if(data->set.str[STRING_RTSP_SESSION_ID] == NULL)
+ if(!data->set.str[STRING_RTSP_SESSION_ID])
return CURLE_OUT_OF_MEMORY;
memcpy(data->set.str[STRING_RTSP_SESSION_ID], start, idlen);
(data->set.str[STRING_RTSP_SESSION_ID])[idlen] = '\0';
if(ufds[i].events & POLLPRI)
ufds[i].revents |= POLLPRI;
}
- if(ufds[i].revents != 0)
+ if(ufds[i].revents)
r++;
}
char *inPtr, *outPtr;
/* sanity check */
- if((startPtr == NULL) || (size < 1)) {
+ if(!startPtr || (size < 1)) {
return size;
}
case CURLOPT_COOKIELIST:
argptr = va_arg(param, char *);
- if(argptr == NULL)
+ if(!argptr)
break;
if(strcasecompare(argptr, "ALL")) {
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, 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
/* See if the result is in VMS format, if not, we are done */
/* Assume that this is a PATH, not just some data */
test_str = strpbrk(path, ":[<^");
- if(test_str == NULL) {
+ if(!test_str) {
return (char *)path;
}
/* first use the DECC getenv() function */
result = decc$getenv(envvar);
- if(result == NULL) {
+ if(!result) {
return result;
}
#endif
my_passwd = decc_getpwuid(uid);
- if(my_passwd == NULL) {
+ if(!my_passwd) {
return my_passwd;
}
{
struct Curl_share *share = data->share;
- if(share == NULL)
+ if(!share)
return CURLSHE_INVALID;
if(share->specifier & (1<<type)) {
{
struct Curl_share *share = data->share;
- if(share == NULL)
+ if(!share)
return CURLSHE_INVALID;
if(share->specifier & (1<<type)) {
*/
/* wrong version ? */
- if(socksreq[0] != 0) {
+ if(socksreq[0]) {
failf(data,
"SOCKS4 reply has wrong version, version should be 0.");
return CURLPX_BAD_VERSION;
return CURLPX_OK;
}
/* ignore the first (VER) byte */
- else if(socksreq[1] != 0) { /* status */
+ else if(socksreq[1]) { /* status */
failf(data, "User was rejected by the SOCKS5 server (%d %d).",
socksreq[0], socksreq[1]);
return CURLPX_USER_REJECTED;
"SOCKS5 reply has wrong version, version should be 5.");
return CURLPX_BAD_VERSION;
}
- else if(socksreq[1] != 0) { /* Anything besides 0 is an error */
+ else if(socksreq[1]) { /* Anything besides 0 is an error */
CURLproxycode rc = CURLPX_REPLY_UNASSIGNED;
int code = socksreq[1];
failf(data, "Can't complete SOCKS5 connection to %s. (%d)",
return CURLE_COULDNT_CONNECT;
}
- if(gss_send_token.length != 0) {
+ if(gss_send_token.length) {
socksreq[0] = 1; /* GSS-API subnegotiation version */
socksreq[1] = 1; /* authentication message type */
us_length = htons((short)gss_send_token.length);
return CURLE_COULDNT_CONNECT;
}
- if(sspi_send_token.cbBuffer != 0) {
+ if(sspi_send_token.cbBuffer) {
socksreq[0] = 1; /* GSS-API subnegotiation version */
socksreq[1] = 1; /* authentication message type */
us_length = htons((short)sspi_send_token.cbBuffer);
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1997 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1997 - 2021, 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
{
struct Curl_tree N, *l, *r, *y;
- if(t == NULL)
+ if(!t)
return t;
N.smaller = N.larger = NULL;
l = r = &N;
for(;;) {
long comp = compare(i, t->key);
if(comp < 0) {
- if(t->smaller == NULL)
+ if(!t->smaller)
break;
if(compare(i, t->smaller->key) < 0) {
y = t->smaller; /* rotate smaller */
t->smaller = y->larger;
y->larger = t;
t = y;
- if(t->smaller == NULL)
+ if(!t->smaller)
break;
}
r->smaller = t; /* link smaller */
t = t->smaller;
}
else if(comp > 0) {
- if(t->larger == NULL)
+ if(!t->larger)
break;
if(compare(i, t->larger->key) > 0) {
y = t->larger; /* rotate larger */
t->larger = y->smaller;
y->smaller = t;
t = y;
- if(t->larger == NULL)
+ if(!t->larger)
break;
}
l->larger = t; /* link larger */
(time_t)-1, (unsigned int)-1
}; /* will *NEVER* appear */
- if(node == NULL)
+ if(!node)
return t;
if(t != NULL) {
}
}
- if(t == NULL) {
+ if(!t) {
node->smaller = node->larger = NULL;
}
else if(compare(i, t->key) < 0) {
}
else {
/* Remove the root node */
- if(t->smaller == NULL)
+ if(!t->smaller)
x = t->larger;
else {
x = Curl_splay(removenode->key, t->smaller);
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 2016 - 2020, Steve Holme, <steve_holme@hotmail.com>.
+ * Copyright (C) 2016 - 2021, Steve Holme, <steve_holme@hotmail.com>.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
wVersionRequested = MAKEWORD(2, 2);
res = WSAStartup(wVersionRequested, &wsaData);
- if(res != 0)
+ if(res)
/* Tell the user that we couldn't find a usable */
/* winsock.dll. */
return CURLE_FAILED_INIT;
const char *option, *value;
tmp = tftp_option_get(tmp, ptr + len - tmp, &option, &value);
- if(tmp == NULL) {
+ if(!tmp) {
failf(data, "Malformed ACK packet, rejecting");
return CURLE_TFTP_ILLEGAL;
}
return result;
state->sbytes += (int)cb;
state->data->req.upload_fromhere += cb;
- } while(state->sbytes < state->blksize && cb != 0);
+ } while(state->sbytes < state->blksize && cb);
sbytes = sendto(state->sockfd, (void *) state->spacket.data,
4 + state->sbytes, SEND_4TH_ARG,
failf(data, "%s", Curl_strerror(error, buffer, sizeof(buffer)));
state->event = TFTP_EVENT_ERROR;
}
- else if(rc != 0) {
+ else if(rc) {
result = tftp_receive_packet(data);
if(result)
return result;
/* the user information is case-sensitive
or at least it is not defined as case-insensitive
see https://tools.ietf.org/html/rfc3986#section-3.2.1 */
- if((data->user == NULL) != (needle->user == NULL))
+ if(!data->user != !needle->user)
return FALSE;
/* curl_strequal does a case insentive comparison, so do not use it here! */
if(data->user &&
needle->user &&
strcmp(data->user, needle->user) != 0)
return FALSE;
- if((data->passwd == NULL) != (needle->passwd == NULL))
+ if(!data->passwd != !needle->passwd)
return FALSE;
/* curl_strequal does a case insentive comparison, so do not use it here! */
if(data->passwd &&
#ifdef USE_UNIX_SOCKETS
if(data->set.str[STRING_UNIX_SOCKET_PATH]) {
conn->unix_domain_socket = strdup(data->set.str[STRING_UNIX_SOCKET_PATH]);
- if(conn->unix_domain_socket == NULL) {
+ if(!conn->unix_domain_socket) {
result = CURLE_OUT_OF_MEMORY;
goto out;
}
return CURLE_OUT_OF_MEMORY;
/* Calculate the reply */
- if(zlen != 0)
+ if(zlen)
memcpy(plainauth, authzid, zlen);
plainauth[zlen] = '\0';
memcpy(plainauth + zlen + 1, authcid, clen);
int rv;
crypto_data = &qs->crypto_data[level];
- if(crypto_data->buf == NULL) {
+ if(!crypto_data->buf) {
crypto_data->buf = malloc(4096);
if(!crypto_data->buf)
return 0;
(void)stream_user_data;
rv = nghttp3_conn_add_ack_offset(qs->h3conn, stream_id, datalen);
- if(rv != 0) {
+ if(rv) {
return NGTCP2_ERR_CALLBACK_FAILURE;
}
rv = nghttp3_conn_close_stream(qs->h3conn, stream_id,
app_error_code);
- if(rv != 0) {
+ if(rv) {
return NGTCP2_ERR_CALLBACK_FAILURE;
}
(void)stream_user_data;
rv = nghttp3_conn_reset_stream(qs->h3conn, stream_id);
- if(rv != 0) {
+ if(rv) {
return NGTCP2_ERR_CALLBACK_FAILURE;
}
(void)stream_user_data;
rv = nghttp3_conn_unblock_stream(qs->h3conn, stream_id);
- if(rv != 0) {
+ if(rv) {
return NGTCP2_ERR_CALLBACK_FAILURE;
}
if(stream->h3out->used == 0) {
int rv = nghttp3_conn_resume_stream(conn, stream_id);
- if(rv != 0) {
+ if(rv) {
return NGTCP2_ERR_CALLBACK_FAILURE;
}
}
}
/* :authority must come before non-pseudo header fields */
- if(authority_idx != 0 && authority_idx != AUTHORITY_DST_IDX) {
+ if(authority_idx && authority_idx != AUTHORITY_DST_IDX) {
nghttp3_nv authority = nva[authority_idx];
for(i = authority_idx; i > AUTHORITY_DST_IDX; --i) {
nva[i] = nva[i - 1];
remote_addrlen);
rv = ngtcp2_conn_read_pkt(qs->qconn, &path, &pi, buf, recvd, ts);
- if(rv != 0) {
+ if(rv) {
/* TODO Send CONNECTION_CLOSE if possible */
return CURLE_RECV_ERROR;
}
}
rv = ngtcp2_conn_handle_expiry(qs->qconn, ts);
- if(rv != 0) {
+ if(rv) {
failf(data, "ngtcp2_conn_handle_expiry returned error: %s",
ngtcp2_strerror(rv));
return CURLE_SEND_ERROR;
outlen == NGTCP2_ERR_STREAM_SHUT_WR) {
assert(ndatalen == -1);
rv = nghttp3_conn_block_stream(qs->h3conn, stream_id);
- if(rv != 0) {
+ if(rv) {
failf(data, "nghttp3_conn_block_stream returned error: %s\n",
nghttp3_strerror(rv));
return CURLE_SEND_ERROR;
else if(outlen == NGTCP2_ERR_WRITE_MORE) {
assert(ndatalen >= 0);
rv = nghttp3_conn_add_write_offset(qs->h3conn, stream_id, ndatalen);
- if(rv != 0) {
+ if(rv) {
failf(data, "nghttp3_conn_add_write_offset returned error: %s\n",
nghttp3_strerror(rv));
return CURLE_SEND_ERROR;
}
else if(ndatalen >= 0) {
rv = nghttp3_conn_add_write_offset(qs->h3conn, stream_id, ndatalen);
- if(rv != 0) {
+ if(rv) {
failf(data, "nghttp3_conn_add_write_offset returned error: %s\n",
nghttp3_strerror(rv));
return CURLE_SEND_ERROR;
}
/* :authority must come before non-pseudo header fields */
- if(authority_idx != 0 && authority_idx != AUTHORITY_DST_IDX) {
+ if(authority_idx && authority_idx != AUTHORITY_DST_IDX) {
quiche_h3_header authority = nva[authority_idx];
for(i = authority_idx; i > AUTHORITY_DST_IDX; --i) {
nva[i] = nva[i - 1];
rc = SSH_OK;
else if(rc == SSH_AUTH_INFO) {
nprompts = ssh_userauth_kbdint_getnprompts(sshc->ssh_session);
- if(nprompts != 0)
+ if(nprompts)
return SSH_ERROR;
sshc->kbd_state = 2;
* Get the "home" directory
*/
sshc->homedir = sftp_canonicalize_path(sshc->sftp_session, ".");
- if(sshc->homedir == NULL) {
+ if(!sshc->homedir) {
MOVE_TO_ERROR_STATE(CURLE_COULDNT_CONNECT);
break;
}
case SSH_SFTP_QUOTE_SETSTAT:
rc = sftp_setstat(sshc->sftp_session, sshc->quote_path2,
sshc->quote_attrs);
- if(rc != 0 && !sshc->acceptfail) {
+ if(rc && !sshc->acceptfail) {
Curl_safefree(sshc->quote_path1);
Curl_safefree(sshc->quote_path2);
failf(data, "Attempt to set SFTP stats failed: %s",
case SSH_SFTP_QUOTE_SYMLINK:
rc = sftp_symlink(sshc->sftp_session, sshc->quote_path2,
sshc->quote_path1);
- if(rc != 0 && !sshc->acceptfail) {
+ if(rc && !sshc->acceptfail) {
Curl_safefree(sshc->quote_path1);
Curl_safefree(sshc->quote_path2);
failf(data, "symlink command failed: %s",
case SSH_SFTP_QUOTE_MKDIR:
rc = sftp_mkdir(sshc->sftp_session, sshc->quote_path1,
(mode_t)data->set.new_directory_perms);
- if(rc != 0 && !sshc->acceptfail) {
+ if(rc && !sshc->acceptfail) {
Curl_safefree(sshc->quote_path1);
failf(data, "mkdir command failed: %s",
ssh_get_error(sshc->ssh_session));
case SSH_SFTP_QUOTE_RENAME:
rc = sftp_rename(sshc->sftp_session, sshc->quote_path1,
sshc->quote_path2);
- if(rc != 0 && !sshc->acceptfail) {
+ if(rc && !sshc->acceptfail) {
Curl_safefree(sshc->quote_path1);
Curl_safefree(sshc->quote_path2);
failf(data, "rename command failed: %s",
case SSH_SFTP_QUOTE_RMDIR:
rc = sftp_rmdir(sshc->sftp_session, sshc->quote_path1);
- if(rc != 0 && !sshc->acceptfail) {
+ if(rc && !sshc->acceptfail) {
Curl_safefree(sshc->quote_path1);
failf(data, "rmdir command failed: %s",
ssh_get_error(sshc->ssh_session));
case SSH_SFTP_QUOTE_UNLINK:
rc = sftp_unlink(sshc->sftp_session, sshc->quote_path1);
- if(rc != 0 && !sshc->acceptfail) {
+ if(rc && !sshc->acceptfail) {
Curl_safefree(sshc->quote_path1);
failf(data, "rm command failed: %s",
ssh_get_error(sshc->ssh_session));
sftp_attributes attrs;
attrs = sftp_stat(sshc->sftp_session, protop->path);
- if(attrs != 0) {
+ if(attrs) {
data->info.filetime = attrs->mtime;
sftp_attributes_free(attrs);
}
{
int flags;
- if(data->state.resume_from != 0) {
+ if(data->state.resume_from) {
sftp_attributes attrs;
if(data->state.resume_from < 0) {
attrs = sftp_stat(sshc->sftp_session, protop->path);
- if(attrs != 0) {
+ if(attrs) {
curl_off_t size = attrs->size;
if(size < 0) {
failf(data, "Bad file size (%" CURL_FORMAT_CURL_OFF_T ")", size);
}
rc = sftp_seek64(sshc->sftp_file, data->state.resume_from);
- if(rc != 0) {
+ if(rc) {
MOVE_TO_SFTP_CLOSE_STATE();
break;
}
char *tmpLine;
tmpLine = aprintf("%s\n", sshc->readdir_filename);
- if(tmpLine == NULL) {
+ if(!tmpLine) {
state(data, SSH_SFTP_CLOSE);
sshc->actualcode = CURLE_OUT_OF_MEMORY;
break;
sshc->readdir_linkPath = aprintf("%s%s", protop->path,
sshc->readdir_filename);
- if(sshc->readdir_linkPath == NULL) {
+ if(!sshc->readdir_linkPath) {
state(data, SSH_SFTP_CLOSE);
sshc->actualcode = CURLE_OUT_OF_MEMORY;
break;
break;
}
- if(sshc->readdir_link_attrs->name == NULL) {
+ if(!sshc->readdir_link_attrs->name) {
sshc->readdir_tmp = sftp_readlink(sshc->sftp_session,
sshc->readdir_linkPath);
- if(sshc->readdir_filename == NULL)
+ if(!sshc->readdir_filename)
sshc->readdir_len = 0;
else
sshc->readdir_len = strlen(sshc->readdir_tmp);
}
rc = sftp_seek64(sshc->sftp_file, from);
- if(rc != 0) {
+ if(rc) {
MOVE_TO_SFTP_CLOSE_STATE();
break;
}
size - data->state.resume_from);
rc = sftp_seek64(sshc->sftp_file, data->state.resume_from);
- if(rc != 0) {
+ if(rc) {
MOVE_TO_SFTP_CLOSE_STATE();
break;
}
ssh = &conn->proto.sshc;
ssh->ssh_session = ssh_new();
- if(ssh->ssh_session == NULL) {
+ if(!ssh->ssh_session) {
failf(data, "Failure initialising ssh session");
return CURLE_FAILED_INIT;
}
* command with a space so we can check for it unconditionally
*/
cp = strchr(cmd, ' ');
- if(cp == NULL) {
+ if(!cp) {
failf(data, "Syntax error in SFTP command. Supply parameter(s)!");
state(data, SSH_SFTP_CLOSE);
sshc->nextstate = SSH_NO_STATE;
if(sshc->quote_attrs)
sftp_attributes_free(sshc->quote_attrs);
sshc->quote_attrs = sftp_stat(sshc->sftp_session, sshc->quote_path2);
- if(sshc->quote_attrs == NULL) {
+ if(!sshc->quote_attrs) {
Curl_safefree(sshc->quote_path1);
Curl_safefree(sshc->quote_path2);
failf(data, "Attempt to get SFTP stats failed: %d",
out_of_memory = TRUE;
}
- if(out_of_memory || sshc->rsa == NULL) {
+ if(out_of_memory || !sshc->rsa) {
Curl_safefree(sshc->rsa);
Curl_safefree(sshc->rsa_pub);
state(data, SSH_SESSION_FREE);
* command with a space so we can check for it unconditionally
*/
cp = strchr(cmd, ' ');
- if(cp == NULL) {
+ if(!cp) {
failf(data, "Syntax error command '%s'. Missing parameter!",
cmd);
state(data, SSH_SFTP_CLOSE);
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- if(rc != 0 && !sshc->acceptfail) { /* get those attributes */
+ if(rc && !sshc->acceptfail) { /* get those attributes */
sftperr = libssh2_sftp_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
Curl_safefree(sshc->quote_path2);
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- if(rc != 0 && !sshc->acceptfail) {
+ if(rc && !sshc->acceptfail) {
sftperr = libssh2_sftp_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
Curl_safefree(sshc->quote_path2);
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- if(rc != 0 && !sshc->acceptfail) {
+ if(rc && !sshc->acceptfail) {
sftperr = libssh2_sftp_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
Curl_safefree(sshc->quote_path2);
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- if(rc != 0 && !sshc->acceptfail) {
+ if(rc && !sshc->acceptfail) {
sftperr = libssh2_sftp_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
failf(data, "mkdir command failed: %s",
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- if(rc != 0 && !sshc->acceptfail) {
+ if(rc && !sshc->acceptfail) {
sftperr = libssh2_sftp_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
Curl_safefree(sshc->quote_path2);
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- if(rc != 0 && !sshc->acceptfail) {
+ if(rc && !sshc->acceptfail) {
sftperr = libssh2_sftp_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
failf(data, "rmdir command failed: %s",
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- if(rc != 0 && !sshc->acceptfail) {
+ if(rc && !sshc->acceptfail) {
sftperr = libssh2_sftp_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
failf(data, "rm command failed: %s", sftp_libssh2_strerror(sftperr));
if(rc == LIBSSH2_ERROR_EAGAIN) {
break;
}
- if(rc != 0 && !sshc->acceptfail) {
+ if(rc && !sshc->acceptfail) {
sftperr = libssh2_sftp_last_error(sshc->sftp_session);
Curl_safefree(sshc->quote_path1);
failf(data, "statvfs command failed: %s",
* same name as the last directory in the path.
*/
- if(data->state.resume_from != 0) {
+ if(data->state.resume_from) {
LIBSSH2_SFTP_ATTRIBUTES attrs;
if(data->state.resume_from < 0) {
rc = libssh2_sftp_stat_ex(sshc->sftp_session, sshp->path,
sshc->ssh_session = libssh2_session_init_ex(my_libssh2_malloc,
my_libssh2_free,
my_libssh2_realloc, data);
- if(sshc->ssh_session == NULL) {
+ if(!sshc->ssh_session) {
failf(data, "Failure initialising ssh session");
return CURLE_FAILED_INIT;
}
}
sshc->ssh_session = wolfSSH_new(sshc->ctx);
- if(sshc->ssh_session == NULL) {
+ if(!sshc->ssh_session) {
failf(data, "No wolfSSH session");
goto error;
}
char *line = aprintf("%s\n",
data->set.list_only ?
name->fName : name->lName);
- if(line == NULL) {
+ if(!line) {
state(data, SSH_SFTP_CLOSE);
sshc->actualcode = CURLE_OUT_OF_MEMORY;
break;
strerr = gnutls_alert_get_name(alert);
}
- if(strerr == NULL)
+ if(!strerr)
strerr = gnutls_strerror(rc);
infof(data, "gnutls_handshake() warning: %s\n", strerr);
strerr = gnutls_alert_get_name(alert);
}
- if(strerr == NULL)
+ if(!strerr)
strerr = gnutls_strerror(rc);
failf(data, "gnutls_handshake() failed: %s", strerr);
{
struct_stat st;
- if(filename == NULL)
+ if(!filename)
return 0;
if(stat(filename, &st) == 0)
static int nss_init(void)
{
/* curl_global_init() is not thread-safe so this test is ok */
- if(nss_initlock == NULL) {
+ if(!nss_initlock) {
PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0);
nss_initlock = PR_NewLock();
nss_crllock = PR_NewLock();
goto end;
}
- if(x == NULL) {
+ if(!x) {
ret = 0;
goto end;
}
ret = 0;
goto end;
}
- if(pkey == NULL) {
+ if(!pkey) {
ret = 0;
goto end;
}
x = PEM_read_bio_X509_AUX(in, NULL,
passwd_callback, (void *)key_passwd);
- if(x == NULL) {
+ if(!x) {
ret = 0;
goto end;
}
STACK_OF(X509) *ca = NULL;
if(cert_blob) {
cert_bio = BIO_new_mem_buf(cert_blob->data, (int)(cert_blob->len));
- if(cert_bio == NULL) {
+ if(!cert_bio) {
failf(data,
"BIO_new_mem_buf NULL, " OSSL_PACKAGE
" error %s",
}
else {
cert_bio = BIO_new(BIO_s_file());
- if(cert_bio == NULL) {
+ if(!cert_bio) {
failf(data,
"BIO_new return NULL, " OSSL_PACKAGE
" error %s",
const unsigned char *neg_protocol;
unsigned int len;
SSL_get0_alpn_selected(backend->handle, &neg_protocol, &len);
- if(len != 0) {
+ if(len) {
infof(data, "ALPN, server accepted to use %.*s\n", len, neg_protocol);
#ifdef USE_NGHTTP2
(int)SSL_SET_OPTION(issuercert_blob)->len);
else {
fp = BIO_new(BIO_s_file());
- if(fp == NULL) {
+ if(!fp) {
failf(data,
"BIO_new return NULL, " OSSL_PACKAGE
" error %s",
int result;
backend->tlsbuf = calloc(TLSBUF_SIZE, 1);
- if(backend->tlsbuf == NULL) {
+ if(!backend->tlsbuf) {
return CURLE_OUT_OF_MEMORY;
}
size_t store_name_len;
sep = _tcschr(path, TEXT('\\'));
- if(sep == NULL)
+ if(!sep)
return CURLE_SSL_CERTPROBLEM;
store_name_len = sep - path;
store_path_start = sep + 1;
sep = _tcschr(store_path_start, TEXT('\\'));
- if(sep == NULL)
+ if(!sep)
return CURLE_SSL_CERTPROBLEM;
*thumbprint = sep + 1;
*sep = TEXT('\0');
*store_path = _tcsdup(store_path_start);
*sep = TEXT('\\');
- if(*store_path == NULL)
+ if(!*store_path)
return CURLE_OUT_OF_MEMORY;
return CURLE_OK;
}
if(!blob)
free(certdata);
- if(cert_store == NULL) {
+ if(!cert_store) {
DWORD errorcode = GetLastError();
if(errorcode == ERROR_INVALID_PASSWORD)
failf(data, "schannel: Failed to import cert file %s, "
cert_store, X509_ASN_ENCODING | PKCS_7_ASN_ENCODING, 0,
CERT_FIND_ANY, NULL, NULL);
- if(client_certs[0] == NULL) {
+ if(!client_certs[0]) {
failf(data, "schannel: Failed to get certificate from file %s"
", last error is 0x%x",
cert_showfilename_error, GetLastError());
return CURLE_SSL_CONNECT_ERROR;
/* buffer to store previously received and decrypted data */
- if(BACKEND->decdata_buffer == NULL) {
+ if(!BACKEND->decdata_buffer) {
BACKEND->decdata_offset = 0;
BACKEND->decdata_length = CURL_SCHANNEL_BUFFER_INIT_SIZE;
BACKEND->decdata_buffer = malloc(BACKEND->decdata_length);
- if(BACKEND->decdata_buffer == NULL) {
+ if(!BACKEND->decdata_buffer) {
failf(data, "schannel: unable to allocate memory");
return CURLE_OUT_OF_MEMORY;
}
}
/* buffer to store previously received and encrypted data */
- if(BACKEND->encdata_buffer == NULL) {
+ if(!BACKEND->encdata_buffer) {
BACKEND->encdata_is_incomplete = false;
BACKEND->encdata_offset = 0;
BACKEND->encdata_length = CURL_SCHANNEL_BUFFER_INIT_SIZE;
BACKEND->encdata_buffer = malloc(BACKEND->encdata_length);
- if(BACKEND->encdata_buffer == NULL) {
+ if(!BACKEND->encdata_buffer) {
failf(data, "schannel: unable to allocate memory");
return CURLE_OUT_OF_MEMORY;
}
reallocated_buffer = realloc(BACKEND->encdata_buffer,
reallocated_length);
- if(reallocated_buffer == NULL) {
+ if(!reallocated_buffer) {
failf(data, "schannel: unable to re-allocate memory");
return CURLE_OUT_OF_MEMORY;
}
InitSecBuffer(&outbuf[2], SECBUFFER_EMPTY, NULL, 0);
InitSecBufferDesc(&outbuf_desc, outbuf, 3);
- if(inbuf[0].pvBuffer == NULL) {
+ if(!inbuf[0].pvBuffer) {
failf(data, "schannel: unable to allocate memory");
return CURLE_OUT_OF_MEMORY;
}
SECPKG_ATTR_REMOTE_CERT_CONTEXT,
&ccert_context);
- if((sspi_status != SEC_E_OK) || (ccert_context == NULL)) {
+ if((sspi_status != SEC_E_OK) || !ccert_context) {
failf(data, "schannel: failed to retrieve remote cert context");
return CURLE_PEER_FAILED_VERIFICATION;
}
}
reallocated_buffer = realloc(BACKEND->encdata_buffer,
reallocated_length);
- if(reallocated_buffer == NULL) {
+ if(!reallocated_buffer) {
*err = CURLE_OUT_OF_MEMORY;
failf(data, "schannel: unable to re-allocate memory");
goto cleanup;
}
reallocated_buffer = realloc(BACKEND->decdata_buffer,
reallocated_length);
- if(reallocated_buffer == NULL) {
+ if(!reallocated_buffer) {
*err = CURLE_OUT_OF_MEMORY;
failf(data, "schannel: unable to re-allocate memory");
goto cleanup;
SECPKG_ATTR_REMOTE_CERT_CONTEXT,
&pCertContextServer);
- if((sspi_status != SEC_E_OK) || (pCertContextServer == NULL)) {
+ if((sspi_status != SEC_E_OK) || !pCertContextServer) {
char buffer[STRERROR_LEN];
failf(data, "schannel: Failed to read remote certificate context: %s",
Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer)));
if(entry->dwAltNameChoice != CERT_ALT_NAME_DNS_NAME) {
continue;
}
- if(entry->pwszDNSName == NULL) {
+ if(!entry->pwszDNSName) {
infof(data, "schannel: Empty DNS name.");
continue;
}
SECPKG_ATTR_REMOTE_CERT_CONTEXT,
&pCertContextServer);
- if((sspi_status != SEC_E_OK) || (pCertContextServer == NULL)) {
+ if((sspi_status != SEC_E_OK) || !pCertContextServer) {
char buffer[STRERROR_LEN];
failf(data, "schannel: Failed to read remote certificate context: %s",
Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer)));
{
struct_stat st;
- if(filename == NULL)
+ if(!filename)
return false;
if(stat(filename, &st) == 0)
/* Jump through the separators at the beginning of the certificate. */
sep_start = strstr(in, "-----");
- if(sep_start == NULL)
+ if(!sep_start)
return 0;
cert_start = strstr(sep_start + 1, "-----");
- if(cert_start == NULL)
+ if(!cert_start)
return -1;
cert_start += 5;
/* Find separator after the end of the certificate. */
cert_end = strstr(cert_start, "-----");
- if(cert_end == NULL)
+ if(!cert_end)
return -1;
sep_end = strstr(cert_end + 1, "-----");
- if(sep_end == NULL)
+ if(!sep_end)
return -1;
sep_end += 5;
*/
CFMutableArrayRef array = CFArrayCreateMutable(kCFAllocatorDefault, 0,
&kCFTypeArrayCallBacks);
- if(array == NULL) {
+ if(!array) {
free(certbuf);
failf(data, "SSL: out of memory creating CA certificate array");
return CURLE_OUT_OF_MEMORY;
SecTrustRef trust;
OSStatus ret = SSLCopyPeerTrust(ctx, &trust);
- if(trust == NULL) {
+ if(!trust) {
failf(data, "SSL: error getting certificate chain");
CFRelease(array);
return CURLE_PEER_FAILED_VERIFICATION;
do {
SecTrustRef trust;
OSStatus ret = SSLCopyPeerTrust(ctx, &trust);
- if(ret != noErr || trust == NULL)
+ if(ret != noErr || !trust)
break;
SecKeyRef keyRef = SecTrustCopyPublicKey(trust);
CFRelease(trust);
- if(keyRef == NULL)
+ if(!keyRef)
break;
#ifdef SECTRANSP_PINNEDPUBKEY_V1
publicKeyBits = SecKeyCopyExternalRepresentation(keyRef, NULL);
CFRelease(keyRef);
- if(publicKeyBits == NULL)
+ if(!publicKeyBits)
break;
#elif SECTRANSP_PINNEDPUBKEY_V2
OSStatus success = SecItemExport(keyRef, kSecFormatOpenSSL, 0, NULL,
&publicKeyBits);
CFRelease(keyRef);
- if(success != errSecSuccess || publicKeyBits == NULL)
+ if(success != errSecSuccess || !publicKeyBits)
break;
#endif /* SECTRANSP_PINNEDPUBKEY_V2 */
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, 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
in_bytes = out_bytes = length;
res = iconv(outbound_cd, &input_ptr, &in_bytes,
&output_ptr, &out_bytes);
- if((res == (size_t)-1) || (in_bytes != 0)) {
+ if((res == (size_t)-1) || (in_bytes)) {
return CURLE_CONV_FAILED;
}
in_bytes = out_bytes = length;
res = iconv(inbound_cd, &input_ptr, &in_bytes,
&output_ptr, &out_bytes);
- if((res == (size_t)-1) || (in_bytes != 0)) {
+ if((res == (size_t)-1) || (in_bytes)) {
return CURLE_CONV_FAILED;
}
{
int rv;
fprintf(config->errors, "Metalink: validating (%s)...\n", filename);
- if(mlfile->checksum == NULL) {
+ if(!mlfile->checksum) {
fprintf(config->errors,
"Metalink: validating (%s) FAILED (digest missing)\n", filename);
return -2;
fileinfo->resources point to the target file. BitTorrent
metainfo file URL may be appeared in fileinfo->metaurls.
*/
- if((*p)->type == NULL ||
+ if(!(*p)->type ||
curl_strequal((*p)->type, "http") ||
curl_strequal((*p)->type, "https") ||
curl_strequal((*p)->type, "ftp") ||
/* metlaink_parse_final deletes outs->metalink_parser */
r = metalink_parse_final(outs->metalink_parser, NULL, 0, &metalink);
outs->metalink_parser = NULL;
- if(r != 0) {
+ if(r) {
return -1;
}
- if(metalink->files == NULL) {
+ if(!metalink->files) {
fprintf(config->global->errors, "Metalink: parsing (%s) WARNING "
"(missing or invalid file name)\n",
metalink_url);
static void delete_metalink_resource(struct metalink_resource *res)
{
- if(res == NULL) {
+ if(!res) {
return;
}
Curl_safefree(res->url);
void delete_metalinkfile(struct metalinkfile *mlfile)
{
struct metalink_resource *res;
- if(mlfile == NULL) {
+ if(!mlfile) {
return;
}
Curl_safefree(mlfile->filename);
/* !checksrc! disable FOPENMODE 1 */
file = fopen(name, "r"); /* VMS */
- if(file == NULL) {
+ if(!file) {
return 0;
}
count = 0;
ret_stat = 1;
while(ret_stat > 0) {
ret_stat = fread(buffer, 1, sizeof(buffer), file);
- if(ret_stat != 0)
+ if(ret_stat)
count += ret_stat;
}
fclose(file);
urlnode = config->state.urlnode;
if(urlnode->flags & GETOUT_METALINK) {
metalink = 1;
- if(mlfile_last == NULL) {
+ if(!mlfile_last) {
mlfile_last = config->metalinkfile_list;
}
mlfile = mlfile_last;
/* curl 7.17.1 */
if(!config->nokeepalive) {
my_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
- if(config->alivetime != 0) {
+ if(config->alivetime) {
my_setopt(curl, CURLOPT_TCP_KEEPIDLE, config->alivetime);
my_setopt(curl, CURLOPT_TCP_KEEPINTVL, config->alivetime);
}
#ifdef USE_METALINK
if(!metalink && config->use_metalink) {
outs->metalink_parser = metalink_parser_context_new();
- if(outs->metalink_parser == NULL) {
+ if(!outs->metalink_parser) {
result = CURLE_OUT_OF_MEMORY;
break;
}
shell = getenv("SHELL");
/* No shell, means DCL */
- if(shell == NULL) {
+ if(!shell) {
vms_shell = 1;
return 1;
}
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, 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
goto test_cleanup;
curl_easy_getinfo(curl, CURLINFO_CONDITION_UNMET, &unmet);
- if(unmet != 0L) {
+ if(unmet) {
res = TEST_ERR_FAILURE; /* not correct */
goto test_cleanup;
}
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, 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
__FILE__, __LINE__, res, curl_easy_strerror(res));
goto test_cleanup;
}
- if(httpcode != 0) {
+ if(httpcode) {
fprintf(stderr, "%s:%d curl_easy_reset failed to zero the response code\n"
"possible regression of github bug 1017\n", __FILE__, __LINE__);
res = CURLE_HTTP_RETURNED_ERROR;
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, 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
}
curl = curl_easy_init();
- if(curl == NULL) {
+ if(!curl) {
fprintf(stderr, "curl_easy_init() failed\n");
curl_global_cleanup();
return TEST_ERR_MAJOR_BAD;
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, 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
__FILE__, __LINE__, res, curl_easy_strerror(res));
goto test_cleanup;
}
- if(protocol != 0) {
+ if(protocol) {
fprintf(stderr, "%s:%d protocol init failed; expected 0 but is %ld\n",
__FILE__, __LINE__, protocol);
res = CURLE_FAILED_INIT;
__FILE__, __LINE__, res, curl_easy_strerror(res));
goto test_cleanup;
}
- if(protocol != 0) {
+ if(protocol) {
fprintf(stderr, "%s:%d protocol init failed; expected 0 but is %ld\n",
__FILE__, __LINE__, protocol);
res = CURLE_FAILED_INIT;
__FILE__, __LINE__, res, curl_easy_strerror(res));
goto test_cleanup;
}
- if(protocol != 0) {
+ if(protocol) {
fprintf(stderr, "%s:%d protocol init failed; expected 0 but is %ld\n",
__FILE__, __LINE__, protocol);
res = CURLE_FAILED_INIT;
__FILE__, __LINE__, res, curl_easy_strerror(res));
goto test_cleanup;
}
- if(scheme == NULL || memcmp(scheme, "HTTP", 5) != 0) {
+ if(!scheme || memcmp(scheme, "HTTP", 5) != 0) {
fprintf(stderr, "%s:%d scheme of http resource is incorrect; "
"expected 'HTTP' but is %s\n",
__FILE__, __LINE__,
__FILE__, __LINE__, res, curl_easy_strerror(res));
goto test_cleanup;
}
- if(scheme != 0) {
+ if(scheme) {
fprintf(stderr, "%s:%d scheme init failed; expected NULL\n",
__FILE__, __LINE__);
res = CURLE_FAILED_INIT;
__FILE__, __LINE__, res, curl_easy_strerror(res));
goto test_cleanup;
}
- if(scheme != 0) {
+ if(scheme) {
fprintf(stderr, "%s:%d scheme init failed; expected NULL\n",
__FILE__, __LINE__);
res = CURLE_FAILED_INIT;
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, 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
}
slist = curl_slist_append(slist, "Transfer-Encoding: chunked");
- if(slist == NULL) {
+ if(!slist) {
fprintf(stderr, "curl_slist_append() failed\n");
curl_easy_cleanup(curl);
curl_global_cleanup();
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, 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
}
for(i = 0; i < 3; i++) {
fpa[i] = fopen(DEV_NULL, FOPEN_READTEXT);
- if(fpa[i] == NULL) {
+ if(!fpa[i]) {
store_errmsg("fopen failed", errno);
fprintf(stderr, "%s\n", msgbuff);
ret = 0;
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, 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
}
for(i = 0; i < 3; i++) {
fpa[i] = fopen(DEV_NULL, FOPEN_READTEXT);
- if(fpa[i] == NULL) {
+ if(!fpa[i]) {
store_errmsg("fopen failed", errno);
fprintf(stderr, "%s\n", msgbuff);
ret = 0;
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, 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
* call to freedirs).
*/
newURL = aprintf("%s./", URL);
- if(newURL == NULL) {
+ if(!newURL) {
curl_easy_cleanup(curl);
curl_global_cleanup();
return TEST_ERR_MAJOR_BAD;
}
slist = curl_slist_append(NULL, "SYST");
- if(slist == NULL) {
+ if(!slist) {
free(newURL);
curl_easy_cleanup(curl);
curl_global_cleanup();
break;
}
- } while((res == CURLE_OK && iolen != 0) || (res == CURLE_AGAIN));
+ } while((res == CURLE_OK && iolen) || (res == CURLE_AGAIN));
}
- if(iolen != 0)
+ if(iolen)
res = (CURLcode)TEST_ERR_FAILURE;
}
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, 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
close(sdp);
sdpf = fopen("log/file568.txt", "rb");
- if(sdpf == NULL) {
+ if(!sdpf) {
fprintf(stderr, "can't open log/file568.txt\n");
res = TEST_ERR_MAJOR_BAD;
goto test_cleanup;
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, 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
int i;
FILE *idfile = fopen(libtest_arg2, "wb");
- if(idfile == NULL) {
+ if(!idfile) {
fprintf(stderr, "couldn't open the Session ID File\n");
return TEST_ERR_MAJOR_BAD;
}
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, 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
int request = 1;
FILE *protofile = fopen(libtest_arg2, "wb");
- if(protofile == NULL) {
+ if(!protofile) {
fprintf(stderr, "Couldn't open the protocol dump file\n");
return TEST_ERR_MAJOR_BAD;
}
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, 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
close(params);
paramsf = fopen("log/file572.txt", "rb");
- if(paramsf == NULL) {
+ if(!paramsf) {
fprintf(stderr, "can't open log/file572.txt\n");
res = TEST_ERR_MAJOR_BAD;
goto test_cleanup;
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, 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
}
slist = curl_slist_append(slist, "Transfer-Encoding: chunked");
- if(slist == NULL) {
+ if(!slist) {
fprintf(stderr, "curl_slist_append() failed\n");
curl_easy_cleanup(curl);
curl_global_cleanup();
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, 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
}
slist = curl_slist_append(NULL, "SYST");
- if(slist == NULL) {
+ if(!slist) {
fprintf(stderr, "curl_slist_append() failed\n");
res = TEST_ERR_MAJOR_BAD;
goto test_cleanup;
memcpy(rtp_scratch + 4 + i, RTP_DATA, RTP_DATA_SIZE);
}
- if(req->rtp_buffer == NULL) {
+ if(!req->rtp_buffer) {
req->rtp_buffer = rtp_scratch;
req->rtp_buffersize = rtp_size + 4;
}
size_t writeleft;
FILE *dump;
- if(reqbuf == NULL)
+ if(!reqbuf)
return;
if(totalsize == 0)
return;
do {
dump = fopen(REQUEST_DUMP, "ab");
- } while((dump == NULL) && ((error = errno) == EINTR));
- if(dump == NULL) {
+ } while(!dump && ((error = errno) == EINTR));
+ if(!dump) {
logmsg("Error opening file %s error: %d %s",
REQUEST_DUMP, error, strerror(error));
logmsg("Failed to write request input to " REQUEST_DUMP);
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, 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
/* allocate internal array for the internal data */
data = calloc(nfds, sizeof(struct select_ws_data));
- if(data == NULL) {
+ if(!data) {
CloseHandle(abort);
CloseHandle(mutex);
errno = ENOMEM;
/* allocate internal array for the internal event handles */
handles = calloc(nfds + 1, sizeof(HANDLE));
- if(handles == NULL) {
+ if(!handles) {
CloseHandle(abort);
CloseHandle(mutex);
free(data);
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, 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
return CURL_SOCKET_BAD;
}
/* reserved, should be zero */
- if(buffer[SOCKS5_RESERVED] != 0) {
+ if(buffer[SOCKS5_RESERVED]) {
logmsg("Request COMMAND byte not %d", config.reqcmd);
return CURL_SOCKET_BAD;
}
FILE *dump;
const char *dumpfile = is_proxy?REQUEST_PROXY_DUMP:REQUEST_DUMP;
- if(reqbuf == NULL)
+ if(!reqbuf)
return;
if(totalsize == 0)
return;
do {
dump = fopen(dumpfile, "ab");
- } while((dump == NULL) && ((error = errno) == EINTR));
- if(dump == NULL) {
+ } while(!dump && ((error = errno) == EINTR));
+ if(!dump) {
logmsg("[2] Error opening file %s error: %d %s",
dumpfile, error, strerror(error));
logmsg("Failed to write request input ");
}
/* Reset the request, unless we're still in the middle of reading */
- if(rc != 0)
+ if(rc)
init_httprequest(&req);
} while(rc > 0);
}
wVersionRequested = MAKEWORD(2, 2);
err = WSAStartup(wVersionRequested, &wsaData);
- if(err != 0) {
+ if(err) {
perror("Winsock init failed");
logmsg("Error initialising winsock -- aborting");
exit(1);
do {
lockfile = fopen(filename, "wb");
- } while((lockfile == NULL) && ((error = errno) == EINTR));
- if(lockfile == NULL) {
+ } while(!lockfile && ((error = errno) == EINTR));
+ if(!lockfile) {
logmsg("Error creating lock file %s error: %d %s",
filename, error, strerror(error));
return;
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, 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
struct Curl_tree *node;
int i;
int count;
- if(t == NULL)
+ if(!t)
return;
splayprint(t->larger, d + 1, output);
break;
}
- if(dns->timestamp != 0 && tests[i].permanent) {
+ if(dns->timestamp && tests[i].permanent) {
fprintf(stderr, "%s:%d tests[%d] failed. the timestamp is not zero "
"but tests[%d].permanent is TRUE\n",
__FILE__, __LINE__, i, i);