summaryrefslogtreecommitdiff
path: root/dynstr.h
diff options
context:
space:
mode:
Diffstat (limited to 'dynstr.h')
-rw-r--r--dynstr.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/dynstr.h b/dynstr.h
index 5a6f7ad..5ae1bc9 100644
--- a/dynstr.h
+++ b/dynstr.h
@@ -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