units: tidy up dynbuf init

Init dynbuf after global init to bring closer to use, improve
readability and sync test sources.

Closes #21451
This commit is contained in:
Viktor Szakats 2026-04-26 22:06:59 +02:00
parent c1cfdf59ac
commit aab8d47227
No known key found for this signature in database
4 changed files with 10 additions and 9 deletions

View file

@ -94,13 +94,13 @@ static CURLcode test_unit1656(const char *arg)
struct dynbuf dbuf;
bool all_ok = TRUE;
curlx_dyn_init(&dbuf, 32 * 1024);
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
curl_mfprintf(stderr, "curl_global_init() failed\n");
return TEST_ERR_MAJOR_BAD;
}
curlx_dyn_init(&dbuf, 32 * 1024);
for(i = 0; i < CURL_ARRAYSIZE(test_specs); ++i) {
if(!do_test(&test_specs[i], i, &dbuf))
all_ok = FALSE;

View file

@ -94,13 +94,13 @@ static CURLcode test_unit1657(const char *arg)
bool all_ok = TRUE;
struct dynbuf dbuf;
curlx_dyn_init(&dbuf, 32 * 1024);
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
curl_mfprintf(stderr, "curl_global_init() failed\n");
return TEST_ERR_MAJOR_BAD;
}
curlx_dyn_init(&dbuf, 32 * 1024);
for(i = 0; i < CURL_ARRAYSIZE(test1657_specs); ++i) {
if(!do_test1657(&test1657_specs[i], i, &dbuf))
all_ok = FALSE;

View file

@ -168,16 +168,16 @@ static CURLcode test_unit1666(const char *arg)
struct dynbuf dbuf;
bool all_ok = TRUE;
/* the real code uses CURL_X509_STR_MAX for maximum size, but we set a
smaller one here so that we can test running into the limit a little
easier */
curlx_dyn_init(&dbuf, 100);
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
curl_mfprintf(stderr, "curl_global_init() failed\n");
return TEST_ERR_MAJOR_BAD;
}
/* the real code uses CURL_X509_STR_MAX for maximum size, but we set a
smaller one here so that we can test running into the limit a little
easier */
curlx_dyn_init(&dbuf, 100);
for(i = 0; i < CURL_ARRAYSIZE(test_specs); ++i) {
if(!test1666(&test_specs[i], i, &dbuf))
all_ok = FALSE;

View file

@ -313,6 +313,7 @@ static CURLcode test_unit1667(const char *arg)
smaller one here so that we can test running into the limit a little
easier */
curlx_dyn_init(&dbuf, 40);
for(i = 0; i < CURL_ARRAYSIZE(test_specs); ++i) {
if(!test1667(&test_specs[i], i, &dbuf))
all_ok = FALSE;