From: Jürg Billeter Date: Wed, 16 Feb 2011 12:22:12 +0000 (+0100) Subject: codegen: Use temporary variable for string concatenation X-Git-Tag: 0.11.7~58 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=b0f95faaa13211747d0bd30e91471886e039c744;p=thirdparty%2Fvala.git codegen: Use temporary variable for string concatenation --- diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala index e36b50716..bc8604e8b 100644 --- a/codegen/valaccodebasemodule.vala +++ b/codegen/valaccodebasemodule.vala @@ -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; }