42 #if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C)
43 #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
44 #define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v
45 #elif defined(__TI_COMPILER_VERSION__)
46 #define DECLARE_ALIGNED(n,t,v) \
47 AV_PRAGMA(DATA_ALIGN(v,n)) \
48 t __attribute__((aligned(n))) v
49 #define DECLARE_ASM_CONST(n,t,v) \
50 AV_PRAGMA(DATA_ALIGN(v,n)) \
51 static const t __attribute__((aligned(n))) v
52 #elif defined(__GNUC__)
53 #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
54 #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (n))) v
55 #elif defined(_MSC_VER)
56 #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v
57 #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v
59 #define DECLARE_ALIGNED(n,t,v) t v
60 #define DECLARE_ASM_CONST(n,t,v) static const t v
63 #if AV_GCC_VERSION_AT_LEAST(3,1)
64 #define av_malloc_attrib __attribute__((__malloc__))
66 #define av_malloc_attrib
69 #if AV_GCC_VERSION_AT_LEAST(4,3)
70 #define av_alloc_size(...) __attribute__((alloc_size(__VA_ARGS__)))
72 #define av_alloc_size(...)
95 if (!size || nmemb >= INT_MAX / size)
128 void *
av_realloc_f(
void *ptr,
size_t nelem,
size_t elsize);
230 if (!size || nmemb >= INT_MAX / size)
342 if ((a | b) >= ((
size_t)1 << (
sizeof(
size_t) * 4)) && a && t / a != b)
void * av_malloc(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
void * av_realloc_f(void *ptr, size_t nelem, size_t elsize)
Allocate or reallocate a block of memory.
void * av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size, const uint8_t *elem_data)
Add an element of size elem_size to a dynamic array.
void av_max_alloc(size_t max)
Set the maximum size that may me allocated in one block.
Macro definitions for various function/variable attributes.
void av_freep(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
int av_dynarray_add_nofree(void *tab_ptr, int *nb_ptr, void *elem)
Add an element to a dynamic array.
int av_reallocp(void *ptr, size_t size)
Allocate or reallocate a block of memory.
#define av_alloc_size(...)
char * av_strndup(const char *s, size_t len) av_malloc_attrib
Duplicate a substring of the string s.
int av_reallocp_array(void *ptr, size_t nmemb, size_t size)
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
void * av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
Reallocate the given block if it is not large enough, otherwise do nothing.
void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem)
Add an element to a dynamic array.
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
static int av_size_mult(size_t a, size_t b, size_t *r)
Multiply two size_t values checking for overflow.
void * av_memdup(const void *p, size_t size)
Duplicate the buffer p.
char * av_strdup(const char *s) av_malloc_attrib
Duplicate the string s.
void * av_calloc(size_t nmemb, size_t size) av_malloc_attrib
Allocate a block of nmemb * size bytes with alignment suitable for all memory accesses (including vec...
static void * av_malloc_array(size_t nmemb, size_t size)
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
void * av_realloc(void *ptr, size_t size) 1(2)
Allocate or reallocate a block of memory.
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
static void * av_mallocz_array(size_t nmemb, size_t size)
void av_memcpy_backptr(uint8_t *dst, int back, int cnt)
deliberately overlapping memcpy implementation
void * av_mallocz(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...