Go to the documentation of this file.
70 #if AV_GCC_VERSION_AT_LEAST(3,1)
71 #define av_malloc_attrib __attribute__((__malloc__))
73 #define av_malloc_attrib
91 #if AV_GCC_VERSION_AT_LEAST(4,3)
92 #define av_alloc_size(...) __attribute__((alloc_size(__VA_ARGS__)))
94 #define av_alloc_size(...)
221 void *
av_realloc_f(
void *ptr,
size_t nelem,
size_t elsize);
565 const uint8_t *elem_data);
int av_size_mult(size_t a, size_t b, size_t *r)
Multiply two size_t values checking for overflow.
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_memdup(const void *p, size_t size)
Duplicate a buffer with av_malloc().
void av_max_alloc(size_t max)
Set the maximum size that may be allocated in one block.
void * av_realloc_f(void *ptr, size_t nelem, size_t elsize)
Allocate, reallocate, or free a block of memory.
void av_memcpy_backptr(uint8_t *dst, int back, int cnt)
Overlapping memcpy() implementation.
void * av_malloc_array(size_t nmemb, size_t size)
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.
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
void av_freep(void *ptr)
Free a memory block which has been allocated with a function of av_malloc() or av_realloc() family,...
#define av_alloc_size(...)
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_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem)
Add the pointer to an element to a dynamic array.
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.
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
int av_reallocp_array(void *ptr, size_t nmemb, size_t size)
Allocate, reallocate an array through a pointer to a pointer.
#define av_warn_unused_result
void * av_mallocz(size_t size) av_malloc_attrib 1(1)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
void av_free(void *ptr)
Free a memory block which has been allocated with a function of av_malloc() or av_realloc() family.
void * av_malloc(size_t size) av_malloc_attrib 1(1)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
av_warn_unused_result int av_dynarray_add_nofree(void *tab_ptr, int *nb_ptr, void *elem)
Add an element to a dynamic array.
char * av_strdup(const char *s) av_malloc_attrib
Duplicate a string.
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_calloc(size_t nmemb, size_t size) av_malloc_attrib 1(1
Allocate a memory block for an array with av_mallocz().
char * av_strndup(const char *s, size_t len) av_malloc_attrib
Duplicate a substring of a string.
void void * av_realloc(void *ptr, size_t size) 1(2)
Allocate, reallocate, or free a block of memory.