summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2022-01-03 16:39:45 +0100
committerDaniel Stenberg <daniel@haxx.se>2022-01-03 17:05:36 +0100
commitc1a4f3e8156089ff5428cb3994560a685190faee (patch)
tree563157dd1339f6acbbba6266dfdb38c96ba5f926
parent6da5bc63caba8b288978f400aec08514bf03bae7 (diff)
downloadcurl-c1a4f3e8156089ff5428cb3994560a685190faee.tar.gz
libtest: avoid "assignment within conditional expression"
In lib530, lib540 and lib582 Closes #8218
-rw-r--r--tests/libtest/lib530.c10
-rw-r--r--tests/libtest/lib540.c7
-rw-r--r--tests/libtest/lib582.c10
3 files changed, 17 insertions, 10 deletions
diff --git a/tests/libtest/lib530.c b/tests/libtest/lib530.c
index 3d31f3d0d..d9d10de77 100644
--- a/tests/libtest/lib530.c
+++ b/tests/libtest/lib530.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2022, 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
@@ -175,11 +175,13 @@ static int curlTimerCallback(CURLM *multi, long timeout_ms, void *userp)
*/
static int checkForCompletion(CURLM *curl, int *success)
{
- int numMessages;
- CURLMsg *message;
int result = 0;
*success = 0;
- while((message = curl_multi_info_read(curl, &numMessages))) {
+ while(1) {
+ int numMessages;
+ CURLMsg *message = curl_multi_info_read(curl, &numMessages);
+ if(!message)
+ break;
if(message->msg == CURLMSG_DONE) {
result = 1;
if(message->data.result == CURLE_OK)
diff --git a/tests/libtest/lib540.c b/tests/libtest/lib540.c
index 2e5885ff2..d34029d84 100644
--- a/tests/libtest/lib540.c
+++ b/tests/libtest/lib540.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2022, 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,10 @@ static int loop(int num, CURLM *cm, const char *url, const char *userpwd,
return res;
}
- while((msg = curl_multi_info_read(cm, &Q))) {
+ while(1) {
+ msg = curl_multi_info_read(cm, &Q);
+ if(!msg)
+ break;
if(msg->msg == CURLMSG_DONE) {
int i;
CURL *e = msg->easy_handle;
diff --git a/tests/libtest/lib582.c b/tests/libtest/lib582.c
index 031793d6a..135aa1ad0 100644
--- a/tests/libtest/lib582.c
+++ b/tests/libtest/lib582.c
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2022, 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
@@ -147,11 +147,13 @@ static int curlTimerCallback(CURLM *multi, long timeout_ms, void *userp)
*/
static int checkForCompletion(CURLM *curl, int *success)
{
- int numMessages;
- CURLMsg *message;
int result = 0;
*success = 0;
- while((message = curl_multi_info_read(curl, &numMessages))) {
+ while(1) {
+ int numMessages;
+ CURLMsg *message = curl_multi_info_read(curl, &numMessages);
+ if(!message)
+ break;
if(message->msg == CURLMSG_DONE) {
result = 1;
if(message->data.result == CURLE_OK)