diff mbox series

[FFmpeg-devel,v3,1/4] avutil/internal: add FF_ALLOC_TYPED_ARRAY_OR_GOTO & FF_ALLOCZ_TYPED_ARRAY_OR_GOTO

Message ID 1589249730-22520-1-git-send-email-lance.lmwang@gmail.com
State New
Headers show
Series [FFmpeg-devel,v3,1/4] avutil/internal: add FF_ALLOC_TYPED_ARRAY_OR_GOTO & FF_ALLOCZ_TYPED_ARRAY_OR_GOTO
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Limin Wang May 12, 2020, 2:15 a.m. UTC
From: Limin Wang <lance.lmwang@gmail.com>

These are similar to the existing FF_ALLOC_ARRAY_OR_GOTO & FF_ALLOCZ_ARRAY_OR_GOTO,
but the elsize is calcuated by sizeof(*p)

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavutil/internal.h | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/libavutil/internal.h b/libavutil/internal.h
index 4acbcf5..9d68c3f 100644
--- a/libavutil/internal.h
+++ b/libavutil/internal.h
@@ -173,6 +173,12 @@ 
     }\
 }
 
+#define FF_ALLOC_TYPED_ARRAY_OR_GOTO(ctx, p, nelem, label)\
+    FF_ALLOC_ARRAY_OR_GOTO(ctx, p, nelem, sizeof(*(p)), label)
+
+#define FF_ALLOCZ_TYPED_ARRAY_OR_GOTO(ctx, p, nelem, label)\
+    FF_ALLOCZ_ARRAY_OR_GOTO(ctx, p, nelem, sizeof(*(p)), label)
+
 #include "libm.h"
 
 /**