aboutsummaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/misc.c b/misc.c
index a81aa9e4..1e5b9328 100644
--- a/misc.c
+++ b/misc.c
@@ -42,3 +42,10 @@ timespec_sub(const struct timespec *a, const struct timespec *b,
res->tv_nsec += one_sec_in_ns;
}
}
+
+bool
+is_valid_utf8(const char *value)
+{
+ return value != NULL &&
+ mbsntoc32(NULL, value, strlen(value), 0) != (size_t)-1;
+}