diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-01-27 23:26:42 +0100 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-01-27 23:26:42 +0100 |
commit | 679f7928e27a95e559eb3a69febf0c6336e40234 (patch) | |
tree | af9c5bb35253086eb8e3ad3d7774e7349b3beefe /vendor/librune/lib/utf8/u8prev.c | |
parent | fd502fd87b40ae7f60314d8d9009f739f1c5fcf3 (diff) |
Bump librune
Diffstat (limited to 'vendor/librune/lib/utf8/u8prev.c')
-rw-r--r-- | vendor/librune/lib/utf8/u8prev.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/vendor/librune/lib/utf8/u8prev.c b/vendor/librune/lib/utf8/u8prev.c index fac0fc7..a219ae9 100644 --- a/vendor/librune/lib/utf8/u8prev.c +++ b/vendor/librune/lib/utf8/u8prev.c @@ -1,9 +1,10 @@ +#define _RUNE_NO_MACRO_WRAPPER 1 #include "rune.h" #include "utf8.h" #include "internal/common.h" -const char8_t * +int u8prev(rune *ch, const char8_t **p, const char8_t *start) { int off; @@ -12,7 +13,7 @@ u8prev(rune *ch, const char8_t **p, const char8_t *start) ptrdiff_t d = s - start; if (d <= 0) { - return nullptr; + return 0; } else if (U1(s[-1])) { *ch = s[-1]; off = 1; @@ -29,9 +30,11 @@ u8prev(rune *ch, const char8_t **p, const char8_t *start) } else match = false; - if (match && u8chkr(*ch)) - return *p -= off; + if (!(match && u8chkr(*ch))) { + *ch = RUNE_ERROR; + off = 1; + } - *ch = RUNE_ERROR; - return *p--; + *p -= off; + return off; } |