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

@ -93,3 +93,12 @@ size_t Curl_bufref_len(const struct bufref *br);
```
Returns the stored length of the referenced buffer.
## `dup`
```c
char *Curl_bufref_dup(const struct bufref *br);
```
Returns a strdup() version of the buffer. Note that this assumes that the
bufref is null terminated.