summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorTyge Lovset <[email protected]>2022-06-11 09:30:44 +0200
committerTyge Lovset <[email protected]>2022-06-11 09:30:44 +0200
commit69e930f36ab18999009d064f08e2a0b4f10733b3 (patch)
treee326a5a12bc94257143d48cc237bf05d15c26a7b /include
parentd5f213e6186264461295a91ba80f17ecabc09455 (diff)
downloadSTC-modified-69e930f36ab18999009d064f08e2a0b4f10733b3.tar.gz
STC-modified-69e930f36ab18999009d064f08e2a0b4f10733b3.zip
Improving cregex, and minors, e.g. cstr_foldcase=>cstr_casefold.
Diffstat (limited to 'include')
-rw-r--r--include/stc/cstr.h2
-rw-r--r--include/stc/utf8.h7
2 files changed, 6 insertions, 3 deletions
diff --git a/include/stc/cstr.h b/include/stc/cstr.h
index 8116fce2..9c2c9c0c 100644
--- a/include/stc/cstr.h
+++ b/include/stc/cstr.h
@@ -171,7 +171,7 @@ STC_INLINE size_t cstr_capacity(cstr s)
extern cstr cstr_tofold(const cstr* self);
extern cstr cstr_tolower(const cstr* self);
extern cstr cstr_toupper(const cstr* self);
-extern void cstr_foldcase(cstr* self);
+extern void cstr_casefold(cstr* self);
extern void cstr_lowercase(cstr* self);
extern void cstr_uppercase(cstr* self);
diff --git a/include/stc/utf8.h b/include/stc/utf8.h
index fb06de62..41d2f315 100644
--- a/include/stc/utf8.h
+++ b/include/stc/utf8.h
@@ -36,7 +36,6 @@ bool utf8_isalnum(uint32_t c);
uint32_t utf8_casefold(uint32_t c);
uint32_t utf8_tolower(uint32_t c);
uint32_t utf8_toupper(uint32_t c);
-bool utf8_valid(const char* s);
bool utf8_valid_n(const char* s, size_t nbytes);
int utf8_icmp_n(size_t u8max, const char* s1, size_t n1,
const char* s2, size_t n2);
@@ -59,7 +58,11 @@ STC_INLINE int utf8_icmp(const char* s1, const char* s2) {
return utf8_icmp_n(~(size_t)0, s1, ~(size_t)0, s2, ~(size_t)0);
}
-/* number of characters in the utf8 codepoint from s */
+STC_INLINE bool utf8_valid(const char* s) {
+ return utf8_valid_n(s, ~(size_t)0);
+}
+
+/* number of bytes in the utf8 codepoint from s */
STC_INLINE unsigned utf8_chr_size(const char *s) {
unsigned b = (uint8_t)*s;
if (b < 0x80) return 1;