mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-21 12:00:18 +00:00
fix c11_vector__extend
This commit is contained in:
parent
ffbc7e9ade
commit
c3646b65ad
@ -41,7 +41,9 @@ void c11_vector__swap(c11_vector* self, c11_vector* other);
|
||||
|
||||
#define c11_vector__extend(T, self, p, size) \
|
||||
do { \
|
||||
c11_vector__reserve((self), (self)->length + (size)); \
|
||||
int min_capacity = (self)->length + (size); \
|
||||
if((self)->capacity < min_capacity) \
|
||||
c11_vector__reserve((self), c11__max((self)->capacity * 2, min_capacity)); \
|
||||
memcpy((T*)(self)->data + (self)->length, (p), (size) * sizeof(T)); \
|
||||
(self)->length += (size); \
|
||||
} while(0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user