From 03fc67cc74cc08fff5eb61e855b54174683614ff Mon Sep 17 00:00:00 2001 From: Phil Jones Date: Thu, 24 Nov 2022 12:48:39 +0000 Subject: 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. --- src/unicode.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/unicode.c') 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 #include #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); +} -- cgit v1.2.3