mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 11:30:18 +00:00
replace all realloc
This commit is contained in:
parent
6d2547723f
commit
6b0c96bb7c
@ -32,7 +32,7 @@ void c11_vector__reserve(c11_vector* self, int capacity) {
|
||||
if(capacity < 4) capacity = 4;
|
||||
if(capacity <= self->capacity) return;
|
||||
// self->elem_size * capacity may overflow
|
||||
self->data = realloc(self->data, (size_t)self->elem_size * (size_t)capacity);
|
||||
self->data = PK_REALLOC(self->data, (size_t)self->elem_size * (size_t)capacity);
|
||||
if(self->data == NULL) c11__abort("c11_vector__reserve(): out of memory");
|
||||
self->capacity = capacity;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user