diff options
author | Anton Khirnov <anton@khirnov.net> | 2017-03-30 18:02:39 +0300 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2017-04-26 10:05:28 +0300 |
commit | 04b0f0e371ff81b682274b574fb465ba4395c09f (patch) | |
tree | c7b303ca30e2ac9bfb6a946ae7ea1ed79a053a63 /libavutil/mem.c | |
parent | 3d69dd65c6771c28d3bf4e8e53a905aa8cd01fd9 (diff) |
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.
Diffstat (limited to 'libavutil/mem.c')
-rw-r--r-- | libavutil/mem.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libavutil/mem.c b/libavutil/mem.c index 0f506d3604..fd0ffd988c 100644 --- a/libavutil/mem.c +++ b/libavutil/mem.c @@ -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) |