summaryrefslogtreecommitdiffhomepage
path: root/include/stc/utf8.h
diff options
context:
space:
mode:
authorTyge Lovset <[email protected]>2022-05-31 04:54:03 +0200
committerTyge Lovset <[email protected]>2022-05-31 04:54:03 +0200
commitb09f435cf7fe7a8b4d976b921384c6176381cc7f (patch)
tree7df61684e10afcfc433e7d7120faa000f8b0d400 /include/stc/utf8.h
parent2688277a4efe011ffd35f0e3ce859bb110207d8e (diff)
downloadSTC-modified-b09f435cf7fe7a8b4d976b921384c6176381cc7f.tar.gz
STC-modified-b09f435cf7fe7a8b4d976b921384c6176381cc7f.zip
Generalized utf8_icmp_n() and added cstr_icmp(), csview_icmp().
Diffstat (limited to 'include/stc/utf8.h')
-rw-r--r--include/stc/utf8.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/stc/utf8.h b/include/stc/utf8.h
index 333a0f92..a3647e3c 100644
--- a/include/stc/utf8.h
+++ b/include/stc/utf8.h
@@ -38,7 +38,8 @@ uint32_t utf8_toupper(uint32_t c);
bool utf8_valid(const char* s);
bool utf8_valid_n(const char* s, size_t n);
-int utf8_icmp_n(const char* s1, const char* s2, size_t u8max);
+int utf8_icmp_n(size_t u8max, const char* s1, size_t n1,
+ const char* s2, size_t n2);
/* encode/decode next utf8 codepoint. */
enum { UTF8_OK = 0, UTF8_ERROR = 4 };
@@ -50,7 +51,7 @@ void utf8_decode(utf8_decode_t *d, const uint8_t b);
/* case-insensitive utf8 string comparison */
STC_INLINE int utf8_icmp(const char* s1, const char* s2)
- { return utf8_icmp_n(s1, s2, (size_t)(-1)); }
+ { 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 unsigned utf8_codep_size(const char *s) {