On Sun, 15 Sep 2013, Luca Barbato wrote:
---
Updated the documentation and added the apichange.
doc/APIchanges | 3 +++
libavutil/mem.c | 16 ++++++++++++++++
libavutil/mem.h | 19 +++++++++++++++++++
libavutil/version.h | 2 +-
4 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index 2b3b58d..58b6493 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil: 2012-10-22
API changes, most recent first:
+2013-09-xx - xxxxxxx - lavu 52.13.0 - mem.h
52.15.0
+ Add av_reallocp.
+
2013-08-xx - xxxxxxx - lavc 55.16.0 - avcodec.h
Extend AVPacket API with av_packet_unref, av_packet_ref,
av_packet_move_ref, av_packet_copy_props, av_packet_free_side_data.
diff --git a/libavutil/mem.c b/libavutil/mem.c
index 5f64f56..172180e 100644
--- a/libavutil/mem.c
+++ b/libavutil/mem.c
@@ -136,6 +136,22 @@ void *av_realloc(void *ptr, size_t size)
#endif
}
+int av_reallocp(void *ptr, size_t size)
+{
+ void **ptrptr = ptr;
+ void *ret;
+
+ ret = av_realloc(*ptrptr, size);
+
+ if (!ret) {
+ av_freep(ptr);
+ return AVERROR(ENOMEM);
+ }
+
+ *ptrptr = ret;
+ return 0;
+}
+
The function itself is still ok with me.
// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel