From eda5a6418d0dda97261e340998f8f7e23a8e57b2 Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Fri, 13 May 2022 13:42:20 +0200 Subject: Added cstr_assign_s(), and changed return type to char* for cstr_assign*() and cstr_append*(), i.e. the pointer to the (possible new) string buffer. --- docs/cstr_api.md | 13 +++++++------ docs/csview_api.md | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'docs') diff --git a/docs/cstr_api.md b/docs/cstr_api.md index 54178d29..e5a3ce37 100644 --- a/docs/cstr_api.md +++ b/docs/cstr_api.md @@ -45,14 +45,15 @@ void cstr_shrink_to_fit(cstr* self); char* cstr_expand_uninit(cstr* self, size_t n); // return ptr to uninit data void cstr_clear(cstr* self); -cstr* cstr_assign(cstr* self, const char* str); -cstr* cstr_assign_n(cstr* self, const char* str, size_t n); // assign n first chars of str -cstr* cstr_copy(cstr* self, cstr s); // cstr_take(self, cstr_clone(s)) +char* cstr_assign(cstr* self, const char* str); +char* cstr_assign_s(cstr* self, cstr s); +char* cstr_assign_n(cstr* self, const char* str, size_t n); // assign n first chars of str +void cstr_copy(cstr* self, cstr s); // like cstr_assign_s() int cstr_printf(cstr* self, const char* fmt, ...); // printf() formatting -cstr* cstr_append(cstr* self, const char* str); -cstr* cstr_append_s(cstr* self, cstr s); -cstr* cstr_append_n(cstr* self, const char* str, size_t n); +char* cstr_append(cstr* self, const char* str); +char* cstr_append_s(cstr* self, cstr s); +char* cstr_append_n(cstr* self, const char* str, size_t n); void cstr_insert(cstr* self, size_t pos, const char* str); void cstr_insert_s(cstr* self, size_t pos, cstr s); diff --git a/docs/csview_api.md b/docs/csview_api.md index b4319c85..0a071278 100644 --- a/docs/csview_api.md +++ b/docs/csview_api.md @@ -82,8 +82,8 @@ cstr cstr_from_replace_all_sv(csview sv, csview find, csview replace) csview cstr_substr(const cstr* s, intptr_t pos, size_t n); // negative pos count from end csview cstr_slice(const cstr* s, intptr_t p, intptr_t q); // negative p or q count from end -cstr* cstr_assign_sv(cstr* self, csview sv); -cstr* cstr_append_sv(cstr* self, csview sv); +csview cstr_assign_sv(cstr* self, csview sv); // return csview of assigned cstr +void cstr_append_sv(cstr* self, csview sv); void cstr_insert_sv(cstr* self, size_t pos, csview sv); void cstr_replace_sv(cstr* self, size_t pos, size_t len, csview sv); -- cgit v1.2.3