summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2021-04-19 10:46:11 +0200
committerDaniel Stenberg <daniel@haxx.se>2021-04-22 09:10:17 +0200
commit063d3f3b96e40b3bf770d04d90612064b9a53c49 (patch)
treedf0a46b661da2352d190a24e4c829ac6052c2a14 /docs
parent19ea52da4df3c3ebc399ae25e705c7a8b5d45d95 (diff)
downloadcurl-063d3f3b96e40b3bf770d04d90612064b9a53c49.tar.gz
tidy-up: make conditional checks more consistent
... remove '== NULL' and '!= 0' Closes #6912
Diffstat (limited to 'docs')
-rw-r--r--docs/examples/curlx.c14
-rw-r--r--docs/examples/externalsocket.c4
-rw-r--r--docs/examples/fopen.c4
-rw-r--r--docs/examples/getinmemory.c4
-rw-r--r--docs/examples/rtsp.c8
-rw-r--r--docs/examples/usercertinmem.c10
6 files changed, 22 insertions, 22 deletions
diff --git a/docs/examples/curlx.c b/docs/examples/curlx.c
index 8b48c99c8..3e24d5df2 100644
--- a/docs/examples/curlx.c
+++ b/docs/examples/curlx.c
@@ -372,7 +372,7 @@ int main(int argc, char **argv)
args++;
}
- if(mimetype == NULL || mimetypeaccept == NULL || p.p12file == NULL)
+ if(!mimetype || !mimetypeaccept || !p.p12file)
badarg = 1;
if(badarg) {
@@ -385,11 +385,11 @@ int main(int argc, char **argv)
/* 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);
@@ -400,11 +400,11 @@ int main(int argc, char **argv)
/* 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);
@@ -453,8 +453,8 @@ int main(int argc, char **argv)
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;
diff --git a/docs/examples/externalsocket.c b/docs/examples/externalsocket.c
index d315ca692..bb29b0e44 100644
--- a/docs/examples/externalsocket.c
+++ b/docs/examples/externalsocket.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * 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
@@ -98,7 +98,7 @@ int main(void)
#ifdef WIN32
WSADATA wsaData;
int initwsa = WSAStartup(MAKEWORD(2, 0), &wsaData);
- if(initwsa != 0) {
+ if(initwsa) {
printf("WSAStartup failed: %d\n", initwsa);
return 1;
}
diff --git a/docs/examples/fopen.c b/docs/examples/fopen.c
index a11a522b4..932140e3e 100644
--- a/docs/examples/fopen.c
+++ b/docs/examples/fopen.c
@@ -13,7 +13,7 @@
* 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
@@ -107,7 +107,7 @@ static size_t write_callback(char *buffer,
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;
}
diff --git a/docs/examples/getinmemory.c b/docs/examples/getinmemory.c
index 909326ce6..120ceac3b 100644
--- a/docs/examples/getinmemory.c
+++ b/docs/examples/getinmemory.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * 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
@@ -43,7 +43,7 @@ WriteMemoryCallback(void *contents, size_t size, size_t nmemb, void *userp)
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;
diff --git a/docs/examples/rtsp.c b/docs/examples/rtsp.c
index dd287d98b..2df37cb33 100644
--- a/docs/examples/rtsp.c
+++ b/docs/examples/rtsp.c
@@ -1,5 +1,5 @@
/*
- * 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
@@ -94,7 +94,7 @@ static void rtsp_describe(CURL *curl, const char *uri,
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;
}
@@ -202,10 +202,10 @@ int main(int argc, char * const argv[])
/* 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 {
diff --git a/docs/examples/usercertinmem.c b/docs/examples/usercertinmem.c
index 35218bdc2..a31cbfcec 100644
--- a/docs/examples/usercertinmem.c
+++ b/docs/examples/usercertinmem.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * 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
@@ -119,7 +119,7 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm)
/* get a BIO */
bio = BIO_new_mem_buf((char *)mypem, -1);
- if(bio == NULL) {
+ if(!bio) {
printf("BIO_new_mem_buf failed\n");
}
@@ -127,7 +127,7 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm)
* 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");
}
@@ -139,13 +139,13 @@ static CURLcode sslctx_function(CURL *curl, void *sslctx, void *parm)
/*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");
}