mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-05 16:00:05 +01:00
Introduce crypt_strcmp function (allows NULL).
This commit is contained in:
10
lib/utils.c
10
lib/utils.c
@@ -334,3 +334,13 @@ bool crypt_string_in(const char *str, char **list, size_t list_size)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* compare two strings (allows NULL values) */
|
||||
int crypt_strcmp(const char *a, const char *b)
|
||||
{
|
||||
if (!a && !b)
|
||||
return 0;
|
||||
else if (!a || !b)
|
||||
return 1;
|
||||
return strcmp(a, b);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user