gmacros.h: offsetof is also available on MSVC

All versions since Visual C++ 2005 have this available, so we can just
use it for G_STRUCT_OFFSET.

See: https://msdn.microsoft.com/en-us/library/dz4y9b9a.aspx
This commit is contained in:
Nirbheek Chauhan 2016-07-11 18:17:34 +05:30 committed by Chun-wei Fan
parent b5258d9d76
commit 92e3189613

View File

@ -311,7 +311,7 @@
* fields through their offsets. * fields through their offsets.
*/ */
#if defined(__GNUC__) && __GNUC__ >= 4 #if (defined(__GNUC__) && __GNUC__ >= 4) || defined (_MSC_VER)
#define G_STRUCT_OFFSET(struct_type, member) \ #define G_STRUCT_OFFSET(struct_type, member) \
((glong) offsetof (struct_type, member)) ((glong) offsetof (struct_type, member))
#else #else