[glib] G_DECLARE_DERIVED_TYPE: allow forward declarations
- From: Ryan Lortie <desrt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] G_DECLARE_DERIVED_TYPE: allow forward declarations
- Date: Wed, 28 Jan 2015 13:23:17 +0000 (UTC)
commit f3c604d2735fd63c5d45ecbeff9cb0e90d3356ac
Author: Christian Hergert <christian hergert me>
Date: Tue Jan 27 18:50:04 2015 +0000
G_DECLARE_DERIVED_TYPE: allow forward declarations
This allows multiple declarations such as:
typedef struct _Foo Foo;
as is needed when you have systems with circular referencing.
https://bugzilla.gnome.org/show_bug.cgi?id=743596
gobject/gtype.h | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/gobject/gtype.h b/gobject/gtype.h
index 6f3f808..3dc3d9c 100644
--- a/gobject/gtype.h
+++ b/gobject/gtype.h
@@ -1464,8 +1464,9 @@ guint g_type_get_type_registration_serial (void);
**/
#define G_DECLARE_DERIVABLE_TYPE(ModuleObjName, module_obj_name, MODULE, OBJ_NAME, ParentName) \
GType module_obj_name##_get_type (void); \
- typedef struct { ParentName parent_instance; } ModuleObjName; \
+ typedef struct _##ModuleObjName ModuleObjName; \
typedef struct _##ModuleObjName##Class ModuleObjName##Class; \
+ struct _##ModuleObjName { ParentName parent_instance; }; \
\
static inline ModuleObjName * MODULE##_##OBJ_NAME (gpointer ptr) { \
return G_TYPE_CHECK_INSTANCE_CAST (ptr, module_obj_name##_get_type (), ModuleObjName); } \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]