You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
mem: uninline av_malloc(z)_array()
Inlining public functions hardcodes their implementation into the ABI, so it should be avoided unless there is a very good reason for it. No such reason exists in this case.
This commit is contained in:
@@ -138,6 +138,20 @@ int av_reallocp(void *ptr, size_t size)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *av_malloc_array(size_t nmemb, size_t size)
|
||||||
|
{
|
||||||
|
if (!size || nmemb >= INT_MAX / size)
|
||||||
|
return NULL;
|
||||||
|
return av_malloc(nmemb * size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *av_mallocz_array(size_t nmemb, size_t size)
|
||||||
|
{
|
||||||
|
if (!size || nmemb >= INT_MAX / size)
|
||||||
|
return NULL;
|
||||||
|
return av_mallocz(nmemb * size);
|
||||||
|
}
|
||||||
|
|
||||||
void *av_realloc_array(void *ptr, size_t nmemb, size_t size)
|
void *av_realloc_array(void *ptr, size_t nmemb, size_t size)
|
||||||
{
|
{
|
||||||
if (!size || nmemb >= INT_MAX / size)
|
if (!size || nmemb >= INT_MAX / size)
|
||||||
|
@@ -89,12 +89,7 @@ void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1);
|
|||||||
* be allocated.
|
* be allocated.
|
||||||
* @see av_malloc()
|
* @see av_malloc()
|
||||||
*/
|
*/
|
||||||
av_alloc_size(1, 2) static inline void *av_malloc_array(size_t nmemb, size_t size)
|
av_alloc_size(1, 2) void *av_malloc_array(size_t nmemb, size_t size);
|
||||||
{
|
|
||||||
if (!size || nmemb >= INT_MAX / size)
|
|
||||||
return NULL;
|
|
||||||
return av_malloc(nmemb * size);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate or reallocate a block of memory.
|
* Allocate or reallocate a block of memory.
|
||||||
@@ -202,12 +197,7 @@ void *av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1);
|
|||||||
* @see av_mallocz()
|
* @see av_mallocz()
|
||||||
* @see av_malloc_array()
|
* @see av_malloc_array()
|
||||||
*/
|
*/
|
||||||
av_alloc_size(1, 2) static inline void *av_mallocz_array(size_t nmemb, size_t size)
|
av_alloc_size(1, 2) void *av_mallocz_array(size_t nmemb, size_t size);
|
||||||
{
|
|
||||||
if (!size || nmemb >= INT_MAX / size)
|
|
||||||
return NULL;
|
|
||||||
return av_mallocz(nmemb * size);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Duplicate the string s.
|
* Duplicate the string s.
|
||||||
|
Reference in New Issue
Block a user