mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-22 09:10:28 +01:00
core: add utility function nm_utils_is_uuid()
This commit is contained in:
parent
ccea442504
commit
fcce9daa15
2 changed files with 19 additions and 0 deletions
|
|
@ -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 */
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue