diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-05-04 04:01:45 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-05-04 04:01:45 +0200 |
commit | ac1b4bcbaeaee7d2ef9132dcdc254f2d08691650 (patch) | |
tree | 90250966629653f0462cf17bc0b6f2476fb6d1fc /lib/mbstring/u8split.c | |
parent | 8b923ba5e5bb37ea26350b4c1c688b8697706609 (diff) |
Go all in on string views, and fix manuals
Diffstat (limited to 'lib/mbstring/u8split.c')
-rw-r--r-- | lib/mbstring/u8split.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/mbstring/u8split.c b/lib/mbstring/u8split.c index 5ee3bc0..c26f48b 100644 --- a/lib/mbstring/u8split.c +++ b/lib/mbstring/u8split.c @@ -1,16 +1,16 @@ #include "mbstring.h" struct u8view -u8split(const char8_t **p, size_t *n, rune ch) +u8split(struct u8view *rhs, rune ch) { - struct u8view lhs = {.p = *p}; - if ((*p = u8chr(*p, *n, ch)) == nullptr) { - lhs.len = *n; - *n = 0; + struct u8view lhs = {.p = rhs->p}; + if ((rhs->p = u8chr(*rhs, ch)) == nullptr) { + lhs.len = rhs->len; + rhs->len = 0; } else { - lhs.len = *p - lhs.p; - *n -= lhs.len; - u8next(nullptr, p, n); + lhs.len = rhs->p - lhs.p; + rhs->len -= lhs.len; + u8next(nullptr, rhs); } return lhs; } |