[FFmpeg-devel] [PATCH] all: replace qsort with AV_QSORT

Ganesh Ajjanagadde gajjanag at mit.edu
Sun Oct 18 17:47:11 CEST 2015


On Sun, Oct 18, 2015 at 11:45 AM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
> Ganesh Ajjanagadde <gajjanag <at> mit.edu> writes:
>
>> >> +    if (q->sort == SUB_SORT_TS_POS) {
>> >> +        AV_QSORT(q->subs, q->nb_subs, AVPacket, cmp_pkt_sub_ts_pos);
>> >> +    }
>> >> +    else
>> >> +        AV_QSORT(q->subs, q->nb_subs, AVPacket, cmp_pkt_sub_pos_ts);
>> >> +
>> >
>> > Weird style.
>>
>> There were two reasons for this:
>> 1. This ensures inlining of the cmp callback.
>
> Please use:
> if (cond) {
>   AV_QSORT();
> } else {
>   AV_QSORT();
> }

Good catch - the current AV_QSORT may actually make this a bug due to
the lack of do-while. Thanks.

>
> Carl Eugen
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


More information about the ffmpeg-devel mailing list