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

@ -18,7 +18,7 @@ if(curlx_str_word(&line, &word1, MAX) ||
fprintf(stderr, "ERROR\n");
~~~
The input pointer **must** point to a null terminated buffer area or these
The input pointer **must** point to a null-terminated buffer area or these
functions risk continuing "off the edge".
## Strings

View File

@ -68,10 +68,10 @@ username/password are not exported.
## Session Key
This is a printable, 0-terminated string that starts with **hostname:port**
the session ticket is originating from and also contains all relevant
SSL parameters used in the connection. The key also carries the name
and version number of the TLS backend used.
This is a printable, null-terminated string that starts with **hostname:port**
the session ticket is originating from and also contains all relevant SSL
parameters used in the connection. The key also carries the name and version
number of the TLS backend used.
It is recommended to only persist **session_key** when it can be protected
from outside access. Since the hostname appears in plain text, it would

View File

@ -79,7 +79,7 @@ contain zero-valued bytes.
followed by a pointer to the contents of this part, the actual data to send
away. libcurl copies the provided data, so your application does not need to
keep it around after this function call. If the data is not null terminated,
keep it around after this function call. If the data is not null-terminated,
or if you would like it to contain zero bytes, you must set the length of the
name with **CURLFORM_CONTENTSLENGTH**. The copied data is freed by
curl_formfree(3).

View File

@ -71,7 +71,7 @@ does not decode the scheme, the port number or the full URL.
The query component also gets plus-to-space conversion as a bonus when this
bit is set.
Note that this URL decoding is charset unaware and you get a zero terminated
Note that this URL decoding is charset unaware and you get a null-terminated
string back with data that could be intended for a particular encoding.
If there are byte values lower than 32 in the decoded string, the get

View File

@ -58,14 +58,14 @@ This function is passed the following arguments:
## `conn_primary_ip`
A null-terminated pointer to a C string containing the primary IP of the
A pointer to a null-terminated C string containing the primary IP of the
remote server established with this connection. For FTP, this is the IP for
the control connection. IPv6 addresses are represented without surrounding
brackets.
## `conn_local_ip`
A null-terminated pointer to a C string containing the originating IP for this
A pointer to a null-terminated C string containing the originating IP for this
connection. IPv6 addresses are represented without surrounding brackets.
## `conn_primary_port`

View File

@ -2813,17 +2813,17 @@ struct curl_slist {
* *before* curl_global_init().
*
* The backend can be identified by the id (e.g. CURLSSLBACKEND_OPENSSL). The
* backend can also be specified via the name parameter (passing -1 as id).
* If both id and name are specified, the name will be ignored. If neither id
* nor name are specified, the function will fail with
* CURLSSLSET_UNKNOWN_BACKEND and set the "avail" pointer to the
* NULL-terminated list of available backends.
* backend can also be specified via the name parameter (passing -1 as id). If
* both id and name are specified, the name will be ignored. If neither id nor
* name are specified, the function will fail with CURLSSLSET_UNKNOWN_BACKEND
* and set the "avail" pointer to the NULL-terminated list of available
* backends.
*
* Upon success, the function returns CURLSSLSET_OK.
*
* If the specified SSL backend is not available, the function returns
* CURLSSLSET_UNKNOWN_BACKEND and sets the "avail" pointer to a NULL-terminated
* list of available SSL backends.
* CURLSSLSET_UNKNOWN_BACKEND and sets the "avail" pointer to a
* NULL-terminated list of available SSL backends.
*
* The SSL backend can be set only once. If it has already been set, a
* subsequent attempt to change it will result in a CURLSSLSET_TOO_LATE.

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)

View File

@ -135,7 +135,7 @@
*
d len s 10u 0
*
len = %scan(X'00': string: 1: length); // Limit to zero-terminated string
len = %scan(X'00': string: 1: length); // Limit to null-terminated string
if len = 0;
len = length + 1;
endif;

View File

@ -118,7 +118,7 @@
*
d len s 10u 0
*
len = %scan(X'00': string: 1: length); // Limit to zero-terminated string
len = %scan(X'00': string: 1: length); // Limit to null-terminated string
if len = 0;
len = length + 1;
endif;

View File

@ -148,7 +148,7 @@
*
d len s 10u 0
*
len = %scan(X'00': string: 1: length); // Limit to zero-terminated string
len = %scan(X'00': string: 1: length); // Limit to null-terminated string
if len = 0;
len = length + 1;
endif;

View File

@ -97,7 +97,7 @@
*
d len s 10u 0
*
c eval len = %scan(X'00': string: 1: length) Limit 0-terminated
c eval len = %scan(X'00': string: 1: length) Limit null-terminated
c if len = 0
c eval len = length + 1
c endif

View File

@ -97,7 +97,7 @@
dcl-s len uns(10);
len = %scan(X'00': string: 1: length); // Limit to zero-terminated string
len = %scan(X'00': string: 1: length); // Limit to null-terminated string
if len = 0;
len = length + 1;
endif;

View File

@ -228,7 +228,7 @@
d addrdiff s 10i 0
d len s 10u 0
*
len = %scan(X'00': string: 1: length); // Limit to zero-terminated string
len = %scan(X'00': string: 1: length); // Limit to null-terminated string
if len = 0;
len = length + 1;
endif;

View File

@ -131,7 +131,7 @@ static int sys_trnlnm(const char *logname,
if($VMS_STATUS_SUCCESS(status)) {
/* Null terminate and return the string */
/* Null-terminate and return the string */
/*--------------------------------------*/
value[result] = '\0';
}

View File

@ -248,7 +248,7 @@ size_t tool_header_cb(char *ptr, size_t size, size_t nmemb, void *userdata)
if(hdrcbdata->honor_cd_filename &&
hdrcbdata->config->show_headers) {
/* still awaiting the Content-Disposition header, store the header in
memory. Since it is not zero terminated, we need an extra dance. */
memory. Since it is not null-terminated, we need an extra dance. */
char *clone = aprintf("%.*s", (int)cb, str);
if(clone) {
struct curl_slist *old = hdrcbdata->headlist;
@ -440,7 +440,7 @@ void write_linked_location(CURL *curl, const char *location, size_t loclen,
if(!u)
goto locout;
/* Create a NUL-terminated and whitespace-stripped copy of Location: */
/* Create a null-terminated and whitespace-stripped copy of Location: */
copyloc = malloc(llen + 1);
if(!copyloc)
goto locout;

View File

@ -78,7 +78,7 @@ static ParameterError getstrn(char **str, const char *val,
return PARAM_NO_MEM;
memcpy(*str, val, len);
(*str)[len] = 0; /* null terminate */
(*str)[len] = 0; /* null-terminate */
return PARAM_OK;
}

View File

@ -237,10 +237,10 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
/*
* Copies the string from line to the buffer at param, unquoting
* backslash-quoted characters and NUL-terminating the output string.
* Stops at the first non-backslash-quoted double quote character or the
* end of the input string. param must be at least as long as the input
* string. Returns the pointer after the last handled input character.
* backslash-quoted characters and null-terminating the output string. Stops
* at the first non-backslash-quoted double quote character or the end of the
* input string. param must be at least as long as the input string. Returns
* the pointer after the last handled input character.
*/
static const char *unslashquote(const char *line, char *param)
{
@ -317,7 +317,7 @@ static bool get_line(FILE *input, struct dynbuf *buf, bool *error)
}
/*
* Returns a line from the given file. Every line is NULL terminated (no
* Returns a line from the given file. Every line is null-terminated (no
* newline). Skips #-commented and space/tabs-only lines automatically.
*/
bool my_get_line(FILE *input, struct dynbuf *buf, bool *error)

View File

@ -227,7 +227,7 @@ OM_uint32 gss_init_sec_context(OM_uint32 *min,
return GSS_S_FAILURE;
}
/* Overwrite null terminator */
/* Overwrite null-terminator */
memset(token + used, 'A', length - used);
*context_handle = ctx;

View File

@ -163,7 +163,7 @@ static int readline(char **buffer, size_t *bufsize, size_t *length,
*
* If the source buffer is indicated to be base64 encoded, this appends the
* decoded data, binary or whatever, to the destination. The source buffer
* may not hold binary data, only a null terminated string is valid content.
* may not hold binary data, only a null-terminated string is valid content.
*
* Destination buffer will be enlarged and relocated as needed.
*
@ -264,7 +264,7 @@ static int decodedata(char **buf, /* dest buffer */
* and the size of the data is stored at the addresses that caller specifies.
*
* If the returned data is a string the returned size will be the length of
* the string excluding null termination. Otherwise it will just be the size
* the string excluding null-termination. Otherwise it will just be the size
* of the returned binary data.
*
* Calling function is responsible to free returned buffer.