aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2017-10-30 16:08:14 -0300
committerJames Almer <jamrial@gmail.com>2017-10-30 16:08:14 -0300
commit4959f18a8e11ad7d3529b1c4fc429f1b6b76ad7c (patch)
tree9154851bfccf366ea5fd13b9de33dfd9ecc22cd3
parentf9c3fbc00cd6c8887e0e66cec275ade881130adf (diff)
parent04b0f0e371ff81b682274b574fb465ba4395c09f (diff)
downloadffmpeg-4959f18a8e11ad7d3529b1c4fc429f1b6b76ad7c.tar.gz
Merge commit '04b0f0e371ff81b682274b574fb465ba4395c09f'
* commit '04b0f0e371ff81b682274b574fb465ba4395c09f': mem: uninline av_malloc(z)_array() Merged-by: James Almer <jamrial@gmail.com>
-rw-r--r--libavutil/mem.c14
-rw-r--r--libavutil/mem.h14
2 files changed, 16 insertions, 12 deletions
diff --git a/libavutil/mem.c b/libavutil/mem.c
index 36740f1154..6ad409daf4 100644
--- a/libavutil/mem.c
+++ b/libavutil/mem.c
@@ -181,6 +181,20 @@ int av_reallocp(void *ptr, size_t size)
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)
{
if (!size || nmemb >= INT_MAX / size)
diff --git a/libavutil/mem.h b/libavutil/mem.h
index 527cd03191..49d4b1f2db 100644
--- a/libavutil/mem.h
+++ b/libavutil/mem.h
@@ -206,12 +206,7 @@ void *av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1);
* be allocated
* @see av_malloc()
*/
-av_alloc_size(1, 2) static inline void *av_malloc_array(size_t nmemb, size_t size)
-{
- if (!size || nmemb >= INT_MAX / size)
- return NULL;
- return av_malloc(nmemb * size);
-}
+av_alloc_size(1, 2) void *av_malloc_array(size_t nmemb, size_t size);
/**
* Allocate a memory block for an array with av_mallocz().
@@ -226,12 +221,7 @@ av_alloc_size(1, 2) static inline void *av_malloc_array(size_t nmemb, size_t siz
* @see av_mallocz()
* @see av_malloc_array()
*/
-av_alloc_size(1, 2) static inline void *av_mallocz_array(size_t nmemb, size_t size)
-{
- if (!size || nmemb >= INT_MAX / size)
- return NULL;
- return av_mallocz(nmemb * size);
-}
+av_alloc_size(1, 2) void *av_mallocz_array(size_t nmemb, size_t size);
/**
* Non-inlined equivalent of av_mallocz_array().