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
This commit is contained in:
MonkeybreadSoftware 2024-04-17 10:27:42 +02:00 committed by Daniel Stenberg
parent c6655f7029
commit 0b4401a4fb
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
2 changed files with 4 additions and 2 deletions

View file

@ -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:

View file

@ -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;