From: Jürg Billeter Date: Tue, 23 Feb 2010 19:13:26 +0000 (+0100) Subject: Clear array ouptut parameters X-Git-Tag: 0.8.0~254 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f23f243cf2a250a01666aa7a88b5d21d7073cb29;p=thirdparty%2Fvala.git Clear array ouptut parameters --- diff --git a/codegen/valaccodemethodmodule.vala b/codegen/valaccodemethodmodule.vala index e83eb84c0..f7b30ae47 100644 --- a/codegen/valaccodemethodmodule.vala +++ b/codegen/valaccodemethodmodule.vala @@ -531,15 +531,18 @@ internal class Vala.CCodeMethodModule : CCodeStructModule { break; } - var t = param.parameter_type.data_type; - if (t != null && t.is_reference_type ()) { - if (param.direction != ParameterDirection.OUT) { + if (param.direction != ParameterDirection.OUT) { + var t = param.parameter_type.data_type; + if (t != null && t.is_reference_type ()) { var type_check = create_method_type_check_statement (m, creturn_type, t, !param.parameter_type.nullable, get_variable_cname (param.name)); if (type_check != null) { type_check.line = function.line; cinit.append (type_check); } - } else if (!m.coroutine) { + } + } else if (!m.coroutine) { + var t = param.parameter_type.data_type; + if ((t != null && t.is_reference_type ()) || param.parameter_type is ArrayType) { // ensure that the passed reference for output parameter is cleared var a = new CCodeAssignment (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, get_variable_cexpression (param.name)), new CCodeConstant ("NULL")); var cblock = new CCodeBlock ();