shared: make nm_streq() and nm_streq0() inline functions
There is no advantage in having these as macros. Make them inline functions, compiler should be able to decide that they are in fact inlinable. Also, don't call g_strcmp0() for nm_streq0(). It means we first have to call glib function, only to call a glibc function. No need for this abstraction.
This commit is contained in:
@@ -860,8 +860,18 @@ fcn (void) \
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define nm_streq(s1, s2) (strcmp (s1, s2) == 0)
|
||||
#define nm_streq0(s1, s2) (g_strcmp0 (s1, s2) == 0)
|
||||
static inline gboolean
|
||||
nm_streq (const char *s1, const char *s2)
|
||||
{
|
||||
return strcmp (s1, s2) == 0;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
nm_streq0 (const char *s1, const char *s2)
|
||||
{
|
||||
return (s1 == s2)
|
||||
|| (s1 && s2 && strcmp (s1, s2) == 0);
|
||||
}
|
||||
|
||||
#define NM_STR_HAS_PREFIX(str, prefix) \
|
||||
(strncmp ((str), ""prefix"", NM_STRLEN (prefix)) == 0)
|
||||
|
Reference in New Issue
Block a user