[vala] codegen: Fix uninitialized variable in constructors throwing errors



commit 835ebab7dbac51dd11b53d71caf1c7b2aded78c8
Author: Jürg Billeter <j bitron ch>
Date:   Fri Oct 8 20:23:21 2010 +0200

    codegen: Fix uninitialized variable in constructors throwing errors

 codegen/valaccodemethodmodule.vala |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/codegen/valaccodemethodmodule.vala b/codegen/valaccodemethodmodule.vala
index 89d216f..7d850a9 100644
--- a/codegen/valaccodemethodmodule.vala
+++ b/codegen/valaccodemethodmodule.vala
@@ -478,10 +478,10 @@ public class Vala.CCodeMethodModule : CCodeStructModule {
 
 				if (m is CreationMethod) {
 					if (in_gobject_creation_method) {
-						ccode.add_declaration ("%s *".printf (((Class) current_type_symbol).get_cname ()), new CCodeVariableDeclarator ("self"));
+						ccode.add_declaration ("%s *".printf (((Class) current_type_symbol).get_cname ()), new CCodeVariableDeclarator.zero ("self", new CCodeConstant ("NULL")));
 					} else if (is_gtypeinstance_creation_method (m)) {
 						var cl = (Class) m.parent_symbol;
-						ccode.add_declaration (cl.get_cname () + "*", new CCodeVariableDeclarator ("self"));
+						ccode.add_declaration (cl.get_cname () + "*", new CCodeVariableDeclarator.zero ("self", new CCodeConstant ("NULL")));
 
 						if (cl.is_fundamental ()) {
 							var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_type_create_instance"));



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