tidy-up: miscellaneous

- avoid "will" in builds scripts, scripts folder, curl_easy_ssls_export.md,
  and few other files.
- badwords: add "initialise", "nul terminated", "thread safety" and
  variations.
- prefer "null-terminat", where missing (two places).
- fix "null-terminat*" missing dash.
- hostip: merge two `#if` blocks.
- tool_doswin: fix comment
  Spotted by GitHub Code Quality
  Follow-up to 9a2663322c #17572
- fix stray spaces and newlines.

Closes #21638
This commit is contained in:
Viktor Szakats 2026-05-14 20:37:42 +02:00
parent 47f411c6d8
commit 614b94eecc
No known key found for this signature in database
64 changed files with 203 additions and 213 deletions

View file

@ -113,11 +113,11 @@ static struct altsvc *altsvc_createid(const char *srchost,
return NULL;
as->src.host = (char *)as + sizeof(struct altsvc);
memcpy(as->src.host, srchost, hlen);
/* the null terminator is already there */
/* the null-terminator is already there */
as->dst.host = (char *)as + sizeof(struct altsvc) + hlen + 1;
memcpy(as->dst.host, dsthost, dlen);
/* the null terminator is already there */
/* the null-terminator is already there */
as->src.alpnid = srcalpnid;
as->dst.alpnid = dstalpnid;

View file

@ -38,7 +38,6 @@
/* Use the system keyring as the default CA bundle. */
#define CURL_CA_BUNDLE "/QIBM/UserData/ICSS/Cert/Server/DEFAULT.KDB"
/* Definition to make a library symbol externally visible. */
#define CURL_EXTERN_SYMBOL

View file

@ -63,7 +63,7 @@ CURLcode Curl_creds_create(const char *user,
goto out;
}
/* NUL terminator for user already part of struct */
/* null-terminator for user already part of struct */
creds = curlx_calloc(1, sizeof(*creds) +
ulen + plen + 1 + olen + 1 + salen + 1 + sslen + 1);
if(!creds) {
@ -187,5 +187,4 @@ void Curl_creds_trace(struct Curl_easy *data, struct Curl_creds *creds,
else
CURL_TRC_M(data, "%s: -", msg);
}
#endif

View file

@ -69,17 +69,16 @@ bool Curl_creds_same(struct Curl_creds *c1, struct Curl_creds *c2);
bool Curl_creds_same_user(struct Curl_creds *creds, const char *user);
bool Curl_creds_same_passwd(struct Curl_creds *creds, const char *passwd);
/* Provides properties for creds or, if creds is NULL, the empty string */
#define Curl_creds_has_user(c) ((c) && (c)->user[0])
#define Curl_creds_has_passwd(c) ((c) && (c)->passwd[0])
#define Curl_creds_has_oauth_bearer(c) ((c) && (c)->oauth_bearer[0])
#define Curl_creds_has_sasl_service(c) ((c) && (c)->sasl_service[0])
#define Curl_creds_user(c) ((c)? (c)->user : "")
#define Curl_creds_passwd(c) ((c)? (c)->passwd : "")
#define Curl_creds_oauth_bearer(c) ((c)? (c)->oauth_bearer : "")
#define Curl_creds_sasl_authzid(c) ((c)? (c)->sasl_authzid : "")
#define Curl_creds_sasl_service(c) ((c)? (c)->sasl_service : "")
#define Curl_creds_user(c) ((c) ? (c)->user : "")
#define Curl_creds_passwd(c) ((c) ? (c)->passwd : "")
#define Curl_creds_oauth_bearer(c) ((c) ? (c)->oauth_bearer : "")
#define Curl_creds_sasl_authzid(c) ((c) ? (c)->sasl_authzid : "")
#define Curl_creds_sasl_service(c) ((c) ? (c)->sasl_service : "")
#ifdef CURLVERBOSE
void Curl_creds_trace(struct Curl_easy *data, struct Curl_creds *creds,

View file

@ -30,10 +30,10 @@
*
* Provide the target buffer @dest and size of the target buffer @dsize, If
* the source string @src with its *string length* @slen fits in the target
* buffer it is copied there - including storing a null terminator.
* buffer it is copied there - including storing a null-terminator.
*
* If the target buffer is too small, the copy is not performed but if the
* target buffer has a non-zero size it gets a null terminator stored.
* target buffer has a non-zero size it gets a null-terminator stored.
*/
void curlx_strcopy(char *dest, /* destination buffer */
size_t dsize, /* size of target buffer */

View file

@ -167,7 +167,6 @@ void Curl_doh_cleanup(struct Curl_easy *data,
struct Curl_resolv_async *async);
#define Curl_doh_wanted(d) (!!(d)->set.doh)
#else /* CURL_DISABLE_DOH */
#define Curl_doh(a, b) NULL
#define Curl_doh_take_result(x, y, z) CURLE_COULDNT_RESOLVE_HOST

View file

@ -507,7 +507,6 @@ const struct Curl_addrinfo *Curl_resolv_get_ai(struct Curl_easy *data,
return Curl_async_get_ai(data, async, ai_family, index);
}
#ifdef USE_HTTPSRR
const struct Curl_https_rrinfo *
Curl_resolv_get_https(struct Curl_easy *data, uint32_t resolv_id)
@ -525,7 +524,6 @@ bool Curl_resolv_knows_https(struct Curl_easy *data, uint32_t resolv_id)
return TRUE;
return Curl_async_knows_https(data, async);
}
#endif /* USE_HTTPSRR */
#endif /* USE_CURL_ASYNC */
@ -791,9 +789,6 @@ CURL_NORETURN static void alarmfunc(int sig)
(void)sig;
siglongjmp(curl_jmpenv, 1);
}
#endif /* USE_ALARM_TIMEOUT */
#ifdef USE_ALARM_TIMEOUT
static CURLcode resolv_alarm_timeout(struct Curl_easy *data,
uint8_t dns_queries,

View file

@ -121,7 +121,7 @@ static CURLcode hsts_create(struct hsts *h,
struct stsentry *sts = curlx_calloc(1, sizeof(struct stsentry) + hlen);
if(!sts)
return CURLE_OUT_OF_MEMORY;
/* the null terminator is already there */
/* the null-terminator is already there */
memcpy(sts->host, hostname, hlen);
sts->expires = expires;
sts->includeSubDomains = subdomains;
@ -445,7 +445,7 @@ static CURLcode hsts_add_host_expire(struct hsts *h,
e = hsts_check(h, host, hostlen, subdomain);
if(!e)
result = hsts_create(h, host, hostlen, subdomain, expires);
/* 'host' is not necessarily null terminated */
/* 'host' is not necessarily null-terminated */
else if((hostlen == strlen(e->host) &&
curl_strnequal(host, e->host, hostlen))) {
/* the same hostname, use the largest expire time and keep the strictest
@ -509,7 +509,7 @@ static CURLcode hsts_pull(struct Curl_easy *data, struct hsts *h)
const char *date = e.expire;
if(!e.name[0] || e.expire[MAX_HSTS_DATELEN] ||
e.name[MAX_HSTS_HOSTLEN])
/* bail out if no name was stored or if a null terminator is gone */
/* bail out if no name was stored or if a null-terminator is gone */
return CURLE_BAD_FUNCTION_ARGUMENT;
if(!date[0])
date = UNLIMITED;

View file

@ -423,7 +423,6 @@ static bool parse_conversion(const char f, unsigned int *flagp,
return FALSE;
}
static int parsefmt(const char *format,
struct outsegment *out,
struct va_input *in,
@ -968,7 +967,6 @@ static bool out_pointer(void *userp,
*
* All output is sent to the 'stream()' callback, one byte at a time.
*/
static int formatf(void *userp, /* untouched by format(), sent to the
stream() function in the second argument */
/* function pointer called for each output character */

View file

@ -78,8 +78,8 @@
/* On a debug build, we want to fail hard on multi handles that
* are not NULL, but no longer have the MAGIC touch. This gives
* us early warning on things only discovered by valgrind otherwise. */
#define GOOD_MULTI_HANDLE(x) \
(((x) && (x)->magic == CURL_MULTI_HANDLE)? TRUE: \
#define GOOD_MULTI_HANDLE(x) \
(((x) && (x)->magic == CURL_MULTI_HANDLE) ? TRUE : \
(DEBUGASSERT(!(x)), FALSE))
#else
#define GOOD_MULTI_HANDLE(x) \

View file

@ -117,7 +117,7 @@ static CURLcode peer_create(struct peer_parse *pp,
}
zone_alen = pp->zoneid.len ? (pp->zoneid.len + 1) : 0;
/* NUL terminator already part of struct */
/* null-terminator already part of struct */
peer = curlx_calloc(1, sizeof(*peer) +
pp->host_user.len + host_alen + zone_alen);
if(!peer) {

View file

@ -94,7 +94,6 @@ static const char * const cf_socks_statename[] = {
#define SOCKS_CHUNK_SIZE 1024
#define SOCKS_CHUNKS 1
struct socks_ctx {
enum socks_state_t state;
struct bufq iobuf;

View file

@ -1972,7 +1972,6 @@ nomem:
return CURLUE_OUT_OF_MEMORY;
}
}
else if(what == CURLUPART_HOST) {
size_t n = curlx_dyn_len(&enc);
if(!n && (flags & CURLU_NO_AUTHORITY)) {