mirror of https://github.com/mpv-player/mpv
Rearrange code of grow_array to make it easier to extend.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29735 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
f6f8acc19a
commit
aa576e8fc0
|
@ -211,8 +211,9 @@ extern int dvdsub_id;
|
|||
static void grow_array(void *arrayp, int nelem, size_t elsize) {
|
||||
void **array = arrayp;
|
||||
void *oldp = *array;
|
||||
if (!(nelem & 31))
|
||||
*array = realloc(*array, (nelem + 32) * elsize);
|
||||
if (nelem & 31)
|
||||
return;
|
||||
*array = realloc(*array, (nelem + 32) * elsize);
|
||||
if (!*array)
|
||||
free(oldp);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue