From 6df2ee73b35e3a3d1672801a89616cde654e1ac3 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Fri, 2 May 2014 13:56:00 +0200 Subject: [PATCH] Try to fix build on Linux. * Linux is the only one of our supported build hosts to not have mergesort. Provide an implementation that calls qsort, since the qsort implementation in the glibc used by Linux uses a mergesort (!) for small arrays. --- src/build/libroot/misc.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/build/libroot/misc.cpp b/src/build/libroot/misc.cpp index 52c74f6f08..754e8115e8 100644 --- a/src/build/libroot/misc.cpp +++ b/src/build/libroot/misc.cpp @@ -69,3 +69,14 @@ snooze_until(bigtime_t time, int timeBase) { return snooze(time - system_time()); } + + +#ifdef __linux__ +// Linux is the only system out there to not have this... +int mergesort(void* base, size_t count, size_t size, + int (*compare)(const void *, const void *)) +{ + qsort(base, count, size, compare); + return 0; +} +#endif