summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-05-05 11:18:27 +0200
committerThomas Haller <thaller@redhat.com>2022-05-09 19:21:58 +0200
commit5ff08fbbea0acbc17bcb9c69901902456547515c (patch)
treea7e44561c4644a869638f12de93fed3a8fa63114
parent8b9e52b9ce0d82156042de06483fe548d2c39aa0 (diff)
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 *)).
-rw-r--r--src/libnm-glib-aux/nm-shared-utils.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libnm-glib-aux/nm-shared-utils.h b/src/libnm-glib-aux/nm-shared-utils.h
index ec57190e50..80f6bcddb9 100644
--- a/src/libnm-glib-aux/nm-shared-utils.h
+++ b/src/libnm-glib-aux/nm-shared-utils.h
@@ -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)
{