diff options
author | Thomas Haller <thaller@redhat.com> | 2019-05-21 18:13:53 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-06-12 11:09:46 +0200 |
commit | 5aa196c95ff3cc395008c18a27a5bda45d6e0d5c (patch) | |
tree | 6da86587ef53967c9b367c03f403fe00803aa3ed | |
parent | ed32fe154f60d38cb37edfbc4d0dbf152bc894f7 (diff) | |
download | NetworkManager-5aa196c95ff3cc395008c18a27a5bda45d6e0d5c.tar.gz |
libnm: don't assert against %NULL string in nm_utils_is_uuid()
For a "is" check, it's inconvenient to assert against the parameter
being %NULL. We should accept %NULL and just say that it's not a valid
uuid.
This relaxes previous API.
-rw-r--r-- | libnm-core/nm-utils.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c index 5322a8d747..dc0b5b814e 100644 --- a/libnm-core/nm-utils.c +++ b/libnm-core/nm-utils.c @@ -4713,11 +4713,14 @@ nm_utils_iface_valid_name (const char *name) /** * nm_utils_is_uuid: - * @str: a string that might be a UUID + * @str: (allow-none): a string that might be a UUID * * Checks if @str is a UUID * * Returns: %TRUE if @str is a UUID, %FALSE if not + * + * In older versions, nm_utils_is_uuid() did not accept %NULL as @str + * argument. Don't pass %NULL if you run against older versions of libnm. */ gboolean nm_utils_is_uuid (const char *str) @@ -4725,7 +4728,8 @@ nm_utils_is_uuid (const char *str) const char *p = str; int num_dashes = 0; - g_return_val_if_fail (str, FALSE); + if (!p) + return FALSE; while (*p) { if (*p == '-') |