[vlc-devel] [PATCH] compat: work-around busted FreeBSD qsort_r()
Steve Lhomme
robux4 at ycbcr.xyz
Mon Jan 21 09:15:14 CET 2019
On 19/01/2019 20:39, Marvin Scholz wrote:
> On 19 Jan 2019, at 18:21, Rémi Denis-Courmont wrote:
>
>> My understanding is that POSIX.next will standardize on the GNU/libc
>> prototype, regardless of historical precedence. But of course, we
>> cannot know for sure until the spec is out.
>>
>
> It looks very likely that this will happen, so it is a good idea
> to use that prototype in VLC.
>
> Nevertheless most BSDs that currently do not use that prototype will take
> a while to adapt to the posix standard, so we need a solution in the
> meantime
> to workaround that.
>
> I think it would be confusing to just "overwrite" the qsort_r
> prototype with
> the one we want to use in VLC as at least I would be quite confused when
> qsort_r does not match the qsort_r of my system headers.
>
> IMO a good approach would be to introduce a vlc_qsort_r or similar
> named, so
> that it becomes obvious that it does not necessarily matches the
> system qsort_r.
> (And yes, putting that in compat was not a good idea.)
I second that.
>
> Of course thats not ideal either as that means someone could
> "accidentally"
> use qsort_r unaware that there is the vlc_qsort_r variant.
That would mean code that doesn't work on some platforms. So
invalid/bogus code. So either we find a way to static_assert or assert
when that happens or we need to be careful in code reviews.
>
>> Le 19 janvier 2019 18:56:25 GMT+02:00, David Fuhrmann
>> <david.fuhrmann at gmail.com> a écrit :
>>> Hi,
>>>
>>> I checked all FreeBSD Versions 3 to 12, and macOS SDKs 10.7, 10.12,
>>> 10.13 and 10.14. All have the same include guard, and that since ages.
>>> So I think it is safe to assume that it stays as it is for now.
>>>
>>> BTW, qsort_r exists in its FreeBSD variant since ages already.
>>> According to
>>> https://stackoverflow.com/questions/39560773/different-declarations-of-qsort-r-on-mac-and-linux,
>>>
>>> FreeBSD introduced its variant in 2002, whereas Linux added the other
>>> variant in 2008.
>>>
>>> Maybe VLC should not use such a function directly with such a long
>>> history of incompatible signature, and where the FreeBSD variant is
>>> even older?
>>> And from my understanding, qsort_r is in no standard as of today
>>> either.
>>>
>>> Best,
>>> David
>>>
>>>> Am 19.01.2019 um 16:35 schrieb Rémi Denis-Courmont <remi at remlab.net>:
>>>>
>>>> Hey,
>>>>
>>>> Are you sure that we can assume the stdlib.h guard on all affected
>>> platforms?
>>>> It definitely cannot be done on all platforms - but that's not really
>>> the
>>>> question.
>>>>
>>>> Br,
>>>>
>>>>
>>>> _______________________________________________
>>>> vlc-devel mailing list
>>>> To unsubscribe or modify your subscription options:
>>>> https://mailman.videolan.org/listinfo/vlc-devel
>>>
>>> _______________________________________________
>>> vlc-devel mailing list
>>> To unsubscribe or modify your subscription options:
>>> https://mailman.videolan.org/listinfo/vlc-devel
>>
>> --
>> Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez
>> excuser ma brièveté._______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
More information about the vlc-devel
mailing list