mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-03-20 15:51:07 +01:00
stdlib: qsort and bsearch changes.
- Always use internal qsort and bsearch implementation. - add "_r" reentrant versions. The reasons for always using the internal versions is that the C runtime versions' callbacks are not mark STDCALL, so we would have add bridge functions for them anyhow, The C runtime qsort_r/qsort_s have different orders of arguments on different platforms, and most importantly: qsort() isn't a stable sort, and isn't guaranteed to give the same ordering for two objects marked as equal by the callback...as such, Visual Studio and glibc can give different sort results for the same data set...in this sense, having one piece of code shared on all platforms makes sense here, for reliabillity. bsearch does not have a standard _r version at all, and suffers from the same SDLCALL concern. Since the code is simple and we would have to work around the C runtime, it's easier to just go with the built-in function and remove all the CMake C runtime tests. Fixes #9159.
This commit is contained in:
@@ -1058,7 +1058,7 @@ if(SDL_LIBC)
|
||||
|
||||
set(symbols_to_check
|
||||
abs acos acosf asin asinf atan atan2 atan2f atanf atof atoi
|
||||
bcopy bsearch
|
||||
bcopy
|
||||
calloc ceil ceilf copysign copysignf cos cosf
|
||||
_Exit exp expf
|
||||
fabs fabsf floor floorf fmod fmodf fopen64 free fseeko fseeko64
|
||||
@@ -1067,7 +1067,6 @@ if(SDL_LIBC)
|
||||
log log10 log10f logf lround lroundf _ltoa
|
||||
malloc memcmp memcpy memmove memset modf modff
|
||||
pow powf putenv
|
||||
qsort
|
||||
realloc rindex round roundf
|
||||
scalbn scalbnf setenv sin sinf sqr sqrt sqrtf sscanf strchr
|
||||
strcmp strlcat strlcpy strlen strncmp strnlen
|
||||
|
||||
Reference in New Issue
Block a user