summaryrefslogtreecommitdiffhomepage
path: root/include/stc
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-05-30 17:08:09 +0200
committerTyge Løvset <[email protected]>2022-05-30 17:08:09 +0200
commit6a5ec101dc606a9bb13ef5a5ee64ab001decc666 (patch)
tree7b368fdcc1e7055bd1d327f29c4c108eb604c751 /include/stc
parent58bb58e7980d1eae175ed66dbe873893a05ab81e (diff)
downloadSTC-modified-6a5ec101dc606a9bb13ef5a5ee64ab001decc666.tar.gz
STC-modified-6a5ec101dc606a9bb13ef5a5ee64ab001decc666.zip
Updated benchmarks and renamed utf8utils.c to utf8code.c
Diffstat (limited to 'include/stc')
-rw-r--r--include/stc/cstr.h10
-rw-r--r--include/stc/csview.h2
-rw-r--r--include/stc/utf8.h2
3 files changed, 7 insertions, 7 deletions
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 <ctype.h>
-// 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);