shared: add nm_strvarray_get_strv_non_empty() helper

(cherry picked from commit d69f057a65)
This commit is contained in:
Thomas Haller 2020-06-22 11:57:25 +02:00
parent 3951396de7
commit 092ab227d5
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -2023,6 +2023,18 @@ nm_strvarray_add (GArray *array, const char *str)
g_array_append_val (array, s);
}
static inline const char *const*
nm_strvarray_get_strv_non_empty (GArray *arr, guint *length)
{
if (!arr || arr->len == 0) {
NM_SET_OUT (length, 0);
return NULL;
}
NM_SET_OUT (length, arr->len);
return &g_array_index (arr, const char *, 0);
}
static inline const char *const*
nm_strvarray_get_strv (GArray **arr, guint *length)
{