core: add utility function nm_utils_is_uuid()
This commit is contained in:
@@ -988,3 +988,20 @@ nm_utils_complete_generic (NMConnection *connection,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
nm_utils_is_uuid (const char *str)
|
||||||
|
{
|
||||||
|
const char *p = str;
|
||||||
|
int num_dashes = 0;
|
||||||
|
|
||||||
|
while (*p) {
|
||||||
|
if (*p == '-')
|
||||||
|
num_dashes++;
|
||||||
|
else if (!isxdigit (*p))
|
||||||
|
return FALSE;
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (num_dashes == 4) && (p - str == 36);
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -92,4 +92,6 @@ void nm_utils_complete_generic (NMConnection *connection,
|
|||||||
const char *preferred,
|
const char *preferred,
|
||||||
gboolean default_enable_ipv6);
|
gboolean default_enable_ipv6);
|
||||||
|
|
||||||
|
gboolean nm_utils_is_uuid (const char *str);
|
||||||
|
|
||||||
#endif /* NETWORK_MANAGER_UTILS_H */
|
#endif /* NETWORK_MANAGER_UTILS_H */
|
||||||
|
Reference in New Issue
Block a user