diff options
Diffstat (limited to 'dynstr.h')
-rw-r--r-- | dynstr.h | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -136,6 +136,12 @@ int dynstr_byte_at(Dynstr *dynstr, size_t offset); * actually copied, which may be less than requested, and may be zero. */ size_t dynstr_memcpy(void *mem, Dynstr *dynstr, size_t offset, size_t size); +/* Create a dynamically allocated C string copy of the dynamic string. + * This is like strdup. If the dynamic string contains NUL bytes, then + * that is the caller's problem. Return pointer to the C string. The + * caller is responsible for freeing it. Return NULL on error. */ +char *dynstr_strdup(Dynstr *dynstr); + /* Search for first or last byte with a given value in a string, * starting at a given offset and until the end of the string. Return offset * of matching byte, or DYNSTR_NOT_FOUND if not found. Offset is from |