[vala] dova: Fix main method with args parameter



commit cd8ff5d711649552b1777274bdc367cf8290628e
Author: JÃrg Billeter <j bitron ch>
Date:   Tue Aug 9 14:10:42 2011 +0200

    dova: Fix main method with args parameter

 codegen/valadovaobjectmodule.vala |   14 +++-----------
 1 files changed, 3 insertions(+), 11 deletions(-)
---
diff --git a/codegen/valadovaobjectmodule.vala b/codegen/valadovaobjectmodule.vala
index d0436b0..f8ba003 100644
--- a/codegen/valadovaobjectmodule.vala
+++ b/codegen/valadovaobjectmodule.vala
@@ -1673,16 +1673,15 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 			if (m.get_parameters ().size == 1) {
 				// create Dova array from C array
 				// should be replaced by Dova list
-				var array_creation = new CCodeFunctionCall (new CCodeIdentifier ("dova_array_new"));
+				var array_creation = new CCodeFunctionCall (new CCodeIdentifier ("dova_array_create"));
 				array_creation.add_argument (new CCodeFunctionCall (new CCodeIdentifier ("string_type_get")));
 				array_creation.add_argument (new CCodeIdentifier ("argc"));
 
-				cdecl = new CCodeDeclaration ("DovaArray*");
+				cdecl = new CCodeDeclaration ("DovaArray");
 				cdecl.add_declarator (new CCodeVariableDeclarator ("args", array_creation));
 				ccode.add_statement (cdecl);
 
-				var array_data = new CCodeFunctionCall (new CCodeIdentifier ("dova_array_get_data"));
-				array_data.add_argument (new CCodeIdentifier ("args"));
+				var array_data = new CCodeMemberAccess (new CCodeIdentifier ("args"), "data");
 
 				cdecl = new CCodeDeclaration ("string_t*");
 				cdecl.add_declarator (new CCodeVariableDeclarator ("args_data", array_data));
@@ -1717,13 +1716,6 @@ public class Vala.DovaObjectModule : DovaArrayModule {
 				ccode.add_statement (main_stmt);
 			}
 
-			if (m.get_parameters ().size == 1) {
-				// destroy Dova array
-				var unref = new CCodeFunctionCall (new CCodeIdentifier ("dova_object_unref"));
-				unref.add_argument (new CCodeIdentifier ("args"));
-				ccode.add_statement (new CCodeExpressionStatement (unref));
-			}
-
 			var ret_stmt = new CCodeReturnStatement (new CCodeIdentifier ("result"));
 			ret_stmt.line = cmain.line;
 			ccode.add_statement (ret_stmt);



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