Ensure array count is set correctly when allocating
This commit is contained in:
@@ -125,6 +125,10 @@ GenericArray _array_append_alloc(const Allocator *allocator, GenericArray array,
|
||||
|
||||
_array_append_capped(output, value, item_size);
|
||||
|
||||
if ((flags & ARRAY_INIT_FILLED) == ARRAY_INIT_FILLED) {
|
||||
_array_set_count(output, _array_capacity(output));
|
||||
}
|
||||
|
||||
RETURN_ARRAY_APPEND_ALLOC:
|
||||
return output;
|
||||
}
|
||||
@@ -153,6 +157,10 @@ GenericArray _array_extend_alloc(const Allocator *allocator, GenericArray dst, c
|
||||
|
||||
_array_extend_capped(output, src, item_size);
|
||||
|
||||
if ((flags & ARRAY_INIT_FILLED) == ARRAY_INIT_FILLED) {
|
||||
_array_set_count(output, _array_capacity(output));
|
||||
}
|
||||
|
||||
RETURN_ARRAY_EXTEND_ALLOC:
|
||||
return output;
|
||||
}
|
||||
@@ -179,6 +187,10 @@ GenericArray _array_copy_alloc(const Allocator *allocator, GenericArray dst, con
|
||||
|
||||
_array_copy_capped(output, src, item_size);
|
||||
|
||||
if ((flags & ARRAY_INIT_FILLED) == ARRAY_INIT_FILLED) {
|
||||
_array_set_count(output, _array_capacity(output));
|
||||
}
|
||||
|
||||
RETURN_ARRAY_COPY_ALLOC:
|
||||
return output;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user