about summary refs log tree commit diff
path: root/src/stdlib/qsort_nr.c
blob: 8ffe71d03819c0157e1b0ecb131bbbfb67f8c8f4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#define _BSD_SOURCE
#include <stdlib.h>

typedef int (*cmpfun)(const void *, const void *);

static int wrapper_cmp(const void *v1, const void *v2, void *cmp)
{
	return ((cmpfun)cmp)(v1, v2);
}

void qsort(void *base, size_t nel, size_t width, cmpfun cmp)
{
	__qsort_r(base, nel, width, wrapper_cmp, (void *)cmp);
}