[vlc-devel] [PATCH] compat: work-around busted FreeBSD qsort_r()
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
> 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
> 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 :
>>> 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
>>> 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
>>>> Am 19.01.2019 um 16:35 schrieb Rémi Denis-Courmont <remi at remlab.net>:
>>>> Are you sure that we can assume the stdlib.h guard on all affected
>>>> It definitely cannot be done on all platforms - but that's not really
>>>> vlc-devel mailing list
>>>> To unsubscribe or modify your subscription options:
>>> vlc-devel mailing list
>>> To unsubscribe or modify your subscription options:
>> 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:
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
More information about the vlc-devel