Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/stdlib/qsort.3
Show All 26 Lines | |||||||||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||||||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||||||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||||||||
.\" SUCH DAMAGE. | .\" SUCH DAMAGE. | ||||||||||
.\" | .\" | ||||||||||
.\" @(#)qsort.3 8.1 (Berkeley) 6/4/93 | .\" @(#)qsort.3 8.1 (Berkeley) 6/4/93 | ||||||||||
.\" $FreeBSD$ | .\" $FreeBSD$ | ||||||||||
.\" | .\" | ||||||||||
.Dd February 20, 2013 | .Dd September 8, 2018 | ||||||||||
imp: Bump date | |||||||||||
delphijAuthorUnsubmitted Done Inline Actions
Will do. delphij: > Bump date
Will do. | |||||||||||
.Dt QSORT 3 | .Dt QSORT 3 | ||||||||||
.Os | .Os | ||||||||||
.Sh NAME | .Sh NAME | ||||||||||
.Nm qsort , | .Nm qsort , | ||||||||||
.Nm qsort_b , | .Nm qsort_b , | ||||||||||
.Nm qsort_r , | .Nm qsort_r , | ||||||||||
.Nm heapsort , | .Nm heapsort , | ||||||||||
.Nm heapsort_b , | .Nm heapsort_b , | ||||||||||
Show All 18 Lines | |||||||||||
.Fa "size_t size" | .Fa "size_t size" | ||||||||||
.Fa "int \*[lp]^compar\*[rp]\*[lp]const void *, const void *\*[rp]" | .Fa "int \*[lp]^compar\*[rp]\*[lp]const void *, const void *\*[rp]" | ||||||||||
.Fc | .Fc | ||||||||||
.Ft void | .Ft void | ||||||||||
.Fo qsort_r | .Fo qsort_r | ||||||||||
.Fa "void *base" | .Fa "void *base" | ||||||||||
.Fa "size_t nmemb" | .Fa "size_t nmemb" | ||||||||||
.Fa "size_t size" | .Fa "size_t size" | ||||||||||
.Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *, void *\*[rp]" | |||||||||||
.Fa "void *thunk" | .Fa "void *thunk" | ||||||||||
.Fa "int \*[lp]*compar\*[rp]\*[lp]void *, const void *, const void *\*[rp]" | |||||||||||
.Fc | .Fc | ||||||||||
.Ft int | .Ft int | ||||||||||
.Fo heapsort | .Fo heapsort | ||||||||||
.Fa "void *base" | .Fa "void *base" | ||||||||||
.Fa "size_t nmemb" | .Fa "size_t nmemb" | ||||||||||
.Fa "size_t size" | .Fa "size_t size" | ||||||||||
.Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *\*[rp]" | .Fa "int \*[lp]*compar\*[rp]\*[lp]const void *, const void *\*[rp]" | ||||||||||
.Fc | .Fc | ||||||||||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | |||||||||||
less than, equal to, or greater than the second. | less than, equal to, or greater than the second. | ||||||||||
.Pp | .Pp | ||||||||||
The | The | ||||||||||
.Fn qsort_r | .Fn qsort_r | ||||||||||
function behaves identically to | function behaves identically to | ||||||||||
.Fn qsort , | .Fn qsort , | ||||||||||
except that it takes an additional argument, | except that it takes an additional argument, | ||||||||||
.Fa thunk , | .Fa thunk , | ||||||||||
which is passed unchanged as the first argument to function pointed to | which is passed unchanged as the last argument to function pointed to | ||||||||||
.Fa compar . | .Fa compar . | ||||||||||
This allows the comparison function to access additional | This allows the comparison function to access additional | ||||||||||
data without using global variables, and thus | data without using global variables, and thus | ||||||||||
.Fn qsort_r | .Fn qsort_r | ||||||||||
is suitable for use in functions which must be reentrant. | is suitable for use in functions which must be reentrant. | ||||||||||
The | The | ||||||||||
.Fn qsort_b | .Fn qsort_b | ||||||||||
function behaves identically to | function behaves identically to | ||||||||||
▲ Show 20 Lines • Show All 205 Lines • ▼ Show 20 Lines | |||||||||||
.Fn qsort | .Fn qsort | ||||||||||
function | function | ||||||||||
conforms to | conforms to | ||||||||||
.St -isoC . | .St -isoC . | ||||||||||
.Sh HISTORY | .Sh HISTORY | ||||||||||
The variants of these functions that take blocks as arguments first appeared in | The variants of these functions that take blocks as arguments first appeared in | ||||||||||
Mac OS X. | Mac OS X. | ||||||||||
This implementation was created by David Chisnall. | This implementation was created by David Chisnall. | ||||||||||
.Pp | |||||||||||
In | |||||||||||
.Fx 13.0 , | |||||||||||
pauamma_gundo.comUnsubmitted Done Inline Actions
pauamma_gundo.com: | |||||||||||
the prototype of | |||||||||||
.Fn qsort_r | |||||||||||
was updated to match glibc. | |||||||||||
rpokalaUnsubmitted Done Inline Actionsto match POSIX rpokala: to match POSIX | |||||||||||
delphijAuthorUnsubmitted Done Inline ActionsI'll change this in a future revision. delphij: I'll change this in a future revision. | |||||||||||
pauamma_gundo.comUnsubmitted Done Inline ActionsStill needed. Or did I misunderstand which "future revision" you meant? pauamma_gundo.com: Still needed. Or did I misunderstand which "future revision" you meant? | |||||||||||
delphijAuthorUnsubmitted Done Inline ActionsI meant that I'll amend this to "to match POSIX" before pushing to main (I'll need to amend .Dd date anyway). delphij: I meant that I'll amend this to "to match POSIX" before pushing to `main` (I'll need to amend `. | |||||||||||
pauamma_gundo.comUnsubmitted Done Inline Actions
OK then. Thanks. pauamma_gundo.com: > I meant that I'll amend this to "to match POSIX" before pushing to `main` (I'll need to amend… |
Bump date