mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-25 11:50:14 +01:00
glib-aux/trival: add code comment to nm_ref_string_equal_str()
This commit is contained in:
parent
b755539aa6
commit
6ae6edb6a8
1 changed files with 3 additions and 0 deletions
|
|
@ -136,6 +136,9 @@ nm_ref_string_equal_str(NMRefString *rstr, const char *str)
|
|||
if (!rstr)
|
||||
return FALSE;
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue