Commit 79b6f82e authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter
Browse files

use correct type cname in array creation expression, don't assume that all

2007-02-04  Jürg Billeter  <j@bitron.ch>

	* vala/valacodegenerator.vala: use correct type cname in array creation
	  expression, don't assume that all string arrays own their content

svn path=/trunk/; revision=186
parent 6e85636c
2007-02-04 Jürg Billeter <j@bitron.ch>
* vala/valacodegenerator.vala: use correct type cname in array creation
expression, don't assume that all string arrays own their content
2007-02-04 Jürg Billeter <j@bitron.ch>
* vala/parser.y: fix crash when parsing array creation expression
......
......@@ -1920,9 +1920,6 @@ public class Vala.CodeGenerator : CodeVisitor {
unref_function = type.data_type.get_free_function ();
}
if (type.data_type is Array && ((Array) type.data_type).element_type.name == "string") {
unref_function = "g_strfreev";
}
var ccall = new CCodeFunctionCall (new CCodeIdentifier (unref_function));
ccall.add_argument (cvar);
......@@ -2479,10 +2476,10 @@ public class Vala.CodeGenerator : CodeVisitor {
}
var sizes = expr.get_sizes ();
var gnew = new CCodeFunctionCall (new CCodeConstant ("g_new0"));
gnew.add_argument (new CCodeIdentifier (expr.element_type.data_type.get_cname ()));
var gnew = new CCodeFunctionCall (new CCodeIdentifier ("g_new0"));
gnew.add_argument (new CCodeIdentifier (expr.element_type.get_cname ()));
/* FIXME: had to add Expression cast due to possible compiler bug */
gnew.add_argument ((CCodeExpression)((Expression)sizes.first ().data).ccodenode);
gnew.add_argument ((CCodeExpression) ((Expression) sizes.first ().data).ccodenode);
if (expr.initializer_list != null) {
var ce = new CCodeCommaExpression ();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment