summaryrefslogtreecommitdiffhomepage
path: root/include/stc/utf8.h
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/stc/utf8.h
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/stc/utf8.h')
-rw-r--r--include/stc/utf8.h7
1 files changed, 5 insertions, 2 deletions
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;