mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-04 14:10:36 +01:00
libnm-core: add _nm_utils_strv_equal()
This commit is contained in:
parent
4fb0d62802
commit
d49fcd07d1
2 changed files with 25 additions and 0 deletions
|
|
@ -135,6 +135,7 @@ char ** _nm_utils_slist_to_strv (GSList *slist, gboolean deep_copy);
|
|||
|
||||
GPtrArray * _nm_utils_strv_to_ptrarray (char **strv);
|
||||
char ** _nm_utils_ptrarray_to_strv (GPtrArray *ptrarray);
|
||||
gboolean _nm_utils_strv_equal (char **strv1, char **strv2);
|
||||
|
||||
gboolean _nm_utils_check_file (const char *filename,
|
||||
gint64 check_owner,
|
||||
|
|
|
|||
|
|
@ -845,6 +845,30 @@ _nm_utils_ptrarray_to_strv (GPtrArray *ptrarray)
|
|||
return strv;
|
||||
}
|
||||
|
||||
/**
|
||||
* _nm_utils_strv_equal:
|
||||
* @strv1: a string array
|
||||
* @strv2: a string array
|
||||
*
|
||||
* Compare NULL-terminated string arrays for equality.
|
||||
*
|
||||
* Returns: %TRUE if the arrays are equal, %FALSE otherwise.
|
||||
**/
|
||||
gboolean
|
||||
_nm_utils_strv_equal (char **strv1, char **strv2)
|
||||
{
|
||||
if (strv1 == strv2)
|
||||
return TRUE;
|
||||
|
||||
if (!strv1 || !strv2)
|
||||
return FALSE;
|
||||
|
||||
for ( ; *strv1 && *strv2 && !strcmp (*strv1, *strv2); strv1++, strv2++)
|
||||
;
|
||||
|
||||
return !*strv1 && !*strv2;
|
||||
}
|
||||
|
||||
/**
|
||||
* _nm_utils_strsplit_set:
|
||||
* @str: string to split
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue