]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Replace trivial get_ref_cexpression calls with copy_value
authorLuca Bruno <lucabru@src.gnome.org>
Thu, 5 May 2011 20:41:46 +0000 (22:41 +0200)
committerLuca Bruno <lucabru@src.gnome.org>
Thu, 5 May 2011 21:04:06 +0000 (23:04 +0200)
codegen/valaccodearraymodule.vala
codegen/valaccodecontrolflowmodule.vala
codegen/valagasyncmodule.vala

index 216d2f62acde94922b68dfdde387326f815e7748..d5622da7830e63c63f1a2a15bfa626916aad9d92 100644 (file)
@@ -525,7 +525,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
                                           new CCodeBinaryExpression (CCodeBinaryOperator.LESS_THAN, new CCodeIdentifier ("i"), new CCodeIdentifier ("length")),
                                           new CCodeUnaryExpression (CCodeUnaryOperator.POSTFIX_INCREMENT, new CCodeIdentifier ("i")));
 
-                       ccode.add_assignment (new CCodeElementAccess (new CCodeIdentifier ("result"), new CCodeIdentifier ("i")), get_ref_cexpression (array_type.element_type, new CCodeElementAccess (new CCodeIdentifier ("self"), new CCodeIdentifier ("i")), null, array_type));
+                       ccode.add_assignment (new CCodeElementAccess (new CCodeIdentifier ("result"), new CCodeIdentifier ("i")), copy_value (new GLibValue (array_type.element_type, new CCodeElementAccess (new CCodeIdentifier ("self"), new CCodeIdentifier ("i"))), null, array_type));
                        ccode.close ();
 
                        ccode.add_return (new CCodeIdentifier ("result"));
@@ -579,7 +579,7 @@ public class Vala.CCodeArrayModule : CCodeMethodCallModule {
                                           new CCodeUnaryExpression (CCodeUnaryOperator.POSTFIX_INCREMENT, new CCodeIdentifier ("i")));
 
 
-                       ccode.add_assignment (new CCodeElementAccess (new CCodeIdentifier ("dest"), new CCodeIdentifier ("i")), get_ref_cexpression (array_type.element_type, new CCodeElementAccess (new CCodeIdentifier ("self"), new CCodeIdentifier ("i")), null, array_type));
+                       ccode.add_assignment (new CCodeElementAccess (new CCodeIdentifier ("dest"), new CCodeIdentifier ("i")), copy_value (new GLibValue (array_type.element_type, new CCodeElementAccess (new CCodeIdentifier ("self"), new CCodeIdentifier ("i"))), null, array_type));
                } else {
                        cfile.add_include ("string.h");
 
index 375aed6035083043f609a9c914b45431121f7e7e..6d9c37eb6bdbad260b3e18e1a0a224c7eaac11f3 100644 (file)
@@ -328,7 +328,7 @@ public abstract class Vala.CCodeControlFlowModule : CCodeMethodModule {
                        CCodeExpression element_expr = new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, get_item);
 
                        if (stmt.type_reference.value_owned) {
-                               element_expr = get_ref_cexpression (stmt.type_reference, element_expr, null, new StructValueType (gvalue_type));
+                               element_expr = copy_value (new GLibValue (stmt.type_reference, element_expr), null, new StructValueType (gvalue_type));
                        }
 
                        visit_local_variable (stmt.element_variable);
index 143911f9fefcb9943320b1727f28a43443a47b88..8bcdfd8b52a2cfc2209921182586f698fb7d7277 100644 (file)
@@ -444,7 +444,7 @@ public class Vala.GAsyncModule : GSignalModule {
                        // structs are returned via out parameter
                        CCodeExpression cexpr = new CCodeMemberAccess.pointer (data_var, "result");
                        if (requires_copy (return_type)) {
-                               cexpr = get_ref_cexpression (return_type, cexpr, null, return_type);
+                               cexpr = copy_value (new GLibValue (return_type, cexpr), null, return_type);
                        }
                        ccode.add_assignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeIdentifier ("result")), cexpr);
                } else if (!(return_type is VoidType)) {