diff options
author | Thomas Haller <thaller@redhat.com> | 2020-03-24 17:12:36 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2020-03-24 20:43:55 +0100 |
commit | 999c569585aa04b58bc9d55d53638d2f961e6fd6 (patch) | |
tree | 0b5470e4f0ecec8dd578d26d08d6eb94ff91b256 /shared | |
parent | 8069e5fd208197f1f4aa6ffb5062f2d66416d9bd (diff) | |
download | NetworkManager-999c569585aa04b58bc9d55d53638d2f961e6fd6.tar.gz |
shared: add NM_ASCII_WHITESPACES macro
NM_ASCII_SPACES contains the ASCII characters according to
g_ascii_isspace().
Add NM_ASCII_WHITESPACES which differs from NM_ASCII_SPACES by not
including "\f". In some cases, that character shall be excluded.
For example, this is what systemd uses as "WHITESPACE" define at
various places.
Also, reorder the spaces string so that plain space comes first. It is
expected that ' ' is much more frequently than newlines or tabs. While
the order here shouldn't matter, it seems preferably to order frequent
characters in front.
Diffstat (limited to 'shared')
-rw-r--r-- | shared/nm-glib-aux/nm-macros-internal.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/shared/nm-glib-aux/nm-macros-internal.h b/shared/nm-glib-aux/nm-macros-internal.h index 84317567ef..d54bb3ddda 100644 --- a/shared/nm-glib-aux/nm-macros-internal.h +++ b/shared/nm-glib-aux/nm-macros-internal.h @@ -1479,7 +1479,12 @@ _NM_BACKPORT_SYMBOL_IMPL(version, return_type, func, _##func##_##version, args_t /*****************************************************************************/ /* mirrors g_ascii_isspace() and what we consider spaces in general. */ -#define NM_ASCII_SPACES "\t\n\f\r " +#define NM_ASCII_SPACES " \n\t\r\f" + +/* Like NM_ASCII_SPACES, but without "\f" (0x0c, Formfeed Page Break). + * This is what for example systemd calls WHITESPACE and what it uses to tokenize + * the kernel command line. */ +#define NM_ASCII_WHITESPACES " \n\t\r" #define nm_str_skip_leading_spaces(str) \ ({ \ |