diff options
author | Nicholas Noll <nbnoll@eml.cc> | 2021-10-28 11:55:47 -0700 |
---|---|---|
committer | Nicholas Noll <nbnoll@eml.cc> | 2021-10-28 11:55:47 -0700 |
commit | 6318ddb69ad8380694bbca35ca5a72230c2ee694 (patch) | |
tree | e9ef65d79c264d88c2d02402a587c2561b5b1299 /sys/libunicode/findlast.c | |
parent | 189b9e23edfe60b7e82c4c7b6071a3f98799653a (diff) |
Feat(libunicode): cleaned up decode/encode
Additionally, decode can now apply backwards on a byte string.
Diffstat (limited to 'sys/libunicode/findlast.c')
-rw-r--r-- | sys/libunicode/findlast.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/libunicode/findlast.c b/sys/libunicode/findlast.c index 3a4ed38..ab25ab2 100644 --- a/sys/libunicode/findlast.c +++ b/sys/libunicode/findlast.c @@ -7,19 +7,21 @@ utf8·findlast(byte* s, rune c) rune r; byte *l; - if(c < RuneSync) + if(c < Tx) return strrchr(s, c); l = nil; for(;;){ c1 = *(ubyte*)s; - if(c1 < RuneSelf) { + if(c1 < Tx){ if(c1 == 0) return l; if(c1 == c) l = s; s++; continue; } + c1 = utf8·decode(s, &r); + if(r == c) l = s; |