[glib: 1/4] gmacros: make _GLIB_DEFINE_AUTOPTR_CHAINUP to define funcs for g_autolist
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/4] gmacros: make _GLIB_DEFINE_AUTOPTR_CHAINUP to define funcs for g_autolist
- Date: Thu, 15 Nov 2018 10:25:58 +0000 (UTC)
commit d58be1bda9b270a618f341bf7d9b0dd88702482c
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Tue Oct 23 18:02:03 2018 -0500
gmacros: make _GLIB_DEFINE_AUTOPTR_CHAINUP to define funcs for g_autolist
Also chainup to glib_(s)listautoptr_cleanup_* parent functions
to make g_autolist work with object defined in this way
glib/gmacros.h | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/glib/gmacros.h b/glib/gmacros.h
index 1f5788020..28a01a33f 100644
--- a/glib/gmacros.h
+++ b/glib/gmacros.h
@@ -497,9 +497,17 @@
#define _GLIB_AUTO_FUNC_NAME(TypeName) glib_auto_cleanup_##TypeName
#define _GLIB_CLEANUP(func) __attribute__((cleanup(func)))
#define _GLIB_DEFINE_AUTOPTR_CHAINUP(ModuleObjName, ParentName) \
- typedef ModuleObjName *_GLIB_AUTOPTR_TYPENAME(ModuleObjName); \
- static inline void _GLIB_AUTOPTR_FUNC_NAME(ModuleObjName) (ModuleObjName **_ptr) { \
- _GLIB_AUTOPTR_FUNC_NAME(ParentName) ((ParentName **) _ptr); } \
+ typedef ModuleObjName *_GLIB_AUTOPTR_TYPENAME(ModuleObjName);
\
+ typedef GList *_GLIB_AUTOPTR_LIST_TYPENAME(ModuleObjName);
\
+ typedef GSList *_GLIB_AUTOPTR_SLIST_TYPENAME(ModuleObjName);
\
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
\
+ static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_FUNC_NAME(ModuleObjName) (ModuleObjName **_ptr) {
\
+ _GLIB_AUTOPTR_FUNC_NAME(ParentName) ((ParentName **) _ptr); }
\
+ static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_LIST_FUNC_NAME(ModuleObjName) (GList **_l) {
\
+ _GLIB_AUTOPTR_LIST_FUNC_NAME(ParentName) (_l); }
\
+ static G_GNUC_UNUSED inline void _GLIB_AUTOPTR_SLIST_FUNC_NAME(ModuleObjName) (GSList **_l) {
\
+ _GLIB_AUTOPTR_SLIST_FUNC_NAME(ParentName) (_l); }
\
+ G_GNUC_END_IGNORE_DEPRECATIONS
\
/* these macros are API */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]