90 #if defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1110 || defined(__SUNPRO_C) 91 #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v 92 #define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v 93 #elif defined(__TI_COMPILER_VERSION__) 94 #define DECLARE_ALIGNED(n,t,v) \ 95 AV_PRAGMA(DATA_ALIGN(v,n)) \ 96 t __attribute__((aligned(n))) v 97 #define DECLARE_ASM_CONST(n,t,v) \ 98 AV_PRAGMA(DATA_ALIGN(v,n)) \ 99 static const t __attribute__((aligned(n))) v 100 #elif defined(__GNUC__) 101 #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v 102 #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (n))) v 103 #elif defined(_MSC_VER) 104 #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v 105 #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v 107 #define DECLARE_ALIGNED(n,t,v) t v 108 #define DECLARE_ASM_CONST(n,t,v) static const t v 131 #if AV_GCC_VERSION_AT_LEAST(3,1) 132 #define av_malloc_attrib __attribute__((__malloc__)) 134 #define av_malloc_attrib 152 #if AV_GCC_VERSION_AT_LEAST(4,3) 153 #define av_alloc_size(...) __attribute__((alloc_size(__VA_ARGS__))) 155 #define av_alloc_size(...) 208 if (!size || nmemb >= INT_MAX / size)
228 if (!size || nmemb >= INT_MAX / size)
299 void *
av_realloc_f(
void *ptr,
size_t nelem,
size_t elsize);
403 void av_fast_malloc(
void *ptr,
unsigned int *size,
size_t min_size);
490 void *
av_memdup(
const void *p,
size_t size);
644 const uint8_t *elem_data);
670 if ((a | b) >= ((
size_t)1 << (
sizeof(
size_t) * 4)) && a && t / a != b)
void * av_realloc_f(void *ptr, size_t nelem, size_t elsize)
Allocate, reallocate, or free a block of memory.
void * av_realloc(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory.
void av_max_alloc(size_t max)
Set the maximum size that may be allocated in one block.
#define av_malloc_attrib
Function attribute denoting a malloc-like function.
Convenience header that includes libavutil's core.
Macro definitions for various function/variable attributes.
void * av_calloc(size_t nmemb, size_t size) av_malloc_attrib
Non-inlined equivalent of av_mallocz_array().
void av_memcpy_backptr(uint8_t *dst, int back, int cnt)
Overlapping memcpy() implementation.
av_warn_unused_result int av_dynarray_add_nofree(void *tab_ptr, int *nb_ptr, void *elem)
Add an element to a dynamic array.
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
Allocate, reallocate, or free an array.
void av_freep(void *ptr)
Free a memory block which has been allocated with a function of av_malloc() or av_realloc() family...
void * av_mallocz(size_t size) av_malloc_attrib
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
void * av_memdup(const void *p, size_t size)
Duplicate a buffer with av_malloc().
static void * av_mallocz_array(size_t nmemb, size_t size)
Allocate a memory block for an array with av_mallocz().
static void * av_malloc_array(size_t nmemb, size_t size)
Allocate a memory block for an array with av_malloc().
int av_reallocp_array(void *ptr, size_t nmemb, size_t size)
Allocate, reallocate, or free an array through a pointer to a pointer.
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_fast_mallocz(void *ptr, unsigned int *size, size_t min_size)
Allocate and clear a buffer, reusing the given one if large enough.
void * av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
Reallocate the given buffer if it is not large enough, otherwise do nothing.
av_warn_unused_result int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
char * av_strdup(const char *s) av_malloc_attrib
Duplicate a string.
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_free(void *ptr)
Free a memory block which has been allocated with a function of av_malloc() or av_realloc() family...
#define av_warn_unused_result
#define av_alloc_size(...)
Function attribute used on a function that allocates memory, whose size is given by the specified par...
static int av_size_mult(size_t a, size_t b, size_t *r)
Multiply two size_t values checking for overflow.
void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem)
Add the pointer to an element to a dynamic array.
void * av_malloc(size_t size) av_malloc_attrib
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
char * av_strndup(const char *s, size_t len) av_malloc_attrib
Duplicate a substring of a string.