mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-01 08:20:11 +01:00
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:
parent
b1f5e971f3
commit
c165c6a671
1 changed files with 6 additions and 2 deletions
|
|
@ -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 == '-')
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue