tidy-up: rename Curl_safefree()/tool_safefree() to curlx_safefree()

To sync names for the same macro logic between lib and src, and to move
it to the curlx namespace, to match `curlx_free()` that it's calling.

Closes #21151
This commit is contained in:
Viktor Szakats 2026-03-30 01:54:10 +02:00
parent 2b3dfb4ad4
commit 0df6c01db3
No known key found for this signature in database
72 changed files with 494 additions and 500 deletions

View file

@ -39,7 +39,7 @@ static CURLcode test_lib558(const char *URL)
}
ptr = curlx_malloc(558);
Curl_safefree(ptr);
curlx_safefree(ptr);
asize = (int)sizeof(a);
ptr = curl_easy_escape(NULL, (char *)a, asize);

View file

@ -24,7 +24,7 @@
#include "unitcheck.h"
#include "urldata.h"
#include "url.h" /* for Curl_safefree */
#include "url.h" /* for curlx_safefree */
struct etest {
const char *input;
@ -140,7 +140,7 @@ static CURLcode test_unit1302(const char *arg)
curl_mfprintf(stderr, "Test %u encoded badly\n", i);
unitfail++;
}
Curl_safefree(out);
curlx_safefree(out);
/* then verify decode */
result = curlx_base64_decode(e->output, &decoded, &dlen);
@ -160,7 +160,7 @@ static CURLcode test_unit1302(const char *arg)
unitfail++;
}
Curl_safefree(decoded);
curlx_safefree(decoded);
}
for(i = 0; i < CURL_ARRAYSIZE(url); i++) {
@ -179,7 +179,7 @@ static CURLcode test_unit1302(const char *arg)
"expected '%s'\n", i, out, e->output);
unitfail++;
}
Curl_safefree(out);
curlx_safefree(out);
}
for(i = 0; i < CURL_ARRAYSIZE(badecode); i++) {

View file

@ -29,8 +29,8 @@
static void t1304_stop(char **password, char **login)
{
Curl_safefree(*password);
Curl_safefree(*login);
curlx_safefree(*password);
curlx_safefree(*login);
}
static CURLcode test_unit1304(const char *arg)

View file

@ -28,7 +28,7 @@ static CURLcode test_unit1330(const char *arg)
UNITTEST_BEGIN_SIMPLE
char *ptr = curlx_malloc(1330);
Curl_safefree(ptr);
curlx_safefree(ptr);
UNITTEST_END_SIMPLE
}

View file

@ -59,7 +59,7 @@ static CURLcode test_unit1653(const char *arg)
fail_unless(ret == CURLUE_OK, "parse_port returned error");
ret = curl_url_get(u, CURLUPART_PORT, &portnum, CURLU_NO_DEFAULT_PORT);
fail_unless(ret != CURLUE_OK, "curl_url_get portnum returned something");
Curl_safefree(ipv6port);
curlx_safefree(ipv6port);
curl_url_cleanup(u);
/* Invalid IPv6 */
@ -71,7 +71,7 @@ static CURLcode test_unit1653(const char *arg)
goto fail;
ret = parse_port(u, ipv6port, FALSE);
fail_unless(ret != CURLUE_OK, "parse_port true on error");
Curl_safefree(ipv6port);
curlx_safefree(ipv6port);
curl_url_cleanup(u);
u = curl_url();
@ -87,7 +87,7 @@ static CURLcode test_unit1653(const char *arg)
fail_unless(portnum && !strcmp(portnum, "808"), "Check portnumber");
curl_free(portnum);
Curl_safefree(ipv6port);
curlx_safefree(ipv6port);
curl_url_cleanup(u);
/* Valid IPv6 with zone index and port number */
@ -103,7 +103,7 @@ static CURLcode test_unit1653(const char *arg)
fail_unless(ret == CURLUE_OK, "curl_url_get portnum returned error");
fail_unless(portnum && !strcmp(portnum, "80"), "Check portnumber");
curl_free(portnum);
Curl_safefree(ipv6port);
curlx_safefree(ipv6port);
curl_url_cleanup(u);
/* Valid IPv6 with zone index without port number */
@ -115,7 +115,7 @@ static CURLcode test_unit1653(const char *arg)
goto fail;
ret = parse_port(u, ipv6port, FALSE);
fail_unless(ret == CURLUE_OK, "parse_port returned error");
Curl_safefree(ipv6port);
curlx_safefree(ipv6port);
curl_url_cleanup(u);
/* Valid IPv6 with port number */
@ -131,7 +131,7 @@ static CURLcode test_unit1653(const char *arg)
fail_unless(ret == CURLUE_OK, "curl_url_get portnum returned error");
fail_unless(portnum && !strcmp(portnum, "81"), "Check portnumber");
curl_free(portnum);
Curl_safefree(ipv6port);
curlx_safefree(ipv6port);
curl_url_cleanup(u);
/* Valid IPv6 with syntax error in the port number */
@ -143,7 +143,7 @@ static CURLcode test_unit1653(const char *arg)
goto fail;
ret = parse_port(u, ipv6port, FALSE);
fail_unless(ret != CURLUE_OK, "parse_port true on error");
Curl_safefree(ipv6port);
curlx_safefree(ipv6port);
curl_url_cleanup(u);
u = curl_url();
@ -154,7 +154,7 @@ static CURLcode test_unit1653(const char *arg)
goto fail;
ret = parse_port(u, ipv6port, FALSE);
fail_unless(ret != CURLUE_OK, "parse_port true on error");
Curl_safefree(ipv6port);
curlx_safefree(ipv6port);
curl_url_cleanup(u);
/* Valid IPv6 with no port after the colon, should use default if a scheme
@ -167,7 +167,7 @@ static CURLcode test_unit1653(const char *arg)
goto fail;
ret = parse_port(u, ipv6port, TRUE);
fail_unless(ret == CURLUE_OK, "parse_port returned error");
Curl_safefree(ipv6port);
curlx_safefree(ipv6port);
curl_url_cleanup(u);
/* Incorrect zone index syntax, but the port extractor does not care */
@ -183,7 +183,7 @@ static CURLcode test_unit1653(const char *arg)
fail_unless(ret == CURLUE_OK, "curl_url_get portnum returned error");
fail_unless(portnum && !strcmp(portnum, "180"), "Check portnumber");
curl_free(portnum);
Curl_safefree(ipv6port);
curlx_safefree(ipv6port);
curl_url_cleanup(u);
/* Non percent-encoded zone index */
@ -195,7 +195,7 @@ static CURLcode test_unit1653(const char *arg)
goto fail;
ret = parse_port(u, ipv6port, FALSE);
fail_unless(ret == CURLUE_OK, "parse_port returned error");
Curl_safefree(ipv6port);
curlx_safefree(ipv6port);
curl_url_cleanup(u);
/* No scheme and no digits following the colon - not accepted. Because that