From fea47e9b0b1f1137944a446d0d7e4b413f7bc2dd Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Mon, 8 Aug 2022 16:13:05 +0200 Subject: Changed *cstr_tolower*/*cstr_toupper* arg from `const cstr*` to `csview`. --- include/stc/cstr.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'include/stc') diff --git a/include/stc/cstr.h b/include/stc/cstr.h index 68f35674..d7e5dcd4 100644 --- a/include/stc/cstr.h +++ b/include/stc/cstr.h @@ -172,12 +172,15 @@ STC_INLINE size_t cstr_capacity(cstr s) // utf8 methods defined in/depending on src/utf8code.c: -extern cstr cstr_tofold(const cstr* self); -extern cstr cstr_tolower(const cstr* self); -extern cstr cstr_toupper(const cstr* self); -extern void cstr_casefold(cstr* self); -extern void cstr_lowercase(cstr* self); -extern void cstr_uppercase(cstr* self); +extern cstr cstr_casefold_sv(csview sv); +extern cstr cstr_tolower_sv(csview sv); +extern cstr cstr_toupper_sv(csview sv); + +STC_INLINE void cstr_lowercase(cstr* self) + { cstr_take(self, cstr_tolower_sv(cstr_sv(self))); } + +STC_INLINE void cstr_uppercase(cstr* self) + { cstr_take(self, cstr_toupper_sv(cstr_sv(self))); } STC_INLINE bool cstr_valid_utf8(const cstr* self) { return utf8_valid(cstr_str(self)); } -- cgit v1.2.3