• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #define _BSD_SOURCE
2 #include <stdlib.h>
3 
4 typedef int (*cmpfun)(const void *, const void *);
5 
wrapper_cmp(const void * v1,const void * v2,void * cmp)6 static int wrapper_cmp(const void *v1, const void *v2, void *cmp)
7 {
8 	return ((cmpfun)cmp)(v1, v2);
9 }
10 
qsort(void * base,size_t nel,size_t width,cmpfun cmp)11 void qsort(void *base, size_t nel, size_t width, cmpfun cmp)
12 {
13 	__qsort_r(base, nel, width, wrapper_cmp, cmp);
14 }
15