mirror of
https://github.com/curl/curl.git
synced 2026-08-24 13:43:32 +03:00
unittests: cleanups
- make sure all UNITTEST prototypes mark in which unit test they are used, with "@unittest" markup - make sure all UNITTEST functions do not use Curl_ prefix, as that is a prefix we use for global private functions and these functions are static and therefore not global and the prefix is wrong - drop UNITTEST for functions not used in unit tests - make the extract-unit-protos script highlight the above issues if found - extract-unit-protos now also outputs the unit test number for all the generated protos in lib/unitprotos.h to aid readers. It also adds the source file and line number where the proto originates from. - extract-unit-protos now exits with a non-zero value if any of the above warnings are triggered - cf-dns: Curl_cf_dns_result => static cf_dns_result - hostip: Curl_ipv6works => static ipv6works - url: remove Curl_setup_conn() - not used anymore - connect: Curl_timeleft_now_ms => UNITTEST timeleft_now_ms Closes #21330
This commit is contained in:
parent
94f14c54b0
commit
7fd35f4c34
36 changed files with 248 additions and 216 deletions
28
lib/urlapi.c
28
lib/urlapi.c
|
|
@ -118,7 +118,7 @@ static const char *find_host_sep(const char *url)
|
|||
* 'query' tells if it is a query part or not, or if it is allowed to
|
||||
* "transition" into a query part with a question mark.
|
||||
*
|
||||
* @unittest: 1675
|
||||
* @unittest 1675
|
||||
*/
|
||||
UNITTEST CURLUcode urlencode_str(struct dynbuf *o, const char *url,
|
||||
size_t len, bool relative,
|
||||
|
|
@ -341,10 +341,11 @@ out:
|
|||
return ures;
|
||||
}
|
||||
|
||||
UNITTEST CURLUcode Curl_parse_port(struct Curl_URL *u, struct dynbuf *host,
|
||||
bool has_scheme);
|
||||
UNITTEST CURLUcode Curl_parse_port(struct Curl_URL *u, struct dynbuf *host,
|
||||
bool has_scheme)
|
||||
/* @unittest 1653 */
|
||||
UNITTEST CURLUcode parse_port(struct Curl_URL *u, struct dynbuf *host,
|
||||
bool has_scheme);
|
||||
UNITTEST CURLUcode parse_port(struct Curl_URL *u, struct dynbuf *host,
|
||||
bool has_scheme)
|
||||
{
|
||||
const char *portptr;
|
||||
const char *hostname = curlx_dyn_ptr(host);
|
||||
|
|
@ -400,7 +401,7 @@ UNITTEST CURLUcode Curl_parse_port(struct Curl_URL *u, struct dynbuf *host,
|
|||
/* This function assumes 'hostname' now starts with [. It trims 'hostname' in
|
||||
* place and it sets u->zoneid if present.
|
||||
*
|
||||
* @unittest: 1675
|
||||
* @unittest 1675
|
||||
*/
|
||||
UNITTEST CURLUcode ipv6_parse(struct Curl_URL *u, char *hostname,
|
||||
size_t hlen);
|
||||
|
|
@ -458,10 +459,8 @@ UNITTEST CURLUcode ipv6_parse(struct Curl_URL *u, char *hostname,
|
|||
return CURLUE_OK;
|
||||
}
|
||||
|
||||
UNITTEST CURLUcode hostname_check(struct Curl_URL *u, char *hostname,
|
||||
size_t hlen);
|
||||
UNITTEST CURLUcode hostname_check(struct Curl_URL *u, char *hostname,
|
||||
size_t hlen) /* length of hostname */
|
||||
static CURLUcode hostname_check(struct Curl_URL *u, char *hostname,
|
||||
size_t hlen) /* length of hostname */
|
||||
{
|
||||
size_t len;
|
||||
DEBUGASSERT(hostname);
|
||||
|
|
@ -492,7 +491,7 @@ UNITTEST CURLUcode hostname_check(struct Curl_URL *u, char *hostname,
|
|||
*
|
||||
* Returns the host type.
|
||||
*
|
||||
* @unittest: 1675
|
||||
* @unittest 1675
|
||||
*/
|
||||
|
||||
UNITTEST int ipv4_normalize(struct dynbuf *host);
|
||||
|
|
@ -640,7 +639,7 @@ static CURLUcode parse_authority(struct Curl_URL *u,
|
|||
goto out;
|
||||
}
|
||||
|
||||
uc = Curl_parse_port(u, host, has_scheme);
|
||||
uc = parse_port(u, host, has_scheme);
|
||||
if(uc)
|
||||
goto out;
|
||||
|
||||
|
|
@ -716,7 +715,6 @@ static bool is_dot(const char **str, size_t *clen)
|
|||
|
||||
/*
|
||||
* dedotdotify()
|
||||
* @unittest: 1395
|
||||
*
|
||||
* This function gets a null-terminated path with dot and dotdot sequences
|
||||
* passed in and strips them off according to the rules in RFC 3986 section
|
||||
|
|
@ -727,6 +725,8 @@ static bool is_dot(const char **str, size_t *clen)
|
|||
* RETURNS
|
||||
*
|
||||
* Zero for success and 'out' set to an allocated dedotdotified string.
|
||||
*
|
||||
* @unittest 1395
|
||||
*/
|
||||
UNITTEST int dedotdotify(const char *input, size_t clen, char **outp);
|
||||
UNITTEST int dedotdotify(const char *input, size_t clen, char **outp)
|
||||
|
|
@ -835,7 +835,7 @@ end:
|
|||
}
|
||||
|
||||
/*
|
||||
* @unittest: 1675
|
||||
* @unittest 1675
|
||||
*/
|
||||
UNITTEST CURLUcode parse_file(const char *url, size_t urllen, CURLU *u,
|
||||
const char **pathp, size_t *pathlenp);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue