push_context (new EmitContext ());
push_function (function);
+ // only attempt to dup if length > 0, this consistently returns NULL
+ var clengthcheck = new CCodeBinaryExpression (CCodeBinaryOperator.GREATER_THAN, new CCodeIdentifier ("length"), new CCodeConstant ("0"));
+ ccode.open_if (clengthcheck);
+
if (requires_copy (array_type.element_type)) {
var cvardecl = new CCodeVariableDeclarator ("result");
CCodeFunctionCall gnew;
}
}
+ ccode.close ();
+ ccode.add_return (new CCodeIdentifier ("NULL"));
+
// append to file
cfile.add_function_declaration (function);