From: Jürg Billeter Date: Fri, 6 Aug 2010 14:59:45 +0000 (+0200) Subject: dova: Do not generate empty type structs for delegates X-Git-Tag: 0.9.5~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ffcb2a6428d5e10b58379c48374bb89674d9df69;p=thirdparty%2Fvala.git dova: Do not generate empty type structs for delegates --- diff --git a/codegen/valadovadelegatemodule.vala b/codegen/valadovadelegatemodule.vala index 9e361c43c..b0d4ed097 100644 --- a/codegen/valadovadelegatemodule.vala +++ b/codegen/valadovadelegatemodule.vala @@ -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)); diff --git a/codegen/valadovaobjectmodule.vala b/codegen/valadovaobjectmodule.vala index 809b6a04f..6e277b854 100644 --- a/codegen/valadovaobjectmodule.vala +++ b/codegen/valadovaobjectmodule.vala @@ -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"));