mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-09-30 13:24:48 +00:00
shared: add NM_STR_HAS_PREFIX() macro
Commonly, the prefix is a string constant. We don't need to call g_str_has_prefix() for that, which first requires strlen() on the prefix. All the information is readily available. Add a macro for that.
This commit is contained in:
parent
1f906d9214
commit
e3ea8ecd33
|
@ -829,6 +829,9 @@ fcn (void) \
|
|||
#define nm_streq(s1, s2) (strcmp (s1, s2) == 0)
|
||||
#define nm_streq0(s1, s2) (g_strcmp0 (s1, s2) == 0)
|
||||
|
||||
#define NM_STR_HAS_PREFIX(str, prefix) \
|
||||
(strncmp ((str), ""prefix"", NM_STRLEN (prefix)) == 0)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static inline GString *
|
||||
|
|
Loading…
Reference in a new issue