aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2015-09-15 09:06:33 +0200
committerMarc André Tanner <mat@brain-dump.org>2015-09-15 09:09:15 +0200
commitfa950307aeb2a060be72fc73e0017e5497cb4ace (patch)
treec7390ae9a6051c0e8f812ee0e31af0ccf507fd58
parente57595741285eebf1aac2f2ceac19cae5d949612 (diff)
downloadvis-fa950307aeb2a060be72fc73e0017e5497cb4ace.tar.gz
vis-fa950307aeb2a060be72fc73e0017e5497cb4ace.tar.xz
Add utfnext utility function
-rw-r--r--libutf.c7
-rw-r--r--libutf.h2
2 files changed, 9 insertions, 0 deletions
diff --git a/libutf.c b/libutf.c
index 5f6ff45..c9d77dc 100644
--- a/libutf.c
+++ b/libutf.c
@@ -1,5 +1,12 @@
/* libutf8 © 2012-2015 Connor Lane Smith <cls@lubutu.com> */
#include "libutf.h"
+#include "util.h"
+
+const char *utfnext(const char *s) {
+ while (!ISUTF8(*s))
+ s++;
+ return s;
+}
int
runelen(Rune r)
diff --git a/libutf.h b/libutf.h
index 4d3f91c..b255961 100644
--- a/libutf.h
+++ b/libutf.h
@@ -1,6 +1,8 @@
#ifndef LIBUTF_H
#define LIBUTF_H
+const char *utfnext(const char *s);
+
/* libutf8 © 2012-2015 Connor Lane Smith <cls@lubutu.com> */
#include <stddef.h>
#include <stdint.h>