From ccecab4a0d7f3f4f296551c2e22bbf12af7d14e8 Mon Sep 17 00:00:00 2001 From: Laurent Aimar Date: Sat, 24 Sep 2011 18:39:13 +0200 Subject: Add av_calloc() helper. Signed-off-by: Michael Niedermayer --- libavutil/mem.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'libavutil/mem.h') diff --git a/libavutil/mem.h b/libavutil/mem.h index 8fdf5b3a4d..1711b18658 100644 --- a/libavutil/mem.h +++ b/libavutil/mem.h @@ -106,6 +106,18 @@ void av_free(void *ptr); */ void *av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1); +/** + * Allocate a block of nmemb * size bytes with alignment suitable for all + * memory accesses (including vectors if available on the CPU) and + * zero all the bytes of the block. + * The allocation will fail if nmemb * size is greater than or equal + * to INT_MAX. + * @param nmemb + * @param size + * @return Pointer to the allocated block, NULL if it cannot be allocated. + */ +void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib; + /** * Duplicate the string s. * @param s string to be duplicated -- cgit v1.2.3