aboutsummaryrefslogtreecommitdiff
path: root/sys/libunicode/find.c
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2021-10-28 11:55:47 -0700
committerNicholas Noll <nbnoll@eml.cc>2021-10-28 11:55:47 -0700
commit6318ddb69ad8380694bbca35ca5a72230c2ee694 (patch)
treee9ef65d79c264d88c2d02402a587c2561b5b1299 /sys/libunicode/find.c
parent189b9e23edfe60b7e82c4c7b6071a3f98799653a (diff)
Feat(libunicode): cleaned up decode/encode
Additionally, decode can now apply backwards on a byte string.
Diffstat (limited to 'sys/libunicode/find.c')
-rw-r--r--sys/libunicode/find.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/libunicode/find.c b/sys/libunicode/find.c
index 659ab5b..d75feb8 100644
--- a/sys/libunicode/find.c
+++ b/sys/libunicode/find.c
@@ -7,17 +7,18 @@ utf8·find(byte* s, rune c)
rune r;
int n;
- if(c < RuneSync)
+ if(c < Tx)
return strchr(s, c);
for(;;){
c1 = *(ubyte*)s;
- if(c1 < RuneSelf) {
+ if(c1 < Tx){
if(c1 == 0) return nil;
if(c1 == c) return s;
s++;
continue;
}
+
n = utf8·decode(s, &r);
if(r == c)