diff options
author | Daniel Stenberg <daniel@haxx.se> | 2021-12-25 21:41:14 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2021-12-27 23:39:26 +0100 |
commit | 21248e052dbd0db33e8999aeeb919fb6f32c9567 (patch) | |
tree | 3345ae3b11c349ea56a58a387083fece2673e60c /tests | |
parent | acaa79f961a6fd4cde83ea16b5fb85f0a32c7f23 (diff) | |
download | curl-21248e052dbd0db33e8999aeeb919fb6f32c9567.tar.gz |
checksrc: detect more kinds of NULL comparisons we avoid
Co-authored-by: Jay Satiro
Closes #8180
Diffstat (limited to 'tests')
-rw-r--r-- | tests/libtest/lib1536.c | 2 | ||||
-rw-r--r-- | tests/libtest/lib1565.c | 2 | ||||
-rw-r--r-- | tests/libtest/lib505.c | 4 | ||||
-rw-r--r-- | tests/libtest/lib518.c | 2 | ||||
-rw-r--r-- | tests/libtest/lib525.c | 4 | ||||
-rw-r--r-- | tests/libtest/lib530.c | 2 | ||||
-rw-r--r-- | tests/libtest/lib537.c | 2 | ||||
-rw-r--r-- | tests/libtest/lib540.c | 4 | ||||
-rw-r--r-- | tests/libtest/lib541.c | 4 | ||||
-rw-r--r-- | tests/libtest/lib582.c | 6 | ||||
-rw-r--r-- | tests/unit/unit1309.c | 2 |
11 files changed, 17 insertions, 17 deletions
diff --git a/tests/libtest/lib1536.c b/tests/libtest/lib1536.c index b047c9d76..1875c5b61 100644 --- a/tests/libtest/lib1536.c +++ b/tests/libtest/lib1536.c @@ -44,7 +44,7 @@ int test(char *URL) __FILE__, __LINE__, res, curl_easy_strerror(res)); goto test_cleanup; } - if(scheme != NULL) { + if(scheme) { fprintf(stderr, "%s:%d scheme init failed; expected NULL\n", __FILE__, __LINE__); res = CURLE_FAILED_INIT; diff --git a/tests/libtest/lib1565.c b/tests/libtest/lib1565.c index 24fff72d0..e4d1820cd 100644 --- a/tests/libtest/lib1565.c +++ b/tests/libtest/lib1565.c @@ -122,7 +122,7 @@ int test(char *URL) abort_on_test_timeout(); - while((message = curl_multi_info_read(multi, &num)) != NULL) { + while((message = curl_multi_info_read(multi, &num))) { if(message->msg == CURLMSG_DONE) { res = message->data.result; if(res) diff --git a/tests/libtest/lib505.c b/tests/libtest/lib505.c index 6a101d728..b22027a77 100644 --- a/tests/libtest/lib505.c +++ b/tests/libtest/lib505.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 @@ -53,7 +53,7 @@ int test(char *URL) } hd_src = fopen(libtest_arg2, "rb"); - if(NULL == hd_src) { + if(!hd_src) { fprintf(stderr, "fopen failed with error: %d %s\n", errno, strerror(errno)); fprintf(stderr, "Error opening file: %s\n", libtest_arg2); diff --git a/tests/libtest/lib518.c b/tests/libtest/lib518.c index 71b7dc2be..bf7fe8ebf 100644 --- a/tests/libtest/lib518.c +++ b/tests/libtest/lib518.c @@ -91,7 +91,7 @@ static int fopen_works(void) } } for(i = 0; i < 3; i++) { - if(fpa[i] != NULL) + if(fpa[i]) fclose(fpa[i]); } return ret; diff --git a/tests/libtest/lib525.c b/tests/libtest/lib525.c index 0826de3f1..1400b9248 100644 --- a/tests/libtest/lib525.c +++ b/tests/libtest/lib525.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 @@ -53,7 +53,7 @@ int test(char *URL) } hd_src = fopen(libtest_arg2, "rb"); - if(NULL == hd_src) { + if(!hd_src) { fprintf(stderr, "fopen failed with error: %d (%s)\n", errno, strerror(errno)); fprintf(stderr, "Error opening file: (%s)\n", libtest_arg2); diff --git a/tests/libtest/lib530.c b/tests/libtest/lib530.c index 883ec7a63..3d31f3d0d 100644 --- a/tests/libtest/lib530.c +++ b/tests/libtest/lib530.c @@ -179,7 +179,7 @@ static int checkForCompletion(CURLM *curl, int *success) CURLMsg *message; int result = 0; *success = 0; - while((message = curl_multi_info_read(curl, &numMessages)) != NULL) { + while((message = curl_multi_info_read(curl, &numMessages))) { if(message->msg == CURLMSG_DONE) { result = 1; if(message->data.result == CURLE_OK) diff --git a/tests/libtest/lib537.c b/tests/libtest/lib537.c index 730278521..fd852b6b9 100644 --- a/tests/libtest/lib537.c +++ b/tests/libtest/lib537.c @@ -92,7 +92,7 @@ static int fopen_works(void) } } for(i = 0; i < 3; i++) { - if(fpa[i] != NULL) + if(fpa[i]) fclose(fpa[i]); } return ret; diff --git a/tests/libtest/lib540.c b/tests/libtest/lib540.c index 94ee58e4b..2e5885ff2 100644 --- a/tests/libtest/lib540.c +++ b/tests/libtest/lib540.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 @@ -155,7 +155,7 @@ static int loop(int num, CURLM *cm, const char *url, const char *userpwd, return res; } - while((msg = curl_multi_info_read(cm, &Q)) != NULL) { + while((msg = curl_multi_info_read(cm, &Q))) { if(msg->msg == CURLMSG_DONE) { int i; CURL *e = msg->easy_handle; diff --git a/tests/libtest/lib541.c b/tests/libtest/lib541.c index 81939aacd..9a8d19938 100644 --- a/tests/libtest/lib541.c +++ b/tests/libtest/lib541.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 @@ -45,7 +45,7 @@ int test(char *URL) } hd_src = fopen(libtest_arg2, "rb"); - if(NULL == hd_src) { + if(!hd_src) { fprintf(stderr, "fopen failed with error: %d %s\n", errno, strerror(errno)); fprintf(stderr, "Error opening file: %s\n", libtest_arg2); diff --git a/tests/libtest/lib582.c b/tests/libtest/lib582.c index caaefe0bf..031793d6a 100644 --- a/tests/libtest/lib582.c +++ b/tests/libtest/lib582.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 @@ -151,7 +151,7 @@ static int checkForCompletion(CURLM *curl, int *success) CURLMsg *message; int result = 0; *success = 0; - while((message = curl_multi_info_read(curl, &numMessages)) != NULL) { + while((message = curl_multi_info_read(curl, &numMessages))) { if(message->msg == CURLMSG_DONE) { result = 1; if(message->data.result == CURLE_OK) @@ -242,7 +242,7 @@ int test(char *URL) } hd_src = fopen(libtest_arg2, "rb"); - if(NULL == hd_src) { + if(!hd_src) { fprintf(stderr, "fopen() failed with error: %d (%s)\n", errno, strerror(errno)); fprintf(stderr, "Error opening file: (%s)\n", libtest_arg2); diff --git a/tests/unit/unit1309.c b/tests/unit/unit1309.c index 91eb04090..6d6a3274f 100644 --- a/tests/unit/unit1309.c +++ b/tests/unit/unit1309.c @@ -129,7 +129,7 @@ UNITTEST_START printf("Removing nodes not larger than %d\n", i); tv_now.tv_usec = i; root = Curl_splaygetbest(tv_now, root, &removed); - while(removed != NULL) { + while(removed) { printf("removed payload %zu[%zu]\n", (*(size_t *)removed->payload) / 10, (*(size_t *)removed->payload) % 10); |