tidy-up: miscellaneous

- tool_bname: scope an include.
- `endif` comments.
- Markdown fixes.
- comment tidy-ups.
- whitespace, newlines, indent.

Closes #20309
This commit is contained in:
Viktor Szakats 2026-01-02 01:34:05 +01:00
parent 62ba3604dc
commit ac6264366f
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
98 changed files with 829 additions and 863 deletions

View file

@ -35,34 +35,34 @@ static CURLcode t1609_setup(void)
/* CURLOPT_RESOLVE address parsing test - to test the following defect fix:
1) if there is already existing host:port pair in the DNS cache and
we call CURLOPT_RESOLVE, it should also replace addresses.
for example, if there is "test.com:80" with address "1.1.1.1"
and we called CURLOPT_RESOLVE with address "2.2.2.2", then DNS entry needs to
reflect that.
1. if there is already existing host:port pair in the DNS cache and
we call CURLOPT_RESOLVE, it should also replace addresses.
for example, if there is "test.com:80" with address "1.1.1.1"
and we called CURLOPT_RESOLVE with address "2.2.2.2", then DNS entry
needs to reflect that.
2) when cached address is already there and close to expire, then by the
time request is made, it can get expired. This happens because, when
we set address using CURLOPT_RESOLVE,
it usually marks as permanent (by setting timestamp to zero). However,
if address already exists
in the cache, then it does not mark it, but just leaves it as it is.
So we fixing this by timestamp to zero if address already exists too.
2. when cached address is already there and close to expire, then by the
time request is made, it can get expired. This happens because, when
we set address using CURLOPT_RESOLVE,
it usually marks as permanent (by setting timestamp to zero). However,
if address already exists
in the cache, then it does not mark it, but just leaves it as it is.
So we fixing this by timestamp to zero if address already exists too.
Test:
Test:
- insert new entry
- verify that timestamp is not zero
- call set options with CURLOPT_RESOLVE
- then, call Curl_loadhostpairs
- insert new entry
- verify that timestamp is not zero
- call set options with CURLOPT_RESOLVE
- then, call Curl_loadhostpairs
expected result: cached address has zero timestamp.
expected result: cached address has zero timestamp.
- call set options with CURLOPT_RESOLVE with same host:port pair,
different address.
- then, call Curl_loadhostpairs
- call set options with CURLOPT_RESOLVE with same host:port pair,
different address.
- then, call Curl_loadhostpairs
expected result: cached address has zero timestamp and new address
expected result: cached address has zero timestamp and new address
*/
static CURLcode test_unit1609(const char *arg)

View file

@ -63,8 +63,7 @@ static void check_set(const char *name, uint32_t capacity,
for(i = 1; i < slen; ++i) {
fail_unless(Curl_uint32_bset_next(&bset, n, &n), "next failed");
if(n != s[i]) {
curl_mfprintf(stderr, "expected next to be %u"
", not %u\n", s[i], n);
curl_mfprintf(stderr, "expected next to be %u, not %u\n", s[i], n);
fail_unless(n == s[i], "next not correct number");
}
}

View file

@ -60,8 +60,7 @@ static void check_spbset(const char *name, const uint32_t *s, size_t slen)
for(i = 1; i < slen; ++i) {
fail_unless(Curl_uint32_spbset_next(&bset, n, &n), "next failed");
if(n != s[i]) {
curl_mfprintf(stderr, "expected next to be %u"
", not %u\n", s[i], n);
curl_mfprintf(stderr, "expected next to be %u, not %u\n", s[i], n);
fail_unless(n == s[i], "next not correct number");
}
}