spelling: call it null-terminate consistently

With a dash, using two Ls. Also for different forms of the word.

Use NULL in all uppercase if it means a zero pointer.

Follow-up to 307b7543ea

Closes #17489
This commit is contained in:
Daniel Stenberg 2025-05-30 11:20:05 +02:00
parent 54834b4ad3
commit fe81a80ae7
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
39 changed files with 69 additions and 70 deletions

View file

@ -190,7 +190,7 @@ static CURLcode altsvc_add(struct altsvcinfo *asi, const char *line)
char dbuf[MAX_ALTSVC_DATELEN + 1];
time_t expires;
/* The date parser works on a null terminated string. The maximum length
/* The date parser works on a null-terminated string. The maximum length
is upheld by curlx_str_quotedword(). */
memcpy(dbuf, curlx_str(&date), curlx_strlen(&date));
dbuf[curlx_strlen(&date)] = 0;

View file

@ -468,7 +468,7 @@ struct Curl_addrinfo *Curl_unix2addr(const char *path, bool *longpath,
sa_un = (void *) ai->ai_addr;
sa_un->sun_family = AF_UNIX;
/* sun_path must be able to store the NUL-terminated path */
/* sun_path must be able to store the null-terminated path */
path_len = strlen(path) + 1;
if(path_len > sizeof(sa_un->sun_path)) {
free(ai);

View file

@ -61,9 +61,9 @@ static const unsigned char decodetable[] =
/*
* curlx_base64_decode()
*
* Given a base64 NUL-terminated string at src, decode it and return a
* pointer in *outptr to a newly allocated memory area holding decoded
* data. Size of decoded data is returned in variable pointed by outlen.
* Given a base64 null-terminated string at src, decode it and return a
* pointer in *outptr to a newly allocated memory area holding decoded data.
* Size of decoded data is returned in variable pointed by outlen.
*
* Returns CURLE_OK on success, otherwise specific error code. Function
* output shall not be considered valid unless CURLE_OK is returned.
@ -247,7 +247,7 @@ static CURLcode base64_encode(const char *table64,
* encoded data. Size of encoded data is returned in variable pointed by
* outlen.
*
* Input length of 0 indicates input buffer holds a NUL-terminated string.
* Input length of 0 indicates input buffer holds a null-terminated string.
*
* Returns CURLE_OK on success, otherwise specific error code. Function
* output shall not be considered valid unless CURLE_OK is returned.
@ -269,7 +269,7 @@ CURLcode curlx_base64_encode(const char *inputbuff, size_t insize,
* encoded data. Size of encoded data is returned in variable pointed by
* outlen.
*
* Input length of 0 indicates input buffer holds a NUL-terminated string.
* Input length of 0 indicates input buffer holds a null-terminated string.
*
* Returns CURLE_OK on success, otherwise specific error code. Function
* output shall not be considered valid unless CURLE_OK is returned.

View file

@ -32,7 +32,7 @@ struct dynbuf;
/**
* A single header entry.
* `name` and `value` are non-NULL and always NUL terminated.
* `name` and `value` are non-NULL and always null-terminated.
*/
struct dynhds_entry {
char *name;
@ -113,7 +113,7 @@ size_t Curl_dynhds_count_name(struct dynhds *dynhds,
const char *name, size_t namelen);
/**
* Return how often the given 0-terminated name appears in `dynhds`.
* Return how often the given null-terminated name appears in `dynhds`.
* Names are case-insensitive.
*/
size_t Curl_dynhds_ccount_name(struct dynhds *dynhds, const char *name);

View file

@ -217,7 +217,7 @@ static CURLcode namevalue(char *header, size_t hlen, unsigned int type,
/* skip all trailing space letters */
while((end > header) && ISBLANK(*end))
*end-- = 0; /* nul terminate */
*end-- = 0; /* null-terminate */
return CURLE_OK;
}
@ -323,7 +323,7 @@ CURLcode Curl_headers_push(struct Curl_easy *data, const char *header,
if(!hs)
return CURLE_OUT_OF_MEMORY;
memcpy(hs->buffer, header, hlen);
hs->buffer[hlen] = 0; /* nul terminate */
hs->buffer[hlen] = 0; /* null-terminate */
result = namevalue(hs->buffer, hlen, type, &name, &value);
if(!result) {

View file

@ -279,7 +279,7 @@ struct stsentry *Curl_hsts(struct hsts *h, const char *hostname,
blen = ntail;
}
}
/* avoid strcasecompare because the host name is not null terminated */
/* avoid strcasecompare because the host name is not null-terminated */
if((hlen == ntail) && strncasecompare(hostname, sts->host, hlen))
return sts;
}
@ -430,7 +430,7 @@ static CURLcode hsts_add(struct hsts *h, const char *line)
time_t expires;
const char *hp = curlx_str(&host);
/* The date parser works on a null terminated string. The maximum length
/* The date parser works on a null-terminated string. The maximum length
is upheld by curlx_str_quotedword(). */
memcpy(dbuf, curlx_str(&date), curlx_strlen(&date));
dbuf[curlx_strlen(&date)] = 0;

View file

@ -209,7 +209,7 @@ static CURLcode start_req(struct h1_req_parser *parser,
path = target;
path_len = target_len;
/* URL parser wants 0-termination */
/* URL parser wants null-termination */
if(target_len >= sizeof(tmp))
goto out;
memcpy(tmp, target, target_len);

View file

@ -133,7 +133,7 @@ static void trim_headers(struct curl_slist *head)
else
*store++ = *value++;
}
*store = 0; /* null terminate */
*store = 0; /* null-terminate */
}
}

View file

@ -234,7 +234,7 @@ bool Curl_check_noproxy(const char *name, const char *no_proxy)
/* if the bits variable gets a crazy value here, that is fine as
the value will then be rejected in the cidr function */
bits = (unsigned int)atoi(slash + 1);
*slash = 0; /* null terminate there */
*slash = 0; /* null-terminate there */
}
if(type == TYPE_IPV6)
match = Curl_cidr6_match(name, check, bits);

View file

@ -723,7 +723,7 @@ static CURLcode smb_send_setup(struct Curl_easy *data)
"%s%c" /* OS */
"%s", /* client name */
smbc->user, 0, smbc->domain, 0, CURL_OS, 0, CLIENTNAME);
p++; /* count the final null termination */
p++; /* count the final null-termination */
DEBUGASSERT(byte_count == (size_t)(p - msg.bytes));
msg.byte_count = smb_swap16((unsigned short)byte_count);
@ -754,7 +754,7 @@ static CURLcode smb_send_tree_connect(struct Curl_easy *data,
"%s%c" /* share */
"%s", /* service */
conn->host.name, smbc->share, 0, SERVICENAME);
p++; /* count the final null termination */
p++; /* count the final null-termination */
DEBUGASSERT(byte_count == (size_t)(p - msg.bytes));
msg.byte_count = smb_swap16((unsigned short)byte_count);

View file

@ -394,7 +394,7 @@ CONNECT_REQ_INIT:
/*
* This is currently not supporting "Identification Protocol (RFC1413)".
*/
socksreq[8] = 0; /* ensure empty userid is NUL-terminated */
socksreq[8] = 0; /* ensure empty userid is null-terminated */
if(sx->proxy_user) {
size_t plen = strlen(sx->proxy_user);
if(plen > 255) {

View file

@ -85,7 +85,7 @@ char Curl_raw_tolower(char in)
/* Copy an upper case version of the string from src to dest. The
* strings may overlap. No more than n characters of the string are copied
* (including any NUL) and the destination string will NOT be
* NUL-terminated if that limit is reached.
* null-terminated if that limit is reached.
*/
void Curl_strntoupper(char *dest, const char *src, size_t n)
{
@ -100,7 +100,7 @@ void Curl_strntoupper(char *dest, const char *src, size_t n)
/* Copy a lower case version of the string from src to dest. The
* strings may overlap. No more than n characters of the string are copied
* (including any NUL) and the destination string will NOT be
* NUL-terminated if that limit is reached.
* null-terminated if that limit is reached.
*/
void Curl_strntolower(char *dest, const char *src, size_t n)
{
@ -112,7 +112,7 @@ void Curl_strntolower(char *dest, const char *src, size_t n)
} while(*src++ && --n);
}
/* Compare case-sensitive NUL-terminated strings, taking care of possible
/* Compare case-sensitive null-terminated strings, taking care of possible
* null pointers. Return true if arguments match.
*/
bool Curl_safecmp(char *a, char *b)

View file

@ -104,7 +104,7 @@ void *Curl_memdup(const void *src, size_t length)
* Curl_memdup0(source, length)
*
* Copies the 'source' string to a newly allocated buffer (that is returned).
* Copies 'length' bytes then adds a null terminator.
* Copies 'length' bytes then adds a null-terminator.
*
* Returns the new pointer or NULL on failure.
*

View file

@ -214,7 +214,7 @@ HMODULE Curl_load_library(LPCTSTR filename)
/* Attempt to get the Windows system path */
UINT systemdirlen = GetSystemDirectory(NULL, 0);
if(systemdirlen) {
/* Allocate space for the full DLL path (Room for the null terminator
/* Allocate space for the full DLL path (Room for the null-terminator
is included in systemdirlen) */
size_t filenamelen = _tcslen(filename);
TCHAR *path = malloc(sizeof(TCHAR) * (systemdirlen + 1 + filenamelen));

View file

@ -59,7 +59,7 @@ bool Curl_xfer_write_is_paused(struct Curl_easy *data);
/**
* Write a single "header" line from a server response.
* @param hd0 the 0-terminated, single header line
* @param hd0 the null-terminated, single header line
* @param hdlen the length of the header line
* @param is_eos TRUE iff this is the end of the response
*/

View file

@ -165,7 +165,7 @@ static char *auth_digest_string_quoted(const char *source)
{
char *dest;
const char *s = source;
size_t n = 1; /* null terminator */
size_t n = 1; /* null-terminator */
/* Calculate size needed */
while(*s) {

View file

@ -2007,7 +2007,7 @@ static CURLcode ssh_state_sftp_realpath(struct Curl_easy *data,
return CURLE_AGAIN;
if(rc > 0) {
/* It seems that this string is not always NULL terminated */
/* It seems that this string is not always null-terminated */
sshp->readdir_filename[rc] = '\0';
free(sshc->homedir);
sshc->homedir = strdup(sshp->readdir_filename);

View file

@ -331,7 +331,7 @@ static CURLcode add_certs_file_to_store(HCERTSTORE trust_store,
}
}
/* Null terminate the buffer */
/* null-terminate the buffer */
ca_file_buffer[ca_file_bufsize] = '\0';
result = add_certs_data_to_store(trust_store,

View file

@ -768,8 +768,8 @@ CURLcode Curl_pin_peer_pubkey(struct Curl_easy *data,
do {
end_pos = strstr(begin_pos, ";sha256//");
/*
* if there is an end_pos, null terminate,
* otherwise it will go to the end of the original string
* if there is an end_pos, null-terminate, otherwise it will go to the
* end of the original string
*/
if(end_pos)
end_pos[0] = '\0';
@ -845,8 +845,8 @@ CURLcode Curl_pin_peer_pubkey(struct Curl_easy *data,
}
/*
* Otherwise we will assume it is PEM and try to decode it
* after placing null terminator
* Otherwise we will assume it is PEM and try to decode it after placing
* null-terminator
*/
pem_read = pubkey_pem_to_der(curlx_dyn_ptr(&buf), &pem_ptr, &pem_len);
/* if it was not read successfully, exit */

View file

@ -598,9 +598,8 @@ CURLcode Curl_ssl_peer_key_make(struct Curl_cfilter *cf,
goto out;
*ppeer_key = curlx_dyn_take(&buf, &key_len);
/* we just added printable char, and dynbuf always 0 terminates,
* no need to track length */
/* we just added printable char, and dynbuf always null-terminates, no need
* to track length */
out:
curlx_dyn_free(&buf);

View file

@ -256,7 +256,7 @@ static const char *getASN1Element(struct Curl_asn1Element *elem,
#ifdef WANT_EXTRACT_CERTINFO
/*
* Search the null terminated OID or OID identifier in local table.
* Search the null-terminated OID or OID identifier in local table.
* Return the table entry pointer or NULL if not found.
*/
static const struct Curl_OID *searchOID(const char *oid)