]> git.sesse.net Git - ffmpeg/commitdiff
mem: uninline av_malloc(z)_array()
authorAnton Khirnov <anton@khirnov.net>
Thu, 30 Mar 2017 15:02:39 +0000 (17:02 +0200)
committerAnton Khirnov <anton@khirnov.net>
Wed, 26 Apr 2017 07:05:28 +0000 (09:05 +0200)
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.

libavutil/mem.c
libavutil/mem.h

index 0f506d360468c2d6750c384a4723b8e013c5fa9d..fd0ffd988c925da59d64a2a356c5ea0006ed212e 100644 (file)
@@ -138,6 +138,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)
index f3cf56c498f45f24f334a1ba9d80847fdc0314ea..a03ba2f528b9a3f39996c4c8d7ed8a292130ca82 100644 (file)
@@ -89,12 +89,7 @@ void *av_malloc(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 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_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);
 
 /**
  * Duplicate the string s.