History

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.

Andreas Rheinhardt committed 5 years ago

Commit 8d5de911 parent 1ea36504 files · +16 −7Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libavutil/mem.c +2 −0
  3. libavutil/mem.h +6 −5
  4. libavutil/version.h +5 −2
doc/APIchanges+3−0
@@ -14,6 +14,9 @@ libavutil: 2021-04-27 · 13 unmodified lines
1414
1515 API changes, most recent first:
1616
17+2021-09-20 - xxxxxxxxxx - lavu 57.6.100 - mem.h
18+ Deprecate av_mallocz_array() as it is identical to av_calloc().
19+
1720 2021-09-20 - xxxxxxxxxx - lavc 59.9.100 - avcodec.h
1821 Deprecate AVCodecContext.sub_text_format and the corresponding
1922 AVOptions. It is unused since the last major bump.
libavutil/mem.c+2−0
@@ -211,6 +211,7 @@ void *av_malloc_array(size_t nmemb, size_t size) · 210 unmodified lines
211211 return av_malloc(result);
212212 }
213213
214+#if FF_API_AV_MALLOCZ_ARRAY
214215 void *av_mallocz_array(size_t nmemb, size_t size)
215216 {
216217 size_t result;
@@ -218,6 +219,7 @@ void *av_mallocz_array(size_t nmemb, size_t size) · 1 unmodified line
218219 return NULL;
219220 return av_mallocz(result);
220221 }
222+#endif
221223
222224 void *av_realloc_array(void *ptr, size_t nmemb, size_t size)
223225 {
libavutil/mem.h+6−5
@@ -237,14 +237,15 @@ av_alloc_size(1, 2) void *av_malloc_array(size_t nmemb, size_t size); · 236 unmodified lines
237237 * @see av_mallocz()
238238 * @see av_malloc_array()
239239 */
240−av_alloc_size(1, 2) void *av_mallocz_array(size_t nmemb, size_t size);
240+void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib av_alloc_size(1, 2);
241241
242+#if FF_API_AV_MALLOCZ_ARRAY
242243 /**
243− * Equivalent of av_mallocz_array().
244− *
245− * Created for symmetry with the calloc() C function.
244+ * @deprecated use av_calloc()
246245 */
247−void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib;
246+attribute_deprecated
247+void *av_mallocz_array(size_t nmemb, size_t size) av_malloc_attrib av_alloc_size(1, 2);
248+#endif
248249
249250 /**
250251 * Allocate, reallocate, or free a block of memory.
libavutil/version.h+5−2
@@ -79,8 +79,8 @@ · 78 unmodified lines
7979 */
8080
8181 #define LIBAVUTIL_VERSION_MAJOR 57
82−#define LIBAVUTIL_VERSION_MINOR 5
83−#define LIBAVUTIL_VERSION_MICRO 101
82+#define LIBAVUTIL_VERSION_MINOR 6
83+#define LIBAVUTIL_VERSION_MICRO 100
8484
8585 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
8686 LIBAVUTIL_VERSION_MINOR, \
@@ -114,6 +114,9 @@ · 27 unmodified lines
114114 #ifndef FF_API_COLORSPACE_NAME
115115 #define FF_API_COLORSPACE_NAME (LIBAVUTIL_VERSION_MAJOR < 58)
116116 #endif
117+#ifndef FF_API_AV_MALLOCZ_ARRAY
118+#define FF_API_AV_MALLOCZ_ARRAY (LIBAVUTIL_VERSION_MAJOR < 58)
119+#endif
117120
118121 /**
119122 * @}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t