From: Ingo Weinhold Date: Sat, 30 Mar 2013 16:17:39 +0000 (+0000) Subject: solv_sort(): Fix build for non-glibc without qsort_r() X-Git-Tag: BASE-SuSE-Code-12_3-Branch~72^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9fc09488ea869798c2a08d301bea5de45076f21a;p=thirdparty%2Flibsolv.git solv_sort(): Fix build for non-glibc without qsort_r() --- diff --git a/src/util.c b/src/util.c index 3928e7d0..4fe2d632 100644 --- a/src/util.c +++ b/src/util.c @@ -115,13 +115,12 @@ solv_timems(unsigned int subtract) see also: http://sources.redhat.com/ml/libc-alpha/2008-12/msg00003.html */ -#if defined(__GLIBC__) +#if defined(__GLIBC__) && (defined(HAVE_QSORT_R) || defined(HAVE___QSORT_R)) -# if HAVE_QSORT_R || HAVE___QSORT_R void solv_sort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *, void *), void *compard) { -# if HAVE_QSORT_R +# if defined(HAVE_QSORT_R) qsort_r(base, nmemb, size, compar, compard); # else /* backported for SLE10-SP2 */ @@ -129,12 +128,8 @@ solv_sort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, con # endif } -#else /* qsort_r or __qsort_r on glibc */ -/* use own version of qsort if none available */ -#include "qsort_r.c" -#endif -#else /* not glibc */ +#elif defined(HAVE_QSORT_R) /* not glibc, but has qsort_r() */ struct solv_sort_data { int (*compar)(const void *, const void *, void *); @@ -157,6 +152,9 @@ solv_sort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, con qsort_r(base, nmemb, size, &d, solv_sort_helper); } +#else /* not glibc and no qsort_r() */ +/* use own version of qsort if none available */ +#include "qsort_r.c" #endif char *