diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2020-08-06 14:20:48 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2020-08-24 16:51:53 +0200 |
commit | 8113069062e5eb9e255725d6833981552e699584 (patch) | |
tree | 07e4ef8c936c9d98b4458ae0fee7379e1df25959 | |
parent | 94ded0c5b2472693190c5d6da77d3c811bdbd63b (diff) | |
download | NetworkManager-8113069062e5eb9e255725d6833981552e699584.tar.gz |
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.
-rw-r--r-- | shared/nm-glib-aux/nm-shared-utils.h | 6 |
1 files changed, 6 insertions, 0 deletions
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 <netinet/in.h> +static inline gboolean +nm_is_ascii (char ch) +{ + return ((uint8_t) ch) < 128; +} + /*****************************************************************************/ pid_t nm_utils_gettid (void); |