mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-06 07:40:00 +08:00
Move ff_dynarray_add to lavu and make it public.
This commit is contained in:
@ -21,27 +21,6 @@
|
||||
#include "avformat.h"
|
||||
#include "internal.h"
|
||||
|
||||
/* add one element to a dynamic array */
|
||||
void ff_dynarray_add(intptr_t **tab_ptr, int *nb_ptr, intptr_t elem)
|
||||
{
|
||||
/* see similar ffmpeg.c:grow_array() */
|
||||
int nb, nb_alloc;
|
||||
intptr_t *tab;
|
||||
|
||||
nb = *nb_ptr;
|
||||
tab = *tab_ptr;
|
||||
if ((nb & (nb - 1)) == 0) {
|
||||
if (nb == 0)
|
||||
nb_alloc = 1;
|
||||
else
|
||||
nb_alloc = nb * 2;
|
||||
tab = av_realloc(tab, nb_alloc * sizeof(intptr_t));
|
||||
*tab_ptr = tab;
|
||||
}
|
||||
tab[nb++] = elem;
|
||||
*nb_ptr = nb;
|
||||
}
|
||||
|
||||
#define ISLEAP(y) (((y) % 4 == 0) && (((y) % 100) != 0 || ((y) % 400) == 0))
|
||||
#define LEAPS_COUNT(y) ((y)/4 - (y)/100 + (y)/400)
|
||||
|
||||
|
Reference in New Issue
Block a user