diff options
Diffstat (limited to 'src/libnm-glib-aux/nm-macros-internal.h')
| -rw-r--r-- | src/libnm-glib-aux/nm-macros-internal.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/libnm-glib-aux/nm-macros-internal.h b/src/libnm-glib-aux/nm-macros-internal.h index 7cc8ac97..f2a4461e 100644 --- a/src/libnm-glib-aux/nm-macros-internal.h +++ b/src/libnm-glib-aux/nm-macros-internal.h @@ -1053,6 +1053,24 @@ nm_g_variant_equal(GVariant *a, GVariant *b) * the kernel command line. */ #define NM_ASCII_WHITESPACES " \n\t\r" +static inline gboolean +nm_ascii_is_whitespace(char ch) +{ + /* Checks whether @ch is in NM_ASCII_WHITESPACES. + * Similar to g_ascii_isspace(), however this one does not accept '\f'. + * This is the same as systemd's strchr(WHITESPACE, ch). */ + return NM_IN_SET(ch, ' ', '\n', '\t', '\r'); +} + +#define NM_ASCII_NEWLINE "\n\r" + +static inline gboolean +nm_ascii_is_newline(char ch) +{ + /* This is the same as systemd's (!!strchr(NEWLINE, ch)). */ + return NM_IN_SET(ch, '\n', '\t'); +} + #define nm_str_skip_leading_spaces(str) \ ({ \ typeof(*(str)) *_str_sls = (str); \ @@ -1177,7 +1195,7 @@ _NM_IN_STRSET_EVAL_op_streq_ascii_case(const char *x1, const char *x) return x && g_ascii_strcasecmp(x1, x) == 0; } -#define _NM_IN_STRSET_EVAL_OP_STREQ_ASCII_CASE(x, idx) \ +#define _NM_IN_STRSET_EVAL_OP_STREQ_ASCII_CASE(x, idx, op_arg) \ _NM_IN_STRSET_EVAL_op_streq_ascii_case(_x1, x) #define NM_IN_STRSET_ASCII_CASE(x1, ...) \ _NM_IN_STRSET_EVAL(||, _NM_IN_STRSET_EVAL_OP_STREQ_ASCII_CASE, x1, __VA_ARGS__) |