[vlc-devel] commit: VLC_OBJECT: expansion safety ( Rémi Denis-Courmont )

git version control git at videolan.org
Wed Aug 13 22:07:02 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Wed Aug 13 23:09:12 2008 +0300| [3bb56008ec124501d7d3a6dc705f625bc37b1677] | committer: Rémi Denis-Courmont 

VLC_OBJECT: expansion safety

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3bb56008ec124501d7d3a6dc705f625bc37b1677
---

 include/vlc_common.h |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/vlc_common.h b/include/vlc_common.h
index 1e7bbf1..8b1c32b 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -532,8 +532,12 @@ typedef struct vlc_object_internals_t vlc_object_internals_t;
 /**@}*/                                                                     \
 
 /* VLC_OBJECT: attempt at doing a clever cast */
-#define VLC_OBJECT( x ) \
-    (((vlc_object_t *)(x))+0*(x)->be_sure_to_add_VLC_COMMON_MEMBERS_to_struct)
+#ifdef __GNUC__
+# define VLC_OBJECT( x ) \
+    (((vlc_object_t *)(x))+0*(((typeof(x))0)->be_sure_to_add_VLC_COMMON_MEMBERS_to_struct))
+#else
+# define VLC_OBJECT( x ) ((vlc_object_t *)(x))
+#endif
 
 #define VLC_GC_MEMBERS                                                       \
 /** \name VLC_GC_MEMBERS                                                     \




More information about the vlc-devel mailing list