From 8113069062e5eb9e255725d6833981552e699584 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Thu, 6 Aug 2020 14:20:48 +0200 Subject: [PATCH] shared: add nm_is_ascii() glib's is{alnum,alpha,ascii,...}() functions perform the check based on the current locale. Probably using isascii() would be fine anyway, but add a NM version that just checks that the upper bit is zero. --- shared/nm-glib-aux/nm-shared-utils.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/shared/nm-glib-aux/nm-shared-utils.h b/shared/nm-glib-aux/nm-shared-utils.h index 7efb8aed52..a097a690c8 100644 --- a/shared/nm-glib-aux/nm-shared-utils.h +++ b/shared/nm-glib-aux/nm-shared-utils.h @@ -8,6 +8,12 @@ #include +static inline gboolean +nm_is_ascii (char ch) +{ + return ((uint8_t) ch) < 128; +} + /*****************************************************************************/ pid_t nm_utils_gettid (void);