]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
dova: Do not generate empty type structs for delegates
authorJürg Billeter <j@bitron.ch>
Fri, 6 Aug 2010 14:59:45 +0000 (16:59 +0200)
committerJürg Billeter <j@bitron.ch>
Fri, 6 Aug 2010 16:05:54 +0000 (18:05 +0200)
codegen/valadovadelegatemodule.vala
codegen/valadovaobjectmodule.vala

index 9e361c43ce657e72e432a3c2c8804a6cce790c7c..b0d4ed09716093408d2622fd6b3b41434bd4a963 100644 (file)
@@ -200,16 +200,12 @@ internal class Vala.DovaDelegateModule : DovaValueModule {
                generate_type_get_function (d, delegate_class);
 
                var instance_priv_struct = new CCodeStruct ("_%sPrivate".printf (d.get_cname ()));
-               var type_priv_struct = new CCodeStruct ("_%sTypePrivate".printf (d.get_cname ()));
 
                instance_priv_struct.add_field ("void", "(*method) (void)");
 
                source_declarations.add_type_declaration (new CCodeTypeDefinition ("struct %s".printf (instance_priv_struct.name), new CCodeVariableDeclarator ("%sPrivate".printf (d.get_cname ()))));
                source_declarations.add_type_definition (instance_priv_struct);
 
-               source_declarations.add_type_declaration (new CCodeTypeDefinition ("struct %s".printf (type_priv_struct.name), new CCodeVariableDeclarator ("%sTypePrivate".printf (d.get_cname ()))));
-               source_declarations.add_type_definition (type_priv_struct);
-
                string macro = "((%sPrivate *) (((char *) o) + _%s_object_offset))".printf (d.get_cname (), d.get_lower_case_cname ());
                source_declarations.add_type_member_declaration (new CCodeMacroReplacement ("%s_GET_PRIVATE(o)".printf (d.get_upper_case_cname (null)), macro));
 
index 809b6a04f0cb71c6e71f2a53daf4713b278be4db..6e277b85409f60e13cb56ad8e995b48511253bbc 100644 (file)
@@ -480,7 +480,7 @@ internal class Vala.DovaObjectModule : DovaArrayModule {
                        } else {
                                alloc_call.add_argument (new CCodeConstant ("0"));
                        }
-                       if (!(cl is Class) || has_type_struct ((Class) cl)) {
+                       if ((!(cl is Class) || has_type_struct ((Class) cl)) && !(cl is Delegate)) {
                                alloc_call.add_argument (new CCodeConstant ("sizeof (%sTypePrivate)".printf (cl.get_cname ())));
                        } else {
                                alloc_call.add_argument (new CCodeConstant ("0"));