summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2011-11-07 09:24:30 +0100
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2011-11-07 09:24:30 +0100
commit515d54433138596e81267237542bd9168b8cc787 (patch)
treef2d6745268b788cc38d1b67deb32f71916b10fec /include
parent84144d142cb9f041dd18285cb2ad9dbe6619b0a2 (diff)
stdlib: add qsort_r
GNU extension like qsort but takes a 3 parameter comparision function. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'include')
-rw-r--r--include/stdlib.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/include/stdlib.h b/include/stdlib.h
index e9a8b84c2..1f15531e4 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -690,6 +690,9 @@ typedef int (*__compar_fn_t) (__const void *, __const void *);
typedef __compar_fn_t comparison_fn_t;
# endif
#endif
+#ifdef __USE_GNU
+typedef int (*__compar_d_fn_t) (__const void *, __const void *, void *);
+#endif
__BEGIN_NAMESPACE_STD
/* Do a binary search for KEY in BASE, which consists of NMEMB elements
@@ -703,7 +706,12 @@ extern void *bsearch (__const void *__key, __const void *__base,
extern void qsort (void *__base, size_t __nmemb, size_t __size,
__compar_fn_t __compar) __nonnull ((1, 4));
libc_hidden_proto(qsort)
-
+#ifdef __USE_GNU
+extern void qsort_r (void *__base, size_t __nmemb, size_t __size,
+ __compar_d_fn_t __compar, void *__arg)
+ __nonnull ((1, 4));
+libc_hidden_proto(qsort_r)
+#endif
/* Return the absolute value of X. */
extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;