Lines 42-47
__FBSDID("$FreeBSD$");
Link Here
|
42 |
#include "libc_private.h" |
42 |
#include "libc_private.h" |
43 |
|
43 |
|
44 |
#if defined(I_AM_QSORT_R) |
44 |
#if defined(I_AM_QSORT_R) |
|
|
45 |
typedef int cmp_t(const void *, const void *, void *); |
46 |
#elif defined(I_AM_QSORT_R_COMPAT) |
45 |
typedef int cmp_t(void *, const void *, const void *); |
47 |
typedef int cmp_t(void *, const void *, const void *); |
46 |
#elif defined(I_AM_QSORT_S) |
48 |
#elif defined(I_AM_QSORT_S) |
47 |
typedef int cmp_t(const void *, const void *, void *); |
49 |
typedef int cmp_t(const void *, const void *, void *); |
Lines 72-77
swapfunc(char *a, char *b, size_t es)
Link Here
|
72 |
if ((n) > 0) swapfunc(a, b, n) |
74 |
if ((n) > 0) swapfunc(a, b, n) |
73 |
|
75 |
|
74 |
#if defined(I_AM_QSORT_R) |
76 |
#if defined(I_AM_QSORT_R) |
|
|
77 |
#define CMP(t, x, y) (cmp((x), (y), (t))) |
78 |
#elif defined(I_AM_QSORT_R_COMPAT) |
75 |
#define CMP(t, x, y) (cmp((t), (x), (y))) |
79 |
#define CMP(t, x, y) (cmp((t), (x), (y))) |
76 |
#elif defined(I_AM_QSORT_S) |
80 |
#elif defined(I_AM_QSORT_S) |
77 |
#define CMP(t, x, y) (cmp((x), (y), (t))) |
81 |
#define CMP(t, x, y) (cmp((x), (y), (t))) |
Lines 81-87
swapfunc(char *a, char *b, size_t es)
Link Here
|
81 |
|
85 |
|
82 |
static inline char * |
86 |
static inline char * |
83 |
med3(char *a, char *b, char *c, cmp_t *cmp, void *thunk |
87 |
med3(char *a, char *b, char *c, cmp_t *cmp, void *thunk |
84 |
#if !defined(I_AM_QSORT_R) && !defined(I_AM_QSORT_S) |
88 |
#if !defined(I_AM_QSORT_R) && !defined(I_AM_QSORT_R_COMPAT) && !defined(I_AM_QSORT_S) |
85 |
__unused |
89 |
__unused |
86 |
#endif |
90 |
#endif |
87 |
) |
91 |
) |
Lines 97-102
__unused
Link Here
|
97 |
*/ |
101 |
*/ |
98 |
#if defined(I_AM_QSORT_R) |
102 |
#if defined(I_AM_QSORT_R) |
99 |
#define local_qsort local_qsort_r |
103 |
#define local_qsort local_qsort_r |
|
|
104 |
#elif defined(I_AM_QSORT_R_COMPAT) |
105 |
#define local_qsort local_qsort_r_compat |
100 |
#elif defined(I_AM_QSORT_S) |
106 |
#elif defined(I_AM_QSORT_S) |
101 |
#define local_qsort local_qsort_s |
107 |
#define local_qsort local_qsort_s |
102 |
#endif |
108 |
#endif |
Lines 211-220
local_qsort(void *a, size_t n, size_t es, cmp_t *cmp, void *thunk)
Link Here
|
211 |
|
217 |
|
212 |
#if defined(I_AM_QSORT_R) |
218 |
#if defined(I_AM_QSORT_R) |
213 |
void |
219 |
void |
214 |
qsort_r(void *a, size_t n, size_t es, void *thunk, cmp_t *cmp) |
220 |
(qsort_r)(void *a, size_t n, size_t es, cmp_t *cmp, void *thunk) |
215 |
{ |
221 |
{ |
216 |
local_qsort_r(a, n, es, cmp, thunk); |
222 |
local_qsort_r(a, n, es, cmp, thunk); |
217 |
} |
223 |
} |
|
|
224 |
#elif defined(I_AM_QSORT_R_COMPAT) |
225 |
void |
226 |
__qsort_r_compat(void *a, size_t n, size_t es, void *thunk, cmp_t *cmp) |
227 |
{ |
228 |
local_qsort_r_compat(a, n, es, cmp, thunk); |
229 |
} |
218 |
#elif defined(I_AM_QSORT_S) |
230 |
#elif defined(I_AM_QSORT_S) |
219 |
errno_t |
231 |
errno_t |
220 |
qsort_s(void *a, rsize_t n, rsize_t es, cmp_t *cmp, void *thunk) |
232 |
qsort_s(void *a, rsize_t n, rsize_t es, cmp_t *cmp, void *thunk) |