diff options
author | Thomas Haller <thaller@redhat.com> | 2022-09-26 16:47:56 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2022-10-06 13:43:33 +0200 |
commit | 8ab23e5b2d8c3dc87581ce2e090886cf0925bb5d (patch) | |
tree | 4fbbff438f9f53770aeb4b1ae63cdd59125b92e3 | |
parent | 0b6a9e2c887b89b578a530aaaafd8f440169a7a6 (diff) |
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.
-rw-r--r-- | src/libnm-glib-aux/nm-ref-string.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libnm-glib-aux/nm-ref-string.h b/src/libnm-glib-aux/nm-ref-string.h index 0cfea5fae3..1b0cabf26d 100644 --- a/src/libnm-glib-aux/nm-ref-string.h +++ b/src/libnm-glib-aux/nm-ref-string.h @@ -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 |