diff options
| author | dacctal <donotcontactmevia@email.invalid> | 2026-07-21 21:32:27 +0000 |
|---|---|---|
| committer | dacctal <donotcontactmevia@email.invalid> | 2026-07-21 21:32:27 +0000 |
| commit | 184bd50e2ea12b4bf40f4ae1b0d685f0bfa1c995 (patch) | |
| tree | bfe4f0a8fb39def302bdc807308c30b60dd18a92 /include/str.h | |
| parent | c251d37c98efba534766e914f7392cc7a0470351 (diff) | |
started 2.0 refactor. Co-authored-by: ezntek <eason@ezntek.com>
Diffstat (limited to 'include/str.h')
| -rw-r--r-- | include/str.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/include/str.h b/include/str.h index 3a4aefb..0e8ae59 100644 --- a/include/str.h +++ b/include/str.h @@ -74,6 +74,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 */ str mstr(const char *s); @@ -182,6 +188,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. */ char str_pop_last(str *src); @@ -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); |
