Fix incorrect size definitions where the tail array isn't a list of pointers
authorRaja R Harinath <harinath@hurrynot.org>
Tue, 11 Aug 2009 06:30:39 +0000 (06:30 -0000)
committerRaja R Harinath <harinath@hurrynot.org>
Tue, 11 Aug 2009 06:30:39 +0000 (06:30 -0000)
* class-internals.h (MONO_SIZEOF_MARSHAL_TYPE): Use offsetof to define size.
* domain-internals.h (MONO_SIZEOF_JIT_INFO): Likewise.
* metadata.h (MONO_SIZEOF_TYPE): Likewise.
* reflection.h (MONO_SIZEOF_CUSTOM_ATTR_INFO): Likewise.

svn path=/trunk/mono/; revision=139689

mono/metadata/ChangeLog
mono/metadata/class-internals.h
mono/metadata/domain-internals.h
mono/metadata/metadata.h
mono/metadata/reflection.h

index f5d22833d02d11a94047e03b9035a974ce25a326..5265750d1917078c10195cee688d0271e95a9003 100644 (file)
@@ -1,3 +1,13 @@
+2009-08-11  Raja R Harinath  <harinath@hurrynot.org>
+
+       Fix incorrect size definitions where the tail array isn't a list
+       of pointers
+       * class-internals.h (MONO_SIZEOF_MARSHAL_TYPE): Use offsetof to
+       define size.
+       * domain-internals.h (MONO_SIZEOF_JIT_INFO): Likewise.
+       * metadata.h (MONO_SIZEOF_TYPE): Likewise.
+       * reflection.h (MONO_SIZEOF_CUSTOM_ATTR_INFO): Likewise.
+
 2009-08-11 Gonzalo Paniagua Javier <gonzalo@novell.com>
 
        * reflection.h:
index 3cfa31ba3c1a681a7ee5573fb9b85f0ecb5d90a8..bbdbaeb2fa512790b0806f01ccf427198b1eefc1 100644 (file)
@@ -161,7 +161,7 @@ typedef struct {
        MonoMarshalField fields [MONO_ZERO_LEN_ARRAY];
 } MonoMarshalType;
 
-#define MONO_SIZEOF_MARSHAL_TYPE (sizeof (MonoMarshalType) - MONO_ZERO_LEN_ARRAY * SIZEOF_VOID_P)
+#define MONO_SIZEOF_MARSHAL_TYPE (offsetof (MonoMarshalType, fields))
 
 struct _MonoProperty {
        MonoClass *parent;
index 7ee7e0bebd295e1c1f254edf0e73d652bf06e668..1c4a01c56593c160ea2b48dcfc7ce41eba065167 100644 (file)
@@ -134,7 +134,7 @@ struct _MonoJitInfo {
        /* There is an optional MonoGenericJitInfo after the clauses */
 };
 
-#define MONO_SIZEOF_JIT_INFO (sizeof (struct _MonoJitInfo) - MONO_ZERO_LEN_ARRAY * SIZEOF_VOID_P)
+#define MONO_SIZEOF_JIT_INFO (offsetof (struct _MonoJitInfo, clauses))
 
 struct _MonoAppContext {
        MonoObject obj;
index b6e49af0fa362906a65b904c53da58a16a512b12..6c01ca76822318ffee6c2ccf4cdbd583b1d8f2e8 100644 (file)
@@ -349,7 +349,7 @@ struct _MonoType {
        MonoCustomMod modifiers [MONO_ZERO_LEN_ARRAY]; /* this may grow */
 };
 
-#define MONO_SIZEOF_TYPE (sizeof (struct _MonoType) - MONO_ZERO_LEN_ARRAY * SIZEOF_VOID_P)
+#define MONO_SIZEOF_TYPE (offsetof (struct _MonoType, modifiers))
 
 /*
  * This structure is an internal runtime detail: use the mono_signature_*
index e18dd797b892b80d3e7084617e15e6e6c1e20b2f..801c6a07ab978355c54a2edd887294a7ed83e8a3 100644 (file)
@@ -29,7 +29,7 @@ typedef struct {
        MonoCustomAttrEntry attrs [MONO_ZERO_LEN_ARRAY];
 } MonoCustomAttrInfo;
 
-#define MONO_SIZEOF_CUSTOM_ATTR_INFO (sizeof (MonoCustomAttrInfo) - MONO_ZERO_LEN_ARRAY * SIZEOF_VOID_P)
+#define MONO_SIZEOF_CUSTOM_ATTR_INFO (offsetof (MonoCustomAttrInfo, attrs))
 
 /* 
  * Information which isn't in the MonoMethod structure is stored here for