From: Luca Bruno Date: Tue, 14 Jun 2011 09:43:20 +0000 (+0200) Subject: codegen: Use create_temp_value in try_cast_value_to_type X-Git-Tag: 0.13.2~182 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9aa6a54cb53fc4759d9e1258f98709307ca160eb;p=thirdparty%2Fvala.git codegen: Use create_temp_value in try_cast_value_to_type --- diff --git a/codegen/valaccodebasemodule.vala b/codegen/valaccodebasemodule.vala index a09653e34..cfcb5a46d 100644 --- a/codegen/valaccodebasemodule.vala +++ b/codegen/valaccodebasemodule.vala @@ -4455,9 +4455,9 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator { len_call.add_argument (rv); append_array_length (expr, len_call); } else if (to is StructValueType) { - var temp_decl = get_temp_variable (to, true, null, true); - emit_temp_var (temp_decl); - var ctemp = get_variable_cexpression (temp_decl.name); + CodeNode node = expr != null ? (CodeNode) expr : to; + var temp_value = create_temp_value (to, true, node, true); + var ctemp = get_cvalue_ (temp_value); rv = new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, new CCodeCastExpression (rv, (new PointerType(to)).get_cname ())); var holds = new CCodeFunctionCall (new CCodeIdentifier ("G_VALUE_HOLDS"));