From 311f12d7005351ca245aa1df77889d8db4899862 Mon Sep 17 00:00:00 2001 From: tylov Date: Thu, 17 Aug 2023 09:54:16 +0200 Subject: Simplified access to utf8 character .chr in cstr / csview / crawstr iterators. Backward compatibility kept, but deprecated. --- include/stc/cstr.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include/stc/cstr.h') diff --git a/include/stc/cstr.h b/include/stc/cstr.h index eeb65c39..f0974865 100644 --- a/include/stc/cstr.h +++ b/include/stc/cstr.h @@ -217,15 +217,15 @@ STC_INLINE cstr_iter cstr_end(const cstr* self) { (void)self; return c_LITERAL(cstr_iter){NULL}; } STC_INLINE void cstr_next(cstr_iter* it) { - it->ref += it->u8.chr.size; - it->u8.chr.size = utf8_chr_size(it->ref); + it->ref += it->chr.size; + it->chr.size = utf8_chr_size(it->ref); if (!*it->ref) it->ref = NULL; } STC_INLINE cstr_iter cstr_advance(cstr_iter it, intptr_t pos) { int inc = -1; if (pos > 0) pos = -pos, inc = 1; while (pos && *it.ref) pos += (*(it.ref += inc) & 0xC0) != 0x80; - it.u8.chr.size = utf8_chr_size(it.ref); + it.chr.size = utf8_chr_size(it.ref); if (!*it.ref) it.ref = NULL; return it; } -- cgit v1.2.3