tests: rename more CURLcode variables to result

For consistency.

Also:
- one remaining in `src/tool_writeout.c`.
- replace casting an `int` to `CURLcode`.
- lib758: rename `CURLMcode` `result` to `mresult`.
- move literals to the right side of if expressions.

Follow-up to d0dc6e2ec0 #20426
Follow-up to 56f600ec23

Closes #20432
This commit is contained in:
Viktor Szakats 2026-01-25 18:12:40 +01:00
parent 26c39d8df1
commit 2da1bbca96
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
33 changed files with 307 additions and 303 deletions

View file

@ -41,9 +41,9 @@ static void t1620_parse(const char *input,
char *userstr = NULL;
char *passwdstr = NULL;
char *options = NULL;
CURLcode rc = Curl_parse_login_details(input, strlen(input), &userstr,
&passwdstr, &options);
fail_unless(rc == CURLE_OK, "Curl_parse_login_details() failed");
CURLcode result = Curl_parse_login_details(input, strlen(input), &userstr,
&passwdstr, &options);
fail_unless(result == CURLE_OK, "Curl_parse_login_details() failed");
fail_unless(!!exp_username == !!userstr, "username expectation failed");
fail_unless(!!exp_password == !!passwdstr, "password expectation failed");
@ -70,32 +70,32 @@ static CURLcode test_unit1620(const char *arg)
{
UNITTEST_BEGIN(t1620_setup())
CURLcode rc;
CURLcode result;
struct Curl_easy *empty;
enum dupstring i;
bool async = FALSE;
bool protocol_connect = FALSE;
rc = Curl_open(&empty);
if(rc)
result = Curl_open(&empty);
if(result)
goto unit_test_abort;
fail_unless(rc == CURLE_OK, "Curl_open() failed");
fail_unless(result == CURLE_OK, "Curl_open() failed");
rc = Curl_connect(empty, &async, &protocol_connect);
fail_unless(rc == CURLE_URL_MALFORMAT,
result = Curl_connect(empty, &async, &protocol_connect);
fail_unless(result == CURLE_URL_MALFORMAT,
"Curl_connect() failed to return CURLE_URL_MALFORMAT");
fail_unless(empty->magic == CURLEASY_MAGIC_NUMBER,
"empty->magic should be equal to CURLEASY_MAGIC_NUMBER");
/* double invoke to ensure no dependency on internal state */
rc = Curl_connect(empty, &async, &protocol_connect);
fail_unless(rc == CURLE_URL_MALFORMAT,
result = Curl_connect(empty, &async, &protocol_connect);
fail_unless(result == CURLE_URL_MALFORMAT,
"Curl_connect() failed to return CURLE_URL_MALFORMAT");
rc = Curl_init_do(empty, empty->conn);
fail_unless(rc == CURLE_OK, "Curl_init_do() failed");
result = Curl_init_do(empty, empty->conn);
fail_unless(result == CURLE_OK, "Curl_init_do() failed");
t1620_parse("hostname", "hostname", NULL, NULL);
t1620_parse("user:password", "user", "password", NULL);
@ -118,8 +118,8 @@ static CURLcode test_unit1620(const char *arg)
fail_unless(empty->set.str[i] == NULL, "Curl_free() did not set to NULL");
}
rc = Curl_close(&empty);
fail_unless(rc == CURLE_OK, "Curl_close() failed");
result = Curl_close(&empty);
fail_unless(result == CURLE_OK, "Curl_close() failed");
UNITTEST_END(curl_global_cleanup())
}