mirror of
https://github.com/curl/curl.git
synced 2026-08-25 15:03:32 +03:00
terminology: call them null-terminated strings
Updated terminology in docs, comments and phrases to refer to C strings as "null-terminated". Done to unify with how most other C oriented docs refer of them and what users in general seem to prefer (based on a single highly unscientific poll on twitter). Reported-by: coinhubs on github Fixes #5598 Closes #5608
This commit is contained in:
parent
ff43fb6dec
commit
032e838b73
107 changed files with 139 additions and 139 deletions
|
|
@ -755,7 +755,7 @@ Curl_cookie_add(struct Curl_easy *data,
|
|||
co->path = malloc(pathlen + 1); /* one extra for the zero byte */
|
||||
if(co->path) {
|
||||
memcpy(co->path, path, pathlen);
|
||||
co->path[pathlen] = 0; /* zero terminate */
|
||||
co->path[pathlen] = 0; /* null-terminate */
|
||||
co->spath = sanitize_cookie_path(co->path);
|
||||
if(!co->spath)
|
||||
badcookie = TRUE; /* out of memory bad */
|
||||
|
|
|
|||
10
lib/dotdot.c
10
lib/dotdot.c
|
|
@ -5,7 +5,7 @@
|
|||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
* Curl_dedotdotify()
|
||||
* @unittest: 1395
|
||||
*
|
||||
* This function gets a zero-terminated path with dot and dotdot sequences
|
||||
* 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
|
||||
* 5.2.4.
|
||||
*
|
||||
|
|
@ -62,7 +62,7 @@ char *Curl_dedotdotify(const char *input)
|
|||
if(!out)
|
||||
return NULL; /* out of memory */
|
||||
|
||||
*out = 0; /* zero terminates, for inputs like "./" */
|
||||
*out = 0; /* null-terminates, for inputs like "./" */
|
||||
|
||||
/* get a cloned copy of the input */
|
||||
clone = strdup(input);
|
||||
|
|
@ -129,7 +129,7 @@ char *Curl_dedotdotify(const char *input)
|
|||
if(*outptr == '/')
|
||||
break;
|
||||
}
|
||||
*outptr = 0; /* zero-terminate where it stops */
|
||||
*outptr = 0; /* null-terminate where it stops */
|
||||
}
|
||||
else if(!strcmp("/..", clone)) {
|
||||
clone[2]='/';
|
||||
|
|
@ -141,7 +141,7 @@ char *Curl_dedotdotify(const char *input)
|
|||
if(*outptr == '/')
|
||||
break;
|
||||
}
|
||||
*outptr = 0; /* zero-terminate where it stops */
|
||||
*outptr = 0; /* null-terminate where it stops */
|
||||
}
|
||||
|
||||
/* D. if the input buffer consists only of "." or "..", then remove
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ CURLcode Curl_dyn_addn(struct dynbuf *s, const void *mem, size_t len)
|
|||
}
|
||||
|
||||
/*
|
||||
* Append a zero terminated string at the end.
|
||||
* Append a null-terminated string at the end.
|
||||
*/
|
||||
CURLcode Curl_dyn_add(struct dynbuf *s, const char *str)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
***************************************************************************/
|
||||
|
||||
struct dynbuf {
|
||||
char *bufr; /* point to a zero terminated allocated buffer */
|
||||
char *bufr; /* point to a null-terminated allocated buffer */
|
||||
size_t leng; /* number of bytes *EXCLUDING* the zero terminator */
|
||||
size_t allc; /* size of the current allocation */
|
||||
size_t toobig; /* size limit for the buffer */
|
||||
|
|
|
|||
|
|
@ -602,7 +602,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
|||
/* Note that there's small risk that form->name is NULL here if the
|
||||
app passed in a bad combo, so we better check for that first. */
|
||||
if(form->name) {
|
||||
/* copy name (without strdup; possibly not nul-terminated) */
|
||||
/* copy name (without strdup; possibly not null-terminated) */
|
||||
form->name = Curl_memdup(form->name, form->namelength?
|
||||
form->namelength:
|
||||
strlen(form->name) + 1);
|
||||
|
|
@ -771,7 +771,7 @@ void curl_formfree(struct curl_httppost *form)
|
|||
}
|
||||
|
||||
|
||||
/* Set mime part name, taking care of non nul-terminated name string. */
|
||||
/* Set mime part name, taking care of non null-terminated name string. */
|
||||
static CURLcode setname(curl_mimepart *part, const char *name, size_t len)
|
||||
{
|
||||
char *zname;
|
||||
|
|
|
|||
|
|
@ -2827,7 +2827,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
|
|||
store++;
|
||||
ptr++;
|
||||
}
|
||||
*store = '\0'; /* zero terminate */
|
||||
*store = '\0'; /* null-terminate */
|
||||
}
|
||||
if(entry_extracted) {
|
||||
/* If the path name does not look like an absolute path (i.e.: it
|
||||
|
|
@ -2891,7 +2891,7 @@ static CURLcode ftp_statemach_act(struct connectdata *conn)
|
|||
ptr++;
|
||||
for(store = os; *ptr && *ptr != ' ';)
|
||||
*store++ = *ptr++;
|
||||
*store = '\0'; /* zero terminate */
|
||||
*store = '\0'; /* null-terminate */
|
||||
|
||||
/* Check for special servers here. */
|
||||
|
||||
|
|
|
|||
|
|
@ -270,7 +270,7 @@ char *Curl_copy_header_value(const char *header)
|
|||
return NULL;
|
||||
|
||||
memcpy(value, start, len);
|
||||
value[len] = 0; /* zero terminate */
|
||||
value[len] = 0; /* null-terminate */
|
||||
|
||||
return value;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1419,7 +1419,7 @@ CURLcode curl_mime_data(curl_mimepart *part,
|
|||
|
||||
if(datasize)
|
||||
memcpy(part->data, data, datasize);
|
||||
part->data[datasize] = '\0'; /* Set a nul terminator as sentinel. */
|
||||
part->data[datasize] = '\0'; /* Set a null terminator as sentinel. */
|
||||
|
||||
part->readfunc = mime_mem_read;
|
||||
part->seekfunc = mime_mem_seek;
|
||||
|
|
|
|||
|
|
@ -384,10 +384,10 @@ CURLcode Curl_pp_readresp(curl_socket_t sockfd,
|
|||
|
||||
if(pp->endofresp(conn, pp->linestart_resp, perline, code)) {
|
||||
/* This is the end of the last line, copy the last line to the
|
||||
start of the buffer and zero terminate, for old times sake */
|
||||
start of the buffer and null-terminate, for old times sake */
|
||||
size_t n = ptr - pp->linestart_resp;
|
||||
memmove(buf, pp->linestart_resp, n);
|
||||
buf[n] = 0; /* zero terminate */
|
||||
buf[n] = 0; /* null-terminate */
|
||||
keepon = FALSE;
|
||||
pp->linestart_resp = ptr + 1; /* advance pointer */
|
||||
i++; /* skip this before getting out */
|
||||
|
|
|
|||
|
|
@ -795,7 +795,7 @@ const char *Curl_strerror(int err, char *buf, size_t buflen)
|
|||
|
||||
#endif /* end of not Windows */
|
||||
|
||||
buf[max] = '\0'; /* make sure the string is zero terminated */
|
||||
buf[max] = '\0'; /* make sure the string is null-terminated */
|
||||
|
||||
/* strip trailing '\r\n' or '\n'. */
|
||||
p = strrchr(buf, '\n');
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
|
|
@ -52,7 +52,7 @@ Curl_strtok_r(char *ptr, const char *sep, char **end)
|
|||
|
||||
if(**end) {
|
||||
/* the end is not a null byte */
|
||||
**end = '\0'; /* zero terminate it! */
|
||||
**end = '\0'; /* null-terminate it! */
|
||||
++*end; /* advance the last pointer to beyond the null byte */
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ static void strcpy_url(char *output, const char *url, bool relative)
|
|||
break;
|
||||
}
|
||||
}
|
||||
*optr = 0; /* zero terminate output buffer */
|
||||
*optr = 0; /* null-terminate output buffer */
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -584,7 +584,7 @@ static CURLUcode junkscan(const char *part)
|
|||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
|
||||
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
|
||||
0x7f,
|
||||
0x00 /* zero terminate */
|
||||
0x00 /* null-terminate */
|
||||
};
|
||||
size_t n = strlen(part);
|
||||
size_t nfine = strcspn(part, badbytes);
|
||||
|
|
@ -1398,7 +1398,7 @@ CURLUcode curl_url_set(CURLU *u, CURLUPart what,
|
|||
i = (const unsigned char *)part;
|
||||
for(o = enc; *i; ++o, ++i)
|
||||
*o = (*i == ' ') ? '+' : *i;
|
||||
*o = 0; /* zero terminate */
|
||||
*o = 0; /* null-terminate */
|
||||
part = strdup(enc);
|
||||
if(!part) {
|
||||
free(enc);
|
||||
|
|
@ -1422,7 +1422,7 @@ CURLUcode curl_url_set(CURLU *u, CURLUPart what,
|
|||
o += 3;
|
||||
}
|
||||
}
|
||||
*o = 0; /* zero terminate */
|
||||
*o = 0; /* null-terminate */
|
||||
newp = enc;
|
||||
if(free_part)
|
||||
free((char *)part);
|
||||
|
|
|
|||
|
|
@ -1564,7 +1564,7 @@ enum dupstring {
|
|||
STRING_DNS_LOCAL_IP4,
|
||||
STRING_DNS_LOCAL_IP6,
|
||||
|
||||
/* -- end of zero-terminated strings -- */
|
||||
/* -- end of null-terminated strings -- */
|
||||
|
||||
STRING_LASTZEROTERMINATED,
|
||||
|
||||
|
|
|
|||
|
|
@ -1636,7 +1636,7 @@ static CURLcode verifyhost(struct connectdata *conn, X509 *server_cert)
|
|||
type itself: for example for an IA5String the data will be ASCII"
|
||||
|
||||
It has been however verified that in 0.9.6 and 0.9.7, IA5String
|
||||
is always zero-terminated.
|
||||
is always null-terminated.
|
||||
*/
|
||||
if((altlen == strlen(altptr)) &&
|
||||
/* if this isn't true, there was an embedded zero in the name
|
||||
|
|
|
|||
|
|
@ -706,7 +706,7 @@ CURLcode Curl_ssl_init_certinfo(struct Curl_easy *data, int num)
|
|||
}
|
||||
|
||||
/*
|
||||
* 'value' is NOT a zero terminated string
|
||||
* 'value' is NOT a null-terminated string
|
||||
*/
|
||||
CURLcode Curl_ssl_push_certinfo_len(struct Curl_easy *data,
|
||||
int certnum,
|
||||
|
|
@ -728,10 +728,10 @@ CURLcode Curl_ssl_push_certinfo_len(struct Curl_easy *data,
|
|||
/* sprintf the label and colon */
|
||||
msnprintf(output, outlen, "%s:", label);
|
||||
|
||||
/* memcpy the value (it might not be zero terminated) */
|
||||
/* memcpy the value (it might not be null-terminated) */
|
||||
memcpy(&output[labellen + 1], value, valuelen);
|
||||
|
||||
/* zero terminate the output */
|
||||
/* null-terminate the output */
|
||||
output[labellen + 1 + valuelen] = 0;
|
||||
|
||||
nl = Curl_slist_append_nodup(ci->certinfo[certnum], output);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue