aboutsummaryrefslogtreecommitdiff
path: root/vendor/librune/lib/utf8/u8next.c
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/librune/lib/utf8/u8next.c')
-rw-r--r--vendor/librune/lib/utf8/u8next.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/vendor/librune/lib/utf8/u8next.c b/vendor/librune/lib/utf8/u8next.c
index 8edc084..12c521d 100644
--- a/vendor/librune/lib/utf8/u8next.c
+++ b/vendor/librune/lib/utf8/u8next.c
@@ -1,14 +1,16 @@
+#define _RUNE_NO_MACRO_WRAPPER 1
#include "utf8.h"
-#include "internal/common.h"
-
-const char8_t *
+int
u8next(rune *ch, const char8_t **s, size_t *n)
{
- int m;
+ int m = 0;
+
+ if (*n) {
+ m = u8tor_uc(ch, *s);
+ *n -= m;
+ *s += m;
+ }
- if (*n == 0)
- return nullptr;
- *n -= m = u8tor_uc(ch, *s);
- return *s += m;
+ return m;
}