]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
dova: Fix main method with args parameter
authorJürg Billeter <j@bitron.ch>
Tue, 9 Aug 2011 12:10:42 +0000 (14:10 +0200)
committerJürg Billeter <j@bitron.ch>
Wed, 10 Aug 2011 12:05:33 +0000 (14:05 +0200)
codegen/valadovaobjectmodule.vala

index d0436b01c0697b05f8055825e8ba7f6464ed9545..f8ba003e931f1dbaad011f48d0e2dde8bcc82459 100644 (file)
@@ -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);