diff options
author | Chris Robinson <[email protected]> | 2016-05-21 03:27:51 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2016-05-21 03:27:51 -0700 |
commit | 2e7ec3979aec71f11c45b737b77d58978cbee7e2 (patch) | |
tree | c931d2f9b55cc6803a00896f92793a58de8fdc11 /Alc/helpers.c | |
parent | 7bf64eaee0788b7eb64c7410384a9ee66f75c4ce (diff) |
Avoid using realloc in a number of places
Diffstat (limited to 'Alc/helpers.c')
-rw-r--r-- | Alc/helpers.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Alc/helpers.c b/Alc/helpers.c index 950a67bf..38a34939 100644 --- a/Alc/helpers.c +++ b/Alc/helpers.c @@ -759,9 +759,12 @@ ALboolean vector_reserve(char *ptr, size_t base_size, size_t obj_size, size_t ob /* Need to be explicit with the caller type's base size, because it * could have extra padding before the start of the array (that is, * sizeof(*vector_) may not equal base_size). */ - temp = realloc(*vecptr, base_size + obj_size*obj_count); + temp = al_calloc(16, base_size + obj_size*obj_count); if(temp == NULL) return AL_FALSE; + memcpy(((ALubyte*)temp)+base_size, ((ALubyte*)*vecptr)+base_size, + obj_size*old_size); + al_free(*vecptr); *vecptr = temp; (*vecptr)->Capacity = obj_count; (*vecptr)->Size = old_size; |