[FFmpeg-devel] [PATCH v2 1/4] avutil/internal: add FF_ALLOC_TYPED_ARRAY_OR_GOTO & FF_ALLOCZ_TYPED_ARRAY_OR_GOTO
Nicolas George
george at nsup.org
Tue May 12 17:11:34 EEST 2020
Marton Balint (12020-05-12):
> You mean this?
>
> #define FF_ALLOC_ARRAY_OR_ERROR(p, nelem, elsize, errstatement)\
> {\
> p = av_malloc_array(nelem, elsize);\
> if (!p) {\
> errstatement; \
> }\
> }
Exactly.
But I am rather in favor of making "something = AVERROR(ENOMEM)"
mandatory too:
#define FF_ALLOC_ARRAY_OR_ERROR(p, nelem, elsize, ret, errstatement)\
{\
p = av_malloc_array(nelem, elsize);\
if (!p) {\
ret = AVERROR(ENOMEM); \
errstatement; \
}\
}
Regards,
--
Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20200512/ef6994d4/attachment.sig>
More information about the ffmpeg-devel
mailing list