Commit 857712e1 authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter
Browse files

don't NULL-terminate value-type arrays

2007-08-30  Juerg Billeter  <j@bitron.ch>

	* gobject/valacodegenerator.vala: don't NULL-terminate value-type arrays

svn path=/trunk/; revision=548
parent 233d3317
2007-08-30 Jürg Billeter <j@bitron.ch>
* gobject/valacodegenerator.vala: don't NULL-terminate value-type arrays
2007-08-30 Jürg Billeter <j@bitron.ch>
* vala/valamemberaccess.vala, vala/valasemanticanalyzer.vala: support
......
......@@ -1945,7 +1945,13 @@ public class Vala.CodeGenerator : CodeVisitor {
bool first = true;
CCodeExpression cexpr = null;
foreach (Expression size in expr.get_sizes ()) {
var csize = new CCodeBinaryExpression (CCodeBinaryOperator.PLUS, (CCodeExpression) size.ccodenode, new CCodeConstant ("1"));
CCodeExpression csize;
if (expr.element_type.data_type != null && expr.element_type.data_type.is_reference_type ()) {
// add extra item to have array NULL-terminated for all reference types
csize = new CCodeBinaryExpression (CCodeBinaryOperator.PLUS, (CCodeExpression) size.ccodenode, new CCodeConstant ("1"));
} else {
csize = (CCodeExpression) size.ccodenode;
}
if (first) {
cexpr = csize;
......
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