glib-aux: reorder comparison in nm_ref_string_equal_str()

We usually compare first for pointer equality. It seems to make
more sense this way. Swap.
This commit is contained in:
Thomas Haller 2022-09-26 16:47:56 +02:00
parent 0b6a9e2c88
commit 8ab23e5b2d
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -156,7 +156,7 @@ nm_ref_string_equal_str(NMRefString *rstr, const char *str)
/* We don't use streq() here, because an NMRefString might have embedded NUL characters
* (as the length is tracked separately). The NUL terminated C string @str must not
* compare equal to such a @rstr, thus we first explicitly check strlen(). */
return rstr->len == strlen(str) && (rstr->str == str || memcmp(rstr->str, str, rstr->len) == 0);
return rstr->str == str || (rstr->len == strlen(str) && memcmp(rstr->str, str, rstr->len) == 0);
}
static inline gboolean