libsystem: glib-util: wipe out _cleanup_g_xxx_
authorWaLyong Cho <walyong.cho@samsung.com>
Tue, 8 Nov 2016 07:46:58 +0000 (16:46 +0900)
committerWaLyong Cho <walyong.cho@samsung.com>
Tue, 8 Nov 2016 07:46:58 +0000 (16:46 +0900)
Recent glib supports g_auto(), g_autoptr() and g_autofree.

Change-Id: Iddaa0ef550c6c115cd8fa0359f358091504d7111
Signed-off-by: WaLyong Cho <walyong.cho@samsung.com>
src/libsystem/glib-util.h

index b87ebdf77e45336143a4ee2633bdbc2a00835010..7d3c7adb524aeabcc30d56c82925ab542716e5de 100644 (file)
 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.
  *