Context-free sorting function. More...
#include "config.h"
#include <stddef.h>
#include <stdlib.h>
#include "mutt/lib.h"
#include "qsort_r.h"
Go to the source code of this file.
Functions | |
static int | relay_compar (const void *a, const void *b) |
Shim to pass context through to real comparator. | |
void | mutt_qsort_r (void *base, size_t nmemb, size_t size, sort_t compar, void *sdata) |
Sort an array, where the comparator has access to opaque data rather than requiring global variables. | |
Variables | |
static sort_t | GlobalCompar = NULL |
Original comparator in fallback implementation. | |
static void * | GlobalData = NULL |
Original opaque data in fallback implementation. | |
Context-free sorting function.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file qsort_r.c.
|
static |
Shim to pass context through to real comparator.
a | First item to be compared |
b | Second item to be compared |
<0 | a sorts before b |
0 | a and b sort equally (sort stability not guaranteed) |
>0 | a sorts after b |
Definition at line 50 of file qsort_r.c.
void mutt_qsort_r | ( | void * | base, |
size_t | nmemb, | ||
size_t | size, | ||
sort_t | compar, | ||
void * | sdata | ||
) |
Sort an array, where the comparator has access to opaque data rather than requiring global variables.
base | Start of the array to be sorted |
nmemb | Number of elements in the array |
size | Size of each array element |
compar | Comparison function, return <0/0/>0 to compare two elements |
sdata | Opaque argument to pass to compar |
Definition at line 67 of file qsort_r.c.
|
static |