46 #define malloc AV_JOIN(MALLOC_PREFIX, malloc)
47 #define memalign AV_JOIN(MALLOC_PREFIX, memalign)
48 #define posix_memalign AV_JOIN(MALLOC_PREFIX, posix_memalign)
49 #define realloc AV_JOIN(MALLOC_PREFIX, realloc)
50 #define free AV_JOIN(MALLOC_PREFIX, free)
53 void *memalign(
size_t align,
size_t size);
54 int posix_memalign(
void **ptr,
size_t align,
size_t size);
67 #if CONFIG_MEMALIGN_HACK
72 if(size > (INT_MAX-32) )
75 #if CONFIG_MEMALIGN_HACK
79 diff= ((-(long)ptr - 1)&31) + 1;
80 ptr = (
char*)ptr + diff;
81 ((
char*)ptr)[-1]= diff;
82 #elif HAVE_POSIX_MEMALIGN
83 if (posix_memalign(&ptr,32,size))
86 ptr = memalign(32,size);
119 #if CONFIG_MEMALIGN_HACK
124 if(size > (INT_MAX-16) )
127 #if CONFIG_MEMALIGN_HACK
130 diff= ((
char*)ptr)[-1];
131 return (
char*)
realloc((
char*)ptr - diff, size + diff) + diff;
139 #if CONFIG_MEMALIGN_HACK
141 free((
char*)ptr - ((
char*)ptr)[-1]);
149 void **ptr= (
void**)arg;
158 memset(ptr, 0, size);
166 int len = strlen(s) + 1;
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
memory handling functions
void * av_realloc(void *ptr, size_t size)
Allocate or reallocate a block of memory.
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
char * av_strdup(const char *s)
Duplicate the string s.
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...