[FFmpeg-devel] [PATCH v2 1/4] avutil/internal: add FF_ALLOC_TYPED_ARRAY_OR_GOTO & FF_ALLOCZ_TYPED_ARRAY_OR_GOTO

lance.lmwang at gmail.com lance.lmwang at gmail.com
Tue May 12 17:19:28 EEST 2020


On Tue, May 12, 2020 at 04:11:34PM +0200, Nicolas George wrote:
> 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; \
>     }\
> }

OK, it's more clear, I got it.

> 
> Regards,
> 
> -- 
>   Nicolas George



> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".


-- 
Thanks,
Limin Wang


More information about the ffmpeg-devel mailing list