diff options
author | Thomas Haller <thaller@redhat.com> | 2020-03-26 17:49:55 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2020-04-04 19:51:34 +0200 |
commit | 76784e0c97673216d87e949e9b577427cd36f9dc (patch) | |
tree | c334395cdcce6e4ca43e486f03f3d040e04ee4f5 /shared/nm-glib-aux/nm-macros-internal.h | |
parent | 5f6dfcfc920be5dd49b6670047e991781333def1 (diff) | |
download | NetworkManager-76784e0c97673216d87e949e9b577427cd36f9dc.tar.gz |
shared: add nm_str_is_stripped() util
Diffstat (limited to 'shared/nm-glib-aux/nm-macros-internal.h')
-rw-r--r-- | shared/nm-glib-aux/nm-macros-internal.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/shared/nm-glib-aux/nm-macros-internal.h b/shared/nm-glib-aux/nm-macros-internal.h index 758a4ec9aa..9e3735d477 100644 --- a/shared/nm-glib-aux/nm-macros-internal.h +++ b/shared/nm-glib-aux/nm-macros-internal.h @@ -1571,6 +1571,17 @@ nm_strstrip_avoid_copy (const char *str, char **str_free) _str_ssac; \ }) +static inline gboolean +nm_str_is_stripped (const char *str) +{ + if (str && str[0]) { + if ( g_ascii_isspace (str[0]) + || g_ascii_isspace (str[strlen (str) - 1])) + return FALSE; + } + return TRUE; +} + /* g_ptr_array_sort()'s compare function takes pointers to the * value. Thus, you cannot use strcmp directly. You can use * nm_strcmp_p(). |