glib-aux: add nm_g_array_data() helper

It's annoying to do

  (arr ? arr->data : NULL)

Especially, because usually you'd need to cast the above
(which would have type (char *)).
This commit is contained in:
Thomas Haller 2022-05-05 11:18:27 +02:00
parent 8b9e52b9ce
commit 5ff08fbbea
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -2165,6 +2165,12 @@ char *nm_utils_g_slist_strlist_join(const GSList *a, const char *separator);
/*****************************************************************************/
static inline gpointer
nm_g_array_data(const GArray *arr)
{
return arr ? arr->data : NULL;
}
static inline guint
nm_g_array_len(const GArray *arr)
{