Loading...
--- Libc/Libc-763.13/stdlib/FreeBSD/qsort.3.patch
+++ Libc/Libc-583/stdlib/FreeBSD/qsort.3.patch
@@ -1,6 +1,6 @@
---- qsort.3.orig 2010-10-07 21:23:04.000000000 -0700
-+++ qsort.3 2010-10-07 21:24:45.000000000 -0700
-@@ -36,41 +36,78 @@
+--- qsort.3.orig 2009-05-12 11:21:33.000000000 -0700
++++ qsort.3 2009-05-20 15:00:21.000000000 -0700
+@@ -40,41 +40,78 @@
.Dt QSORT 3
.Os
.Sh NAME
@@ -63,7 +63,9 @@
.Ft int
-.Fo mergesort
+.Fo mergesort_b
-+.Fa "void *base"
+ .Fa "void *base"
+-.Fa "size_t nmemb"
+-.Fa "size_t size"
+.Fa "size_t nel"
+.Fa "size_t width"
+.Fa "int \*[lp]^compar\*[rp]\*[lp]const void *, const void *\*[rp]"
@@ -71,9 +73,7 @@
+#endif
+.Ft void
+.Fo qsort
- .Fa "void *base"
--.Fa "size_t nmemb"
--.Fa "size_t size"
++.Fa "void *base"
+.Fa "size_t nel"
+.Fa "size_t width"
.Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *\*[rp]"
@@ -98,7 +98,7 @@
.Sh DESCRIPTION
The
.Fn qsort
-@@ -80,7 +117,7 @@
+@@ -84,7 +121,7 @@
function is a modified selection sort.
The
.Fn mergesort
@@ -107,7 +107,7 @@
intended for sorting data with pre-existing order.
.Pp
The
-@@ -88,19 +125,19 @@
+@@ -92,19 +129,19 @@
and
.Fn heapsort
functions sort an array of
@@ -131,7 +131,7 @@
.Dq "sizeof(void *) / 2" .
.Pp
The contents of the array
-@@ -135,7 +172,7 @@
+@@ -139,7 +176,7 @@
.Fn heapsort
are
.Em not
@@ -140,7 +140,7 @@
the sorted array is undefined.
The
.Fn mergesort
-@@ -179,8 +216,8 @@
+@@ -183,8 +220,8 @@
The function
.Fn mergesort
requires additional memory of size
@@ -151,11 +151,13 @@
bytes; it should be used only when space is not at a premium.
The
.Fn mergesort
-@@ -192,19 +229,40 @@
+@@ -195,42 +232,83 @@
+ Normally,
.Fn qsort
is faster than
- .Fn mergesort
+-.Fn mergesort
-is faster than
++.Fn mergesort ,
+which is faster than
.Fn heapsort .
Memory availability and pre-existing order in the data can make this
@@ -191,17 +193,12 @@
+.ds MERGESORT_B mergesort_b
+#endif
+.Rv -std heapsort \*[HEAPSORT_B] mergesort \*[MERGESORT_B]
- .Sh COMPATIBILITY
- Previous versions of
- .Fn qsort
-@@ -213,26 +271,46 @@
- This is no longer true.
.Sh ERRORS
The
+#ifdef UNIFDEF_BLOCKS
+.Fn heapsort ,
+.Fn heapsort_b ,
-+.Fn mergesort ,
++.Fn mergesort
+and
+.Fn mergesort_b
+#else
@@ -232,12 +229,13 @@
+#ifdef UNIFDEF_BLOCKS
+.Fn heapsort ,
+.Fn heapsort_b ,
-+.Fn mergesort ,
-+or
++.Fn mergesort
++and
+.Fn mergesort_b
+#else
.Fn heapsort
- or
+-or
++and
.Fn mergesort
+#endif
functions