[FFmpeg-devel] avutil/mem: Correct documentation of av_fast_*alloc(z)

Submitted by Andreas Rheinhardt on Nov. 18, 2018, 2:08 p.m.

Details

Message ID 20181118140845.2488-1-andreas.rheinhardt@googlemail.com
State Accepted
Commit 8f875a90c440925268e55c2734ec258fe1994cab
Headers show

Commit Message

Andreas Rheinhardt Nov. 18, 2018, 2:08 p.m.
The current wording regarding size and min_size is completely wrong and
ignores that min_size is indeed only a desired minimal size, not the
actually allocated size.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@googlemail.com>
---
 libavutil/mem.h | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

Comments

Michael Niedermayer Nov. 18, 2018, 10:12 p.m.
On Sun, Nov 18, 2018 at 03:08:45PM +0100, Andreas Rheinhardt wrote:
> The current wording regarding size and min_size is completely wrong and
> ignores that min_size is indeed only a desired minimal size, not the
> actually allocated size.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@googlemail.com>
> ---
>  libavutil/mem.h | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)

will apply

thanks

[...]

Patch hide | download patch | download mbox

diff --git a/libavutil/mem.h b/libavutil/mem.h
index 7e0b12a8a7..55ae573ac9 100644
--- a/libavutil/mem.h
+++ b/libavutil/mem.h
@@ -363,10 +363,10 @@  av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size);
  * @endcode
  *
  * @param[in,out] ptr      Already allocated buffer, or `NULL`
- * @param[in,out] size     Pointer to current size of buffer `ptr`. `*size` is
- *                         changed to `min_size` in case of success or 0 in
- *                         case of failure
- * @param[in]     min_size New size of buffer `ptr`
+ * @param[in,out] size     Pointer to the size of buffer `ptr`. `*size` is
+ *                         updated to the new allocated size, in particular 0
+ *                         in case of failure.
+ * @param[in]     min_size Desired minimal size of buffer `ptr`
  * @return `ptr` if the buffer is large enough, a pointer to newly reallocated
  *         buffer if the buffer was not large enough, or `NULL` in case of
  *         error
@@ -397,10 +397,10 @@  void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size);
  * @param[in,out] ptr      Pointer to pointer to an already allocated buffer.
  *                         `*ptr` will be overwritten with pointer to new
  *                         buffer on success or `NULL` on failure
- * @param[in,out] size     Pointer to current size of buffer `*ptr`. `*size` is
- *                         changed to `min_size` in case of success or 0 in
- *                         case of failure
- * @param[in]     min_size New size of buffer `*ptr`
+ * @param[in,out] size     Pointer to the size of buffer `*ptr`. `*size` is
+ *                         updated to the new allocated size, in particular 0
+ *                         in case of failure.
+ * @param[in]     min_size Desired minimal size of buffer `*ptr`
  * @see av_realloc()
  * @see av_fast_mallocz()
  */
@@ -418,10 +418,10 @@  void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size);
  * @param[in,out] ptr      Pointer to pointer to an already allocated buffer.
  *                         `*ptr` will be overwritten with pointer to new
  *                         buffer on success or `NULL` on failure
- * @param[in,out] size     Pointer to current size of buffer `*ptr`. `*size` is
- *                         changed to `min_size` in case of success or 0 in
- *                         case of failure
- * @param[in]     min_size New size of buffer `*ptr`
+ * @param[in,out] size     Pointer to the size of buffer `*ptr`. `*size` is
+ *                         updated to the new allocated size, in particular 0
+ *                         in case of failure.
+ * @param[in]     min_size Desired minimal size of buffer `*ptr`
  * @see av_fast_malloc()
  */
 void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size);