shared: add nm_strv_ptrarray_cmp() helper

This commit is contained in:
Thomas Haller 2020-07-24 13:54:49 +02:00
parent 684b0ec061
commit d550eef02d
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -1879,6 +1879,20 @@ nm_strv_ptrarray_contains (const GPtrArray *strv,
return nm_strv_ptrarray_find_first (strv, str) >= 0;
}
static inline int
nm_strv_ptrarray_cmp (const GPtrArray *a,
const GPtrArray *b)
{
/* _nm_utils_strv_cmp_n() will treat NULL and empty arrays the same.
* That means, an empty strv array can both be represented by NULL
* and an array of length zero.
* If you need to distinguish between these case, do that yourself. */
return _nm_utils_strv_cmp_n ((const char *const*) nm_g_ptr_array_pdata (a),
nm_g_ptr_array_len (a),
(const char *const*) nm_g_ptr_array_pdata (b),
nm_g_ptr_array_len (b));
}
/*****************************************************************************/
int nm_utils_getpagesize (void);