Refresh the length of an array after it is passed to a method with the attribute `[CCode (array_length = false, array_null_terminated = true)]` as a `ref`
When an array is passed to a method with the attribute [CCode (array_length = false, array_null_terminated = true)]
as a ref
type, its original length will no longer be valid, for example:
void foo ([CCode (array_length = false, array_null_terminated = true)] ref string[] bar) {
bar = {"Hello", ",", "World", "!", null};
}
void main () {
string[] baz = {"test"};
foo (ref baz);
int length;
for (length = 0; baz[length] != null; length += 1);
print ("Actual length: %d, baz.length: %d\n", length, baz.length);
}
Output:
Actual length: 4, baz.length: 1
It may be necessary to consider using _vala_array_length
to refresh its length.
Maybe a special case of issue [#929 (closed)].