From 6a5ec101dc606a9bb13ef5a5ee64ab001decc666 Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Mon, 30 May 2022 17:08:09 +0200 Subject: Updated benchmarks and renamed utf8utils.c to utf8code.c --- include/stc/cstr.h | 10 +++++----- include/stc/csview.h | 2 +- include/stc/utf8.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/stc/cstr.h b/include/stc/cstr.h index 47dff3cd..c08a51c2 100644 --- a/include/stc/cstr.h +++ b/include/stc/cstr.h @@ -170,7 +170,7 @@ STC_INLINE size_t cstr_length(cstr s) STC_INLINE size_t cstr_capacity(cstr s) { return cstr_is_long(&s) ? cstr_l_cap(&s) : cstr_s_cap; } -// utf8 methods defined in/depending on src/utf8utils.c: +// utf8 methods defined in/depending on src/utf8code.c: cstr cstr_tolower(const cstr* self); cstr cstr_toupper(const cstr* self); void cstr_lowercase(cstr* self); @@ -251,7 +251,7 @@ STC_INLINE bool cstr_equals_s(cstr s1, cstr s2) { return cstr_cmp(&s1, &s2) == 0; } STC_INLINE size_t cstr_find(cstr s, const char* search) { - const char *str = cstr_str(&s), *res = strstr(str, search); + const char *str = cstr_str(&s), *res = strstr((char*)str, search); return res ? res - str : cstr_npos; } @@ -259,10 +259,10 @@ STC_INLINE size_t cstr_find_s(cstr s, cstr search) { return cstr_find(s, cstr_str(&search)); } STC_INLINE bool cstr_contains(cstr s, const char* search) - { return strstr(cstr_str(&s), search) != NULL; } + { return strstr(cstr_data(&s), search) != NULL; } STC_INLINE bool cstr_contains_s(cstr s, cstr search) - { return strstr(cstr_str(&s), cstr_str(&search)) != NULL; } + { return strstr(cstr_data(&s), cstr_str(&search)) != NULL; } STC_INLINE bool cstr_starts_with(cstr s, const char* sub) { const char* str = cstr_str(&s); @@ -414,7 +414,7 @@ STC_DEF void cstr_resize(cstr* self, const size_t size, const char value) { STC_DEF size_t cstr_find_from(cstr s, const size_t pos, const char* search) { csview sv = cstr_sv(&s); if (pos > sv.size) return cstr_npos; - char* res = strstr(sv.str + pos, search); + const char* res = strstr((char*)sv.str + pos, search); return res ? res - sv.str : cstr_npos; } diff --git a/include/stc/csview.h b/include/stc/csview.h index eb79c482..eebcb9b7 100644 --- a/include/stc/csview.h +++ b/include/stc/csview.h @@ -102,7 +102,7 @@ STC_INLINE csview csview_substr_u8(csview sv, size_t u8pos, size_t u8len) { return sv; } -STC_INLINE bool csview_valid_u8(csview sv) // depends on src/utf8utils.c +STC_INLINE bool csview_valid_u8(csview sv) // depends on src/utf8code.c { return utf8_valid_n(sv.str, sv.size); } diff --git a/include/stc/utf8.h b/include/stc/utf8.h index dffd9f15..67722345 100644 --- a/include/stc/utf8.h +++ b/include/stc/utf8.h @@ -25,7 +25,7 @@ int main() #include "ccommon.h" #include -// utf8 methods defined in src/utf8utils.c: +// utf8 methods defined in src/utf8code.c: bool utf8_islower(uint32_t c); bool utf8_isupper(uint32_t c); bool utf8_isspace(uint32_t c); -- cgit v1.2.3