From 184bd50e2ea12b4bf40f4ae1b0d685f0bfa1c995 Mon Sep 17 00:00:00 2001 From: dacctal Date: Tue, 21 Jul 2026 21:32:27 +0000 Subject: started 2.0 refactor. Co-authored-by: ezntek --- include/str.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'include/str.h') diff --git a/include/str.h b/include/str.h index 3a4aefb..0e8ae59 100644 --- a/include/str.h +++ b/include/str.h @@ -73,6 +73,12 @@ str str_new_with_capacity(size_t cap); */ str str_from_cstr(const char *s); +/** + * Adopts an existing heap-allocated C string, reusing its buffer in the + * resultant str. + */ +str str_adopt(char *s); + /** * Equivalent to str_from_cstr */ @@ -181,6 +187,12 @@ void str_append_cstr(str *src, const char *new_cstr); */ void str_append_str_slc(str *src, const str_slc new_slc); +/** + * Appends a new formatted section of the string, with the same calling + * style as str_append into an existing string buffer. + */ +void str_append_format(str *dest, const char *format, ...); + /** * Removes the last character from src, returning it. */ @@ -444,7 +456,7 @@ str_slc str_slc_from_cstr(const char *s); /** * Equivalent to str_slc_from_cstr. */ -str_slc mstrslc(const char *s); +str_slc mslc(const char *s); str str_slc_concat(const str_slc lhs, const str_slc rhs); -- cgit v1.2.3