summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdlib')
-rw-r--r--lib/libc/stdlib/merge.c7
-rw-r--r--lib/libc/stdlib/qsort.34
2 files changed, 3 insertions, 8 deletions
diff --git a/lib/libc/stdlib/merge.c b/lib/libc/stdlib/merge.c
index 083a9642502ee..a47e3007290e6 100644
--- a/lib/libc/stdlib/merge.c
+++ b/lib/libc/stdlib/merge.c
@@ -111,9 +111,6 @@ mergesort(base, nmemb, size, cmp)
return (-1);
}
- if (nmemb == 0)
- return (0);
-
/*
* XXX
* Stupid subtraction for the Cray.
@@ -150,7 +147,7 @@ mergesort(base, nmemb, size, cmp)
sense = 0;
}
if (!big) { /* here i = 0 */
- while ((b += size) < t && cmp(q, b) >sense)
+LINEAR: while ((b += size) < t && cmp(q, b) >sense)
if (++i == 6) {
big = 1;
goto EXPONENTIAL;
@@ -171,7 +168,7 @@ EXPONENTIAL: for (i = size; ; i <<= 1)
goto FASTCASE;
} else
b = p;
- while (t > b+size) {
+SLOWCASE: while (t > b+size) {
i = (((t - b) / size) >> 1) * size;
if ((*cmp)(q, p = b + i) <= sense)
t = p;
diff --git a/lib/libc/stdlib/qsort.3 b/lib/libc/stdlib/qsort.3
index aa2609c7efb0a..4f449c7529170 100644
--- a/lib/libc/stdlib/qsort.3
+++ b/lib/libc/stdlib/qsort.3
@@ -162,9 +162,7 @@ is set to indicate the error.
.Sh ERRORS
The
.Fn heapsort
-and
-.Fn mergesort
-functions succeed unless:
+function succeeds unless:
.Bl -tag -width Er
.It Bq Er EINVAL
The