22 lines
651 B
Plaintext
22 lines
651 B
Plaintext
{ArrayType} *output = array;
|
|
|
|
if (!allocator || !array || !other) {{
|
|
goto RETURN_{Tupper}_ARRAY_EXTEND_ALLOC;
|
|
}}
|
|
|
|
u64 remaining_capacity = array->capacity - array->count;
|
|
if (other->count >= remaining_capacity) {{
|
|
u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(array->capacity * 2);
|
|
output = wapp_{Tlower}_array_alloc_capacity(allocator, new_capacity);
|
|
if (!output) {{
|
|
output = array;
|
|
goto RETURN_{Tupper}_ARRAY_EXTEND_ALLOC;
|
|
}}
|
|
wapp_{Tlower}_array_copy_capped(array, output);
|
|
}}
|
|
|
|
wapp_{Tlower}_array_extend_capped(output, other);
|
|
|
|
RETURN_{Tupper}_ARRAY_EXTEND_ALLOC:
|
|
return output;
|