From 48c7900d68747a0d49f87167a60e596c4a8d2ef4 Mon Sep 17 00:00:00 2001 From: WaLyong Cho Date: Tue, 8 Nov 2016 16:46:58 +0900 Subject: [PATCH] libsystem: glib-util: wipe out _cleanup_g_xxx_ Recent glib supports g_auto(), g_autoptr() and g_autofree. Change-Id: Iddaa0ef550c6c115cd8fa0359f358091504d7111 Signed-off-by: WaLyong Cho --- src/libsystem/glib-util.h | 85 --------------------------------------- 1 file changed, 85 deletions(-) diff --git a/src/libsystem/glib-util.h b/src/libsystem/glib-util.h index b87ebdf..7d3c7ad 100644 --- a/src/libsystem/glib-util.h +++ b/src/libsystem/glib-util.h @@ -38,91 +38,6 @@ extern "C" { #endif - -/** - * gchar free function. This function has to not be called - * directly. If a gchar value is declared with #_cleanup_g_free_, this - * function is called when the value goes out of scope. - */ -static inline void __g_free(gchar **p) { - if (*p) - g_free(*p); -} - -/** - * GError free function. This function has to not be called - * directly. If a GError value is declared with - * #_cleanup_g_error_free_, this function is called when the value - * goes out of scope. - */ -static inline void __g_error_free(GError **e) { - if (*e) - g_error_free(*e); -} - -/** - * GObject free function. This function has to not be called - * directly. If a GObject value is declared with - * #_cleanup_g_object_unref_, this function is called when the value - * goes out of scope. - */ -static inline void __g_object_unref(gpointer p) { - if (p) - g_object_unref(*(gpointer *) p); -} - -/** - * GVariant free function. This function has to not be called - * directly. If a GVariant value is declared with - * #_cleanup_g_variant_unref_, this function is called when the value - * goes out of scope. - */ -static inline void __g_variant_unref(GVariant **v) { - if (*v) - g_variant_unref(*v); -} - -/** - * GVariantIter free function. This function has to not be called - * directly. If a GVariantIter value is declared with - * #_cleanup_g_variant_iter_free_, this function is called when the - * value goes out of scope. - */ -static inline void __g_variant_iter_free(GVariantIter **i) { - if (*i) - g_variant_iter_free(*i); -} - -/** - * cleanup attribute for gchar to run #__g_free() when the value is - * going out of scope. - */ -#define _cleanup_g_free_ _cleanup_(__g_free) - -/** - * cleanup attribute for GError to run #__g_error_free() when the - * value is going out of scope. - */ -#define _cleanup_g_error_free_ _cleanup_(__g_error_free) - -/** - * cleanup attribute for GObject to run #__g_object_unref() when the - * value is going out of scope. - */ -#define _cleanup_g_object_unref_ _cleanup_(__g_object_unref) - -/** - * cleanup attribute for GVariant to run #__g_variant_unref() when the - * value is going out of scope. - */ -#define _cleanup_g_variant_unref_ _cleanup_(__g_variant_unref) - -/** - * cleanup attribute for GVariantIter to run #__g_variant_iter_free() - * when the value is going out of scope. - */ -#define _cleanup_g_variant_iter_free_ _cleanup_(__g_variant_iter_free) - /** * @brief Iterate for each list nodes. * -- 2.34.1