From b2edcdc939bbc0197dbbed8da044d1ecd76aae0b Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Mon, 19 Mar 2018 11:21:59 +0100 Subject: [PATCH] shared/nm-glib: add compat implementation for g_autofree Eventually, we should replace our uses of libgsystem's gsystem-local-alloc.h by glib's g_auto*. As a first tiny step, add a compat implementation for g_autofree, so that we could at least go ahead and use it instead of gs_free. https://bugzilla.gnome.org/show_bug.cgi?id=794294 --- shared/nm-utils/nm-glib.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/shared/nm-utils/nm-glib.h b/shared/nm-utils/nm-glib.h index b20e978f45..f1498dc4ee 100644 --- a/shared/nm-utils/nm-glib.h +++ b/shared/nm-utils/nm-glib.h @@ -114,4 +114,12 @@ _nm_g_strv_contains (const gchar * const *strv, #define g_object_ref_sink(Obj) ((typeof(Obj)) g_object_ref_sink (Obj)) #endif +#ifndef g_autofree +/* we still don't rely on recent glib to provide g_autofree. Hence, we continue + * to use our gs_* free macros that we took from libgsystem. + * + * To ease migration towards g_auto*, add a compat define for g_autofree. */ +#define g_autofree gs_free +#endif + #endif /* __NM_GLIB_H__ */