Home | History | Annotate | Download | only in stdlib
History log of /src/lib/libc/stdlib/merge.c
RevisionDateAuthorComments
 1.17  02-Mar-2025  riastradh libc: New _r variants of heapsort, mergesort, qsort.

Also kheapsort_r for kernel/standalone use.

These variants allow the caller to pass a cookie through to the
comparison function, e.g. if you want to sort an array of indices
into a buffer.

qsort_r is new in POSIX.1-2024; the others are obvious analogues of
our nonstandard extensions for heapsort and mergesort.

PR lib/58931: qsort_r() missing
 1.16  23-May-2018  joerg branches: 1.16.14;
Simplify to avoid pointless null pointer arithmetic.
 1.15  12-Aug-2017  ginsbach branches: 1.15.2;
PR lib/50316: Gracefully handle a zero number of members argument.

Taken from FreeBSD (which fixed this same issue long ago).

XXX: pullup-8
XXX: pullup-7
XXX: pullup-6
 1.14  13-Mar-2012  christos branches: 1.14.10; 1.14.24;
PR/45989: Martin Husemann: lint invocation does include -w only on i386

- turn lint -w for all the platforms after fixing the lint warnings.
- add _DIAGASSERTS() for casts that would assign values to types that
would not fit.
- change types, add casts
- change into ansii prototypes
- turn on _DIAGNOSTIC for libc (during current, to be eliminated for release
builds)

approved by core@
 1.13  18-May-2011  dsl branches: 1.13.4; 1.13.6;
Remove __P()
 1.12  12-Feb-2009  lukem fix sign-compare issue
 1.11  07-Aug-2003  agc branches: 1.11.42;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.10  22-Jan-2000  mycroft Delint.
Remove trailing ; from uses of __weak_alias(). The macro inserts this if
needed.
 1.9  20-Sep-1999  lukem back out the #ifdef _DIAGNOSTIC argument checks; too many people complained.
_DIAGASSERT() is still retained.
 1.8  16-Sep-1999  lukem * use _DIAGASSERT() to check pointer arguments against NULL and file
descriptors against -1 (as appropriate).
* add actual checks which to detect stuff that would trigger_DIAGASSERT(),
and attempt to return a sane error condition.
* knf some code
* remove some `register' decls.

the first two items result in the addition of code similar to the
following in various functions:

_DIAGASSERT(path != NULL)
#ifdef _DIAGNOSTIC
if (path == NULL) {
errno = EFAULT;
return (-1);
}
#endif
 1.7  15-Nov-1998  christos delint
 1.6  03-Feb-1998  perry remove obsolete register declarations
 1.5  21-Jul-1997  jtc If port provides __weak_alias(), provide an Standard C and POSIX pure
identifier namespace by renaming non standard functions and variables
such that they have a leading underscore. The library will use those
names internally. Weak aliases are used to provide the original names
to the API.

This is only the first part of this change. It is most of the functions
which are implemented in C for all NetBSD ports. Subsequent changes are
to add the same support to the remaining C files, to assembly files, and
to the automagically generated assembly source used for system calls.
When all of the above is done, ports with weak alias support should add
a definition for __weak_alias to <sys/cdefs.h>.
 1.4  13-Jul-1997  christos Add local.h for local prototypes.
Fix namespace issues for strtoq and strtouq
Fix gcc warnings.
Fix RCSID's
 1.3  28-Dec-1995  thorpej branches: 1.3.2;
New-style RCS ids.
 1.2  16-Jun-1994  mycroft Add RCS ids.
 1.1  16-Jun-1994  mycroft branches: 1.1.1;
Initial revision
 1.1.1.1  16-Jun-1994  mycroft Import from 4.4-Lite.
 1.3.2.1  18-Sep-1996  jtc snapshot namespace cleanup: stdlib
 1.11.42.1  13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.13.6.1  31-Aug-2017  martin Pull up following revision(s) (requested by ginsbach in ticket #1495):
lib/libc/stdlib/merge.c: revision 1.15
PR lib/50316: Gracefully handle a zero number of members argument.
Taken from FreeBSD (which fixed this same issue long ago).
XXX: pullup-8
XXX: pullup-7
XXX: pullup-6
 1.13.4.1  17-Apr-2012  yamt sync with head
 1.14.24.1  20-Aug-2017  snj Pull up following revision(s) (requested by ginsbach in ticket #214):
lib/libc/stdlib/merge.c: revision 1.15
PR lib/50316: Gracefully handle a zero number of members argument.
Taken from FreeBSD (which fixed this same issue long ago).
 1.14.10.1  04-Sep-2017  snj Pull up following revision(s) (requested by ginsbach in ticket #1495):
lib/libc/stdlib/merge.c: revision 1.15
PR lib/50316: Gracefully handle a zero number of members argument.
Taken from FreeBSD (which fixed this same issue long ago).
 1.15.2.1  25-Jun-2018  pgoyette Sync with HEAD
 1.16.14.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed