summaryrefslogtreecommitdiff
path: root/libavutil/mem.h
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-06-05 11:19:16 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-06-05 11:19:16 +0200
commit30b491f1c99aa7992157791a98d6cdae6ca2e895 (patch)
tree816c548897f653bb339ff22848c4b6bb5858b4ea /libavutil/mem.h
parentea038b996d5662702b2247a6aa919dee1cebc0be (diff)
parent3b4feac1ec14f861bdd7f494f288f4d8dd7f449e (diff)
Merge commit '3b4feac1ec14f861bdd7f494f288f4d8dd7f449e'
* commit '3b4feac1ec14f861bdd7f494f288f4d8dd7f449e': movenc: Keep track of the allocated size for the cluster array mem: Add av_realloc_array and av_reallocp_array Conflicts: doc/APIchanges libavformat/movenc.c libavutil/mem.c libavutil/mem.h libavutil/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/mem.h')
-rw-r--r--libavutil/mem.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/libavutil/mem.h b/libavutil/mem.h
index a3294690cf..fb23a69094 100644
--- a/libavutil/mem.h
+++ b/libavutil/mem.h
@@ -123,6 +123,32 @@ void *av_realloc(void *ptr, size_t size) av_alloc_size(2);
void *av_realloc_f(void *ptr, size_t nelem, size_t elsize);
/**
+ * Allocate or reallocate an array.
+ * If ptr is NULL and nmemb > 0, allocate a new block. If
+ * nmemb is zero, free the memory block pointed to by ptr.
+ * @param ptr Pointer to a memory block already allocated with
+ * av_malloc(z)() or av_realloc() or NULL.
+ * @param nmemb Number of elements
+ * @param size Size of the single element
+ * @return Pointer to a newly reallocated block or NULL if the block
+ * cannot be reallocated or the function is used to free the memory block.
+ */
+av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size);
+
+/**
+ * Allocate or reallocate an array.
+ * If *ptr is NULL and nmemb > 0, allocate a new block. If
+ * nmemb is zero, free the memory block pointed to by ptr.
+ * @param ptr Pointer to a pointer to a memory block already allocated
+ * with av_malloc(z)() or av_realloc(), or pointer to a pointer to NULL.
+ * The pointer is updated on success, or freed on failure.
+ * @param nmemb Number of elements
+ * @param size Size of the single element
+ * @return Zero on success, an AVERROR error code on failure.
+ */
+av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
+
+/**
* Free a memory block which has been allocated with av_malloc(z)() or
* av_realloc().
* @param ptr Pointer to the memory block which should be freed.