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.
This commit is contained in:
Thomas Haller 2019-05-21 18:13:53 +02:00
parent b1f5e971f3
commit c165c6a671

View file

@ -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 == '-')