diff mbox series

[FFmpeg-devel,1/3,v2] avcodec/utils: don't use ff_fast_mallocz in av_fast_padded_malloc()

Message ID 20210524124917.2907-1-jamrial@gmail.com
State Accepted
Commit e44cb7363fed11b638f1cfc798d942bcf1e4db50
Headers show
Series [FFmpeg-devel,1/3,v2] avcodec/utils: don't use ff_fast_mallocz in av_fast_padded_malloc() | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

James Almer May 24, 2021, 12:49 p.m. UTC
It will be removed in the next commit.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/utils.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

James Almer May 27, 2021, 1:09 a.m. UTC | #1
On 5/24/2021 9:49 AM, James Almer wrote:
> It will be removed in the next commit.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>   libavcodec/utils.c | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index c08f9a7da3..cc6796d8b6 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -29,7 +29,7 @@
>   #include "libavutil/avassert.h"
>   #include "libavutil/avstring.h"
>   #include "libavutil/intreadwrite.h"
> -#include "libavutil/mem_internal.h"
> +#include "libavutil/mem.h"
>   #include "libavutil/pixdesc.h"
>   #include "libavutil/imgutils.h"
>   #include "libavutil/pixfmt.h"
> @@ -55,7 +55,8 @@ void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
>           *size = 0;
>           return;
>       }
> -    if (!ff_fast_malloc(p, size, min_size + AV_INPUT_BUFFER_PADDING_SIZE, 1))
> +    av_fast_mallocz(p, size, min_size + AV_INPUT_BUFFER_PADDING_SIZE);
> +    if (*p)
>           memset(*p + min_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
>   }
>   
> @@ -67,7 +68,8 @@ void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size)
>           *size = 0;
>           return;
>       }
> -    if (!ff_fast_malloc(p, size, min_size + AV_INPUT_BUFFER_PADDING_SIZE, 1))
> +    av_fast_malloc(p, size, min_size + AV_INPUT_BUFFER_PADDING_SIZE);
> +    if (*p)
>           memset(*p, 0, min_size + AV_INPUT_BUFFER_PADDING_SIZE);
>   }

Will apply set.
diff mbox series

Patch

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index c08f9a7da3..cc6796d8b6 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -29,7 +29,7 @@ 
 #include "libavutil/avassert.h"
 #include "libavutil/avstring.h"
 #include "libavutil/intreadwrite.h"
-#include "libavutil/mem_internal.h"
+#include "libavutil/mem.h"
 #include "libavutil/pixdesc.h"
 #include "libavutil/imgutils.h"
 #include "libavutil/pixfmt.h"
@@ -55,7 +55,8 @@  void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
         *size = 0;
         return;
     }
-    if (!ff_fast_malloc(p, size, min_size + AV_INPUT_BUFFER_PADDING_SIZE, 1))
+    av_fast_mallocz(p, size, min_size + AV_INPUT_BUFFER_PADDING_SIZE);
+    if (*p)
         memset(*p + min_size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
 }
 
@@ -67,7 +68,8 @@  void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size)
         *size = 0;
         return;
     }
-    if (!ff_fast_malloc(p, size, min_size + AV_INPUT_BUFFER_PADDING_SIZE, 1))
+    av_fast_malloc(p, size, min_size + AV_INPUT_BUFFER_PADDING_SIZE);
+    if (*p)
         memset(*p, 0, min_size + AV_INPUT_BUFFER_PADDING_SIZE);
 }