ccall.add_argument (new CCodeConstant ("TRUE"));
} else if (type is ArrayType) {
var array_type = (ArrayType) type;
- if (requires_destroy (array_type.element_type) && !variable.no_array_length) {
+ if (requires_destroy (array_type.element_type)) {
CCodeExpression csizeexpr = null;
if (variable.array_null_terminated) {
var len_call = new CCodeFunctionCall (new CCodeIdentifier ("_vala_array_length"));
csizeexpr = len_call;
} else if (variable.has_array_length_cexpr) {
csizeexpr = new CCodeConstant (variable.get_array_length_cexpr ());
- } else {
+ } else if (!variable.no_array_length) {
bool first = true;
for (int dim = 1; dim <= array_type.rank; dim++) {
if (first) {
}
}
- var st = array_type.element_type.data_type as Struct;
- if (st != null && !array_type.element_type.nullable) {
- ccall.call = new CCodeIdentifier (append_struct_array_free (st));
- ccall.add_argument (csizeexpr);
- } else {
- requires_array_free = true;
- ccall.call = new CCodeIdentifier ("_vala_array_free");
- ccall.add_argument (csizeexpr);
- ccall.add_argument (new CCodeCastExpression (get_destroy_func_expression (array_type.element_type), "GDestroyNotify"));
+ if (csizeexpr != null) {
+ var st = array_type.element_type.data_type as Struct;
+ if (st != null && !array_type.element_type.nullable) {
+ ccall.call = new CCodeIdentifier (append_struct_array_free (st));
+ ccall.add_argument (csizeexpr);
+ } else {
+ requires_array_free = true;
+ ccall.call = new CCodeIdentifier ("_vala_array_free");
+ ccall.add_argument (csizeexpr);
+ ccall.add_argument (new CCodeCastExpression (get_destroy_func_expression (array_type.element_type), "GDestroyNotify"));
+ }
}
}
}