]> git.sesse.net Git - ffmpeg/blobdiff - libavutil/mem.h
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / libavutil / mem.h
index 77b7adc373f1ec1a308aa7df9969d723000522a2..703ce819364e1a0128ed4ca4999a6aa3f3e71e8d 100644 (file)
@@ -335,6 +335,27 @@ void av_max_alloc(size_t max);
  */
 void av_memcpy_backptr(uint8_t *dst, int back, int cnt);
 
+/**
+ * Reallocate the given block if it is not large enough, otherwise do nothing.
+ *
+ * @see av_realloc
+ */
+void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size);
+
+/**
+ * Allocate a buffer, reusing the given one if large enough.
+ *
+ * Contrary to av_fast_realloc the current buffer contents might not be
+ * preserved and on error the old buffer is freed, thus no special
+ * handling to avoid memleaks is necessary.
+ *
+ * @param ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer
+ * @param size size of the buffer *ptr points to
+ * @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and
+ *                 *size 0 if an error occurred.
+ */
+void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size);
+
 /**
  * @}
  */