aboutsummaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2024-09-13 07:20:50 +0000
committerDaniel Eklöf <daniel@ekloef.se>2024-09-13 07:20:50 +0000
commit33f3818520bd5f7a063f64442c54d41625332aeb (patch)
tree33d21207b1f2473800358ec0a594942b965034db /misc.c
parentxsnprintf: various improvements related to xvsnprintf() and xsnprintf() (diff)
parentchangelog: remove escape sequences we've reverted (diff)
Merge branch 'toplevel-icon'
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;
+}