[FFmpeg-devel] [PATCH] avcodec: improve the function of FF_ALLOC{Z}{_ARRAY}_OR_GOTO

Marton Balint cus at passwd.hu
Tue May 12 21:07:00 EEST 2020



On Tue, 12 May 2020, Nicolas George wrote:

> Marton Balint (12020-05-12):
>> And you assume that I want to assign the error code to ret. Wrong. What if I
>> want to return it as is?
>
> Assign it to ret and forward ret.
>
>> 			   Or what if I want to return NULL beacuse the
>> function returns a pointer?
>
> Bad design, fix it.
>
>> 				Using variables is complicated. Constants make
>> the code more simple and readable.
>
> Simpler now, much more complex later to fix the incorrect error codes.

I think you want to force your preferred pattern to cases which clearly do 
not benefit from it. I still have to disagree. I suggest we make multilpe 
macros, and the user can decide which one to use.

Regards,
Marton


More information about the ffmpeg-devel mailing list