]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Use temporary variable for string concatenation
authorJürg Billeter <j@bitron.ch>
Wed, 16 Feb 2011 12:22:12 +0000 (13:22 +0100)
committerJürg Billeter <j@bitron.ch>
Tue, 22 Feb 2011 14:58:29 +0000 (15:58 +0100)
codegen/valaccodebasemodule.vala

index e36b50716e73b85f3be75257c95babc9d6892447..bc8604e8b746ce6d8725f83570c2402570f2f562 100644 (file)
@@ -4994,11 +4994,17 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                                set_cvalue (expr, strcat);
                                        } else {
                                                // convert to g_strconcat (a, b, NULL)
+                                               var temp_var = get_temp_variable (expr.value_type, true, null, false);
+                                               var temp_ref = get_variable_cexpression (temp_var.name);
+                                               emit_temp_var (temp_var);
+
                                                var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_strconcat"));
                                                ccall.add_argument (cleft);
                                                ccall.add_argument (cright);
                                                ccall.add_argument (new CCodeConstant("NULL"));
-                                               set_cvalue (expr, ccall);
+
+                                               ccode.add_assignment (temp_ref, ccall);
+                                               set_cvalue (expr, temp_ref);
                                        }
                                        return;
                                }