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> 2007-02-04 Jürg Billeter <j@bitron.ch>
* vala/parser.y: fix crash when parsing array creation expression * vala/parser.y: fix crash when parsing array creation expression
......
...@@ -1919,10 +1919,7 @@ public class Vala.CodeGenerator : CodeVisitor { ...@@ -1919,10 +1919,7 @@ public class Vala.CodeGenerator : CodeVisitor {
} else { } else {
unref_function = type.data_type.get_free_function (); 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)); var ccall = new CCodeFunctionCall (new CCodeIdentifier (unref_function));
ccall.add_argument (cvar); ccall.add_argument (cvar);
...@@ -2479,10 +2476,10 @@ public class Vala.CodeGenerator : CodeVisitor { ...@@ -2479,10 +2476,10 @@ public class Vala.CodeGenerator : CodeVisitor {
} }
var sizes = expr.get_sizes (); var sizes = expr.get_sizes ();
var gnew = new CCodeFunctionCall (new CCodeConstant ("g_new0")); var gnew = new CCodeFunctionCall (new CCodeIdentifier ("g_new0"));
gnew.add_argument (new CCodeIdentifier (expr.element_type.data_type.get_cname ())); gnew.add_argument (new CCodeIdentifier (expr.element_type.get_cname ()));
/* FIXME: had to add Expression cast due to possible compiler bug */ /* 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) { if (expr.initializer_list != null) {
var ce = new CCodeCommaExpression (); 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