aboutsummaryrefslogtreecommitdiff
path: root/include/str.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/str.h')
-rw-r--r--include/str.h14
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);