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

@ -30,26 +30,26 @@
struct test1657_spec {
CURLcode (*setbuf)(const struct test1657_spec *spec, struct dynbuf *buf);
size_t n;
CURLcode exp_res;
CURLcode result_exp;
};
static CURLcode make1657_nested(const struct test1657_spec *spec,
struct dynbuf *buf)
{
CURLcode r;
CURLcode result;
size_t i;
unsigned char open_undef[] = { 0x32, 0x80 };
unsigned char close_undef[] = { 0x00, 0x00 };
for(i = 0; i < spec->n; ++i) {
r = curlx_dyn_addn(buf, open_undef, sizeof(open_undef));
if(r)
return r;
result = curlx_dyn_addn(buf, open_undef, sizeof(open_undef));
if(result)
return result;
}
for(i = 0; i < spec->n; ++i) {
r = curlx_dyn_addn(buf, close_undef, sizeof(close_undef));
if(r)
return r;
result = curlx_dyn_addn(buf, close_undef, sizeof(close_undef));
if(result)
return result;
}
return CURLE_OK;
}
@ -64,22 +64,22 @@ static const struct test1657_spec test1657_specs[] = {
static bool do_test1657(const struct test1657_spec *spec, size_t i,
struct dynbuf *buf)
{
CURLcode res;
CURLcode result;
struct Curl_asn1Element elem;
const char *in;
memset(&elem, 0, sizeof(elem));
curlx_dyn_reset(buf);
res = spec->setbuf(spec, buf);
if(res) {
curl_mfprintf(stderr, "test %zu: error setting buf %d\n", i, res);
result = spec->setbuf(spec, buf);
if(result) {
curl_mfprintf(stderr, "test %zu: error setting buf %d\n", i, result);
return FALSE;
}
in = curlx_dyn_ptr(buf);
res = Curl_x509_getASN1Element(&elem, in, in + curlx_dyn_len(buf));
if(res != spec->exp_res) {
result = Curl_x509_getASN1Element(&elem, in, in + curlx_dyn_len(buf));
if(result != spec->result_exp) {
curl_mfprintf(stderr, "test %zu: expect result %d, got %d\n",
i, spec->exp_res, res);
i, spec->result_exp, result);
return FALSE;
}
return TRUE;