On Mon, Dec 23, 2019 at 04:11:53PM +0100, Nicolas George wrote:
> Tomas Härdin (12019-12-09):
> > As far as I can tell this is OK, and it passes FATE. But it just looks
> > very very wrong. Why does this function even exist if all it
> > effectively does is return the integers from 0..count-1?
> 
> For some time, there were gaps in the list of pixel formats, the task of
> this function was precisely there to avoid the gaps and keep only the
> actual pixel formats.
> 
> I am not sure about this change. It is technically valid, but it may
> cause problems later.
> 
> There is an intermediate solution: keep the loop, but allocate only
> once (simplified):
> 
>         while ((desc = ...))
>             count++;
>         ret->formats = av_malloc_array(count, sizeof(*ret->formats));
>         count = 0;
>         while ((desc = ...))
>             ret->formats[count] = ...;
> 
> What do other developers think about it, with these explanations?

The count once then allocate feels more robust than assuming on !gaps

Thanks


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus

Attachment: signature.asc
Description: PGP signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to