From: MonkeybreadSoftware Date: Wed, 17 Apr 2024 08:27:42 +0000 (+0200) Subject: lib: silence warnings on comma misuse X-Git-Tag: curl-8_8_0~203 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b4401a4fb363f611353a83aee209ba24d1f3a0f;p=thirdparty%2Fcurl.git lib: silence warnings on comma misuse Building curl with -Wcomma, I see warnings about "possible misuse of comma operator here" and moving fields assignment out of the for() fixes it. Closes #13392 --- diff --git a/lib/cookie.c b/lib/cookie.c index c1ed2913c4..837caaab38 100644 --- a/lib/cookie.c +++ b/lib/cookie.c @@ -886,7 +886,8 @@ Curl_cookie_add(struct Curl_easy *data, * Now loop through the fields and init the struct we already have * allocated */ - for(ptr = firstptr, fields = 0; ptr && !badcookie; + fields = 0; + for(ptr = firstptr; ptr && !badcookie; ptr = strtok_r(NULL, "\t", &tok_buf), fields++) { switch(fields) { case 0: diff --git a/lib/ldap.c b/lib/ldap.c index e2546aa59e..a545f87d9d 100644 --- a/lib/ldap.c +++ b/lib/ldap.c @@ -546,7 +546,8 @@ static CURLcode ldap_do(struct Curl_easy *data, bool *done) goto quit; } - for(num = 0, entryIterator = ldap_first_entry(server, ldapmsg); + num = 0; + for(entryIterator = ldap_first_entry(server, ldapmsg); entryIterator; entryIterator = ldap_next_entry(server, entryIterator), num++) { BerElement *ber = NULL;