summaryrefslogtreecommitdiffhomepage
path: root/include/stc/cstr.h
diff options
context:
space:
mode:
authortylov <[email protected]>2023-08-17 09:54:16 +0200
committertylov <[email protected]>2023-08-17 09:54:16 +0200
commit311f12d7005351ca245aa1df77889d8db4899862 (patch)
tree91d98717390df1394fb4dc0e3a354551e989aa9b /include/stc/cstr.h
parentbe0e64a9a19d3ca459284c61c497d141a78df1d7 (diff)
downloadSTC-modified-311f12d7005351ca245aa1df77889d8db4899862.tar.gz
STC-modified-311f12d7005351ca245aa1df77889d8db4899862.zip
Simplified access to utf8 character .chr in cstr / csview / crawstr iterators. Backward compatibility kept, but deprecated.
Diffstat (limited to 'include/stc/cstr.h')
-rw-r--r--include/stc/cstr.h6
1 files changed, 3 insertions, 3 deletions
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;
}