19 lines
		
	
	
		
			542 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			19 lines
		
	
	
		
			542 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
|   assert(allocator != NULL && src != NULL && dst != NULL);
 | |
| 
 | |
|   {ArrayType} *output = dst;
 | |
| 
 | |
|   if (src->count >= dst->capacity) {{
 | |
|     u64 new_capacity = wapp_misc_utils_u64_round_up_pow2(dst->capacity * 2);
 | |
|     output           = ({ArrayType} *)_array_alloc_capacity(allocator, new_capacity, src->item_size);
 | |
|     if (!output) {{
 | |
|       output = dst;
 | |
|       goto RETURN_{Tupper}_ARRAY_COPY_ALLOC;
 | |
|     }}
 | |
|   }}
 | |
| 
 | |
|   wapp_{Tlower}_array_clear(output);
 | |
|   wapp_{Tlower}_array_copy_capped(src, output);
 | |
| 
 | |
| RETURN_{Tupper}_ARRAY_COPY_ALLOC:
 | |
|   return output;
 |