bufref: add Curl_bufref_dup that returns a strdup()ed version

Cleans up a common pattern somewhat. Implemented as a macro.

Closes #19834
This commit is contained in:
Daniel Stenberg 2025-12-04 16:39:22 +01:00
parent d7928029fc
commit d517efe5bd
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
6 changed files with 20 additions and 8 deletions

View file

@ -45,4 +45,7 @@ size_t Curl_bufref_len(const struct bufref *br);
CURLcode Curl_bufref_memdup0(struct bufref *br, const void *ptr, size_t len);
void Curl_bufref_free(struct bufref *br);
/* return a strdup() version of the buffer */
#define Curl_bufref_dup(x) curlx_strdup(Curl_bufref_ptr(x))
#endif