[FFmpeg-devel] [PATCH] avutil/qsort: use do while form for AV_QSORT

Ganesh Ajjanagadde gajjanag at mit.edu
Fri Oct 23 14:44:18 CEST 2015


On Fri, Oct 23, 2015 at 1:55 AM, Clément Bœsch <u at pkh.me> wrote:
> On Thu, Oct 22, 2015 at 10:53:10PM -0400, Ganesh Ajjanagadde wrote:
>> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
>> ---
>>  libavutil/qsort.h | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavutil/qsort.h b/libavutil/qsort.h
>> index 30edcc8..f079661 100644
>> --- a/libavutil/qsort.h
>> +++ b/libavutil/qsort.h
>> @@ -27,7 +27,7 @@
>>   * to construct input that requires O(n^2) time but this is very unlikely to
>>   * happen with non constructed input.
>>   */
>> -#define AV_QSORT(p, num, type, cmp) {\
>> +#define AV_QSORT(p, num, type, cmp) do { \
>>      void *stack[64][2];\
>>      int sp= 1;\
>>      stack[0][0] = p;\
>> @@ -89,7 +89,7 @@
>>              }\
>>          }\
>>      }\
>> -}
>> +} while (0)
>>
>
> Probably relevant for the AV_MSORT() below too

It is currently not used, is usually slower, and I doubt FFmpeg needs
a stable sort any time soon. Nevertheless, since you pointed it out,
fixed that as well, reworded the commit message, and pushed. Thanks.

>
> --
> Clément B.
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


More information about the ffmpeg-devel mailing list