mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:31:41 +03:00
build: tidy up and dedupe strdup functions
- de-dupe lib/src strdup/memdup functions into curlx. - introduce `CURLX_STRDUP_LOW()` for mapping `strdup()`, and to do it at one place within the code, in `curl_setup.h`. - tests/server: use `curlx_strdup()`. (Also to fix building without a system `strdup()`.) - curlx/curlx.h: shorten and tidy up. - adjust Windows build path to not need `HAVE_STRDUP`. - build: stop detecting `HAVE_STRDUP` on Windows. Closes #20497
This commit is contained in:
parent
e39650c984
commit
31a4f415af
50 changed files with 171 additions and 333 deletions
|
|
@ -65,7 +65,7 @@
|
|||
#include "multiif.h"
|
||||
#include "url.h"
|
||||
#include "http_proxy.h"
|
||||
#include "strdup.h"
|
||||
#include "curlx/strdup.h"
|
||||
#include "curlx/strerr.h"
|
||||
#include "curlx/strparse.h"
|
||||
|
||||
|
|
@ -3195,7 +3195,7 @@ static CURLcode ftp_pp_statemachine(struct Curl_easy *data,
|
|||
ptr++;
|
||||
for(start = ptr; *ptr && *ptr != ' '; ptr++)
|
||||
;
|
||||
os = Curl_memdup0(start, ptr - start);
|
||||
os = curlx_memdup0(start, ptr - start);
|
||||
if(!os)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
||||
|
|
@ -3578,7 +3578,7 @@ static CURLcode ftp_done(struct Curl_easy *data, CURLcode status,
|
|||
else
|
||||
/* file is url-decoded */
|
||||
pathLen -= ftpc->file ? strlen(ftpc->file) : 0;
|
||||
ftpc->prevpath = Curl_memdup0(rawPath, pathLen);
|
||||
ftpc->prevpath = curlx_memdup0(rawPath, pathLen);
|
||||
}
|
||||
else
|
||||
ftpc->prevpath = NULL; /* no path */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue