[vala] dova: Do not generate empty type structs for delegates



commit ffcb2a6428d5e10b58379c48374bb89674d9df69
Author: Jürg Billeter <j bitron ch>
Date:   Fri Aug 6 16:59:45 2010 +0200

    dova: Do not generate empty type structs for delegates

 codegen/valadovadelegatemodule.vala |    4 ----
 codegen/valadovaobjectmodule.vala   |    2 +-
 2 files changed, 1 insertions(+), 5 deletions(-)
---
diff --git a/codegen/valadovadelegatemodule.vala b/codegen/valadovadelegatemodule.vala
index 9e361c4..b0d4ed0 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 809b6a0..6e277b8 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"));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]