[FFmpeg-cvslog] avutil/mem: Deprecate av_mallocz_array()

Andreas Rheinhardt git at videolan.org
Mon Sep 20 03:15:33 EEST 2021


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Tue Sep 14 23:32:37 2021 +0200| [8d5de914d31ca95ab36e6b66177be435e5cebb3d] | committer: Andreas Rheinhardt

avutil/mem: Deprecate av_mallocz_array()

It does the same as av_calloc(), so one of them should be removed.
Given that av_calloc() has the shorter name, it is retained.

Reviewed-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8d5de914d31ca95ab36e6b66177be435e5cebb3d
---

 doc/APIchanges      |  3 +++
 libavutil/mem.c     |  2 ++
 libavutil/mem.h     | 11 ++++++-----
 libavutil/version.h |  7 +++++--
 4 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 5049d2d149..5b5c2a6f11 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,9 @@ libavutil:     2021-04-27
 
 API changes, most recent first:
 
+2021-09-20 - xxxxxxxxxx - lavu 57.6.100 - mem.h
+  Deprecate av_mallocz_array() as it is identical to av_calloc().
+
 2021-09-20 - xxxxxxxxxx - lavc 59.9.100 - avcodec.h
   Deprecate AVCodecContext.sub_text_format and the corresponding
   AVOptions. It is unused since the last major bump.
diff --git a/libavutil/mem.c b/libavutil/mem.c
index dcc75945d4..194d880587 100644
--- a/libavutil/mem.c
+++ b/libavutil/mem.c
@@ -211,6 +211,7 @@ void *av_malloc_array(size_t nmemb, size_t size)
     return av_malloc(result);
 }
 
+#if FF_API_AV_MALLOCZ_ARRAY
 void *av_mallocz_array(size_t nmemb, size_t size)
 {
     size_t result;
@@ -218,6 +219,7 @@ void *av_mallocz_array(size_t nmemb, size_t size)
         return NULL;
     return av_mallocz(result);
 }
+#endif
 
 void *av_realloc_array(void *ptr, size_t nmemb, size_t size)
 {
diff --git a/libavutil/mem.h b/libavutil/mem.h
index c7f8867a13..b9fe80738c 100644
--- a/libavutil/mem.h
+++ b/libavutil/mem.h
@@ -237,14 +237,15 @@ av_alloc_size(1, 2) void *av_malloc_array(size_t nmemb, size_t size);
  * @see av_mallocz()
  * @see av_malloc_array()
  */
-av_alloc_size(1, 2) void *av_mallocz_array(size_t nmemb, size_t size);
+void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib av_alloc_size(1, 2);
 
+#if FF_API_AV_MALLOCZ_ARRAY
 /**
- * Equivalent of av_mallocz_array().
- *
- * Created for symmetry with the calloc() C function.
+ * @deprecated use av_calloc()
  */
-void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib;
+attribute_deprecated
+void *av_mallocz_array(size_t nmemb, size_t size) av_malloc_attrib av_alloc_size(1, 2);
+#endif
 
 /**
  * Allocate, reallocate, or free a block of memory.
diff --git a/libavutil/version.h b/libavutil/version.h
index 1e6a80f86e..a62f73639b 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -79,8 +79,8 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR  57
-#define LIBAVUTIL_VERSION_MINOR   5
-#define LIBAVUTIL_VERSION_MICRO 101
+#define LIBAVUTIL_VERSION_MINOR   6
+#define LIBAVUTIL_VERSION_MICRO 100
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
                                                LIBAVUTIL_VERSION_MINOR, \
@@ -114,6 +114,9 @@
 #ifndef FF_API_COLORSPACE_NAME
 #define FF_API_COLORSPACE_NAME          (LIBAVUTIL_VERSION_MAJOR < 58)
 #endif
+#ifndef FF_API_AV_MALLOCZ_ARRAY
+#define FF_API_AV_MALLOCZ_ARRAY         (LIBAVUTIL_VERSION_MAJOR < 58)
+#endif
 
 /**
  * @}



More information about the ffmpeg-cvslog mailing list