From dcdbe984065ed06753a0ce542c1aaaa9336d8424 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 23 Jul 2019 23:25:03 +0200 Subject: [PATCH] shared: add nm_g_slice_free() helper How odd that such a macro does not exist yet. It seems like the majorities of calls to g_slice_free() could be replaced by this. --- shared/nm-glib-aux/nm-macros-internal.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/shared/nm-glib-aux/nm-macros-internal.h b/shared/nm-glib-aux/nm-macros-internal.h index 9062fe8d98..9502c442ec 100644 --- a/shared/nm-glib-aux/nm-macros-internal.h +++ b/shared/nm-glib-aux/nm-macros-internal.h @@ -1569,6 +1569,11 @@ nm_strcmp_p (gconstpointer a, gconstpointer b) /*****************************************************************************/ +#define nm_g_slice_free(ptr) \ + g_slice_free (typeof (*(ptr)), ptr) + +/*****************************************************************************/ + /* like g_memdup(). The difference is that the @size argument is of type * gsize, while g_memdup() has type guint. Since, the size of container types * like GArray is guint as well, this means trying to g_memdup() an