source: trunk/libs/newlib/src/newlib/libc/search/qsort_r.c @ 567

Last change on this file since 567 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 1.6 KB
Line 
1/*
2FUNCTION
3<<qsort_r>>---sort an array
4
5INDEX
6        qsort_r
7
8SYNOPSIS
9        #define _BSD_SOURCE
10        #include <stdlib.h>
11        void qsort_r(void *<[base]>, size_t <[nmemb]>, size_t <[size]>,
12                     void *<[thunk]>,
13                     int (*<[compar]>)(void*, const void *, const void *));
14
15        #define _GNU_SOURCE
16        #include <stdlib.h>
17        void qsort_r(void *<[base]>, size_t <[nmemb]>, size_t <[size]>,
18                     int (*<[compar]>)(const void *, const void *, void *),
19                     void *<[thunk]>);
20
21DESCRIPTION
22<<qsort_r>> sorts an array (beginning at <[base]>) of <[nmemb]> objects.
23<[size]> describes the size of each element of the array.
24
25You must supply a pointer to a comparison function, using the argument
26shown as <[compar]>.  (This permits sorting objects of unknown
27properties.)  There are two forms of this function, in each the
28comparison function is defined to accept three arguments, but in a
29different order.  Two are pointers to an element of the array starting at
30<[base]>, and another being an arbitrary pointer <[thunk]>.  The
31result of <<(*<[compar]>)>> must be negative if the first argument is
32less than the second, zero if the two arguments match, and positive if
33the first argument is greater than the second (where ``less than'' and
34``greater than'' refer to whatever arbitrary ordering is appropriate).
35
36The array is sorted in place; that is, when <<qsort_r>> returns, the
37array elements beginning at <[base]> have been reordered.
38
39RETURNS
40<<qsort_r>> does not return a result.
41
42PORTABILITY
43<<qsort_r>>, in various forms, appears in both BSD and glibc.
44*/
45
46#define _GNU_SOURCE
47#define I_AM_GNU_QSORT_R
48#include "qsort.c"
Note: See TracBrowser for help on using the repository browser.