summaryrefslogtreecommitdiff
path: root/src/unicode.c
diff options
context:
space:
mode:
authorPhil Jones <philj56@gmail.com>2022-11-24 12:48:39 +0000
committerPhil Jones <philj56@gmail.com>2022-11-24 12:48:39 +0000
commit03fc67cc74cc08fff5eb61e855b54174683614ff (patch)
treedc8376aa977a0cff31ebc0d4283cb77cce0e934e /src/unicode.c
parente19d821a7ec5d8b8d528be93626bbc2effd15320 (diff)
Speed up string vector filtering and loading.
We can assume that string vectors generated by tofi are already normalised, so don't waste time normalising them again. Also make sure to validate strings from the user.
Diffstat (limited to 'src/unicode.c')
-rw-r--r--src/unicode.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/unicode.c b/src/unicode.c
index 3833fb6..7ddc0d5 100644
--- a/src/unicode.c
+++ b/src/unicode.c
@@ -1,3 +1,4 @@
+#include <stdbool.h>
#include <string.h>
#include "unicode.h"
@@ -115,3 +116,8 @@ char *utf8_compose(const char *s)
{
return g_utf8_normalize(s, -1, G_NORMALIZE_DEFAULT_COMPOSE);
}
+
+bool utf8_validate(const char *s)
+{
+ return g_utf8_validate(s, -1, NULL);
+}