mirror of
https://github.com/curl/curl.git
synced 2026-07-29 01:43:06 +03:00
lib: rename Curl_strndup to Curl_memdup0 to avoid misunderstanding
Since the copy does not stop at a null byte, let's not call it anything that makes you think it works like the common strndup() function. Based on feedback from Jay Satiro, Stefan Eissing and Patrick Monnerat Closes #12490
This commit is contained in:
parent
6d8dc2f636
commit
7c992dd9f8
15 changed files with 27 additions and 27 deletions
|
|
@ -329,7 +329,7 @@ char *Curl_copy_header_value(const char *header)
|
|||
/* get length of the type */
|
||||
len = end - start + 1;
|
||||
|
||||
return Curl_strndup(start, len);
|
||||
return Curl_memdup0(start, len);
|
||||
}
|
||||
|
||||
#ifndef CURL_DISABLE_HTTP_AUTH
|
||||
|
|
@ -4617,17 +4617,17 @@ CURLcode Curl_http_req_make(struct httpreq **preq,
|
|||
goto out;
|
||||
memcpy(req->method, method, m_len);
|
||||
if(scheme) {
|
||||
req->scheme = Curl_strndup(scheme, s_len);
|
||||
req->scheme = Curl_memdup0(scheme, s_len);
|
||||
if(!req->scheme)
|
||||
goto out;
|
||||
}
|
||||
if(authority) {
|
||||
req->authority = Curl_strndup(authority, a_len);
|
||||
req->authority = Curl_memdup0(authority, a_len);
|
||||
if(!req->authority)
|
||||
goto out;
|
||||
}
|
||||
if(path) {
|
||||
req->path = Curl_strndup(path, p_len);
|
||||
req->path = Curl_memdup0(path, p_len);
|
||||
if(!req->path)
|
||||
goto out;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue