From 0e52b558cbe7cd3ac54bf3aba88c5679c43d6e39 Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Tue, 15 Jun 2021 09:51:49 +0200 Subject: Fixed c_strnstrn() and cstr_find_n() bugs. when find string is empty. Added cstr_from_replace_all() and cstr_replace_all_v() to do replace-all from csview inputs. --- docs/cstr_api.md | 4 ++-- docs/csview_api.md | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/cstr_api.md b/docs/cstr_api.md index 8dec7f2f..cdb73a69 100644 --- a/docs/cstr_api.md +++ b/docs/cstr_api.md @@ -96,8 +96,8 @@ int c_rawstr_compare(const char** x, const char** y); bool c_rawstr_equals(const char** x, const char** y); uint64_t c_rawstr_hash(const char* const* x, size_t ignored); int c_strncasecmp(const char* str1, const char* str2, size_t n); -char* c_strnstrn(const char* str, const char* needle, size_t slen, size_t nmax); -char* c_strncasestrn(const char* str, const char* needle, size_t slen, size_t nmax); +char* c_strnstrn(const char* str, const char* needle, size_t slen, size_t nlen); +char* c_strncasestrn(const char* str, const char* needle, size_t slen, size_t nlen); ``` ## Types diff --git a/docs/csview_api.md b/docs/csview_api.md index ba2697bd..bd4945c0 100644 --- a/docs/csview_api.md +++ b/docs/csview_api.md @@ -58,6 +58,7 @@ void csview_next(csview_iter_t* it); #### Extended cstr methods ```c cstr cstr_from_v(csview sv); // construct cstr from csview +cstr cstr_from_replace_all(csview sv, csview find, csview replace); csview cstr_sv(cstr s); // convert to csview from cstr csview cstr_to_v(const cstr* self); // convert to csview from cstr* @@ -68,6 +69,7 @@ cstr* cstr_assign_v(cstr* self, csview sv); cstr* cstr_append_v(cstr* self, csview sv); void cstr_insert_v(cstr* self, size_t pos, csview sv); void cstr_replace_v(cstr* self, size_t pos, size_t len, csview sv); +void cstr_replace_all_v(cstr* self, csview find, csview replace); bool cstr_equals_v(cstr s, csview sv); size_t cstr_find_v(cstr s, csview needle); -- cgit v1.2.3