summaryrefslogtreecommitdiff
path: root/libavutil/mem.h
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-09-17 11:05:19 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-09-17 11:06:26 +0200
commitc74c3fb1420b847056d88b040a451c3c56286357 (patch)
treee73a6d8c9bf60323eb3ff38072b1cb9bfff24b96 /libavutil/mem.h
parentede42109e73a0f836bca1a241369a5108003b91a (diff)
parent3feb3d6ce4be0a09a9f8f13d613bed25b523b6e7 (diff)
downloadffmpeg-c74c3fb1420b847056d88b040a451c3c56286357.tar.gz
Merge commit '3feb3d6ce4be0a09a9f8f13d613bed25b523b6e7'
* commit '3feb3d6ce4be0a09a9f8f13d613bed25b523b6e7': mem: Introduce av_reallocp Conflicts: doc/APIchanges 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.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/libavutil/mem.h b/libavutil/mem.h
index 03f7f226ae..b73b72435b 100644
--- a/libavutil/mem.h
+++ b/libavutil/mem.h
@@ -128,6 +128,25 @@ 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 a block of memory.
+ * If *ptr is NULL and size > 0, allocate a new block. If
+ * size is zero, free the memory block pointed to by ptr.
+ * @param ptr Pointer to a pointer to a memory block already allocated
+ * with av_realloc(), or pointer to a pointer to NULL.
+ * The pointer is updated on success, or freed on failure.
+ * @param size Size in bytes for the memory block to be allocated or
+ * reallocated
+ * @return Zero on success, an AVERROR error code on failure.
+ * @warning Pointers originating from the av_malloc() family of functions must
+ * not be passed to av_reallocp(). The former can be implemented using
+ * memalign() (or other functions), and there is no guarantee that
+ * pointers from such functions can be passed to realloc() at all.
+ * The situation is undefined according to POSIX and may crash with
+ * some libc implementations.
+ */
+int av_reallocp(void *ptr, 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.