summaryrefslogtreecommitdiff
path: root/stdlib
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1992-09-23 20:32:45 +0000
committerRoland McGrath <roland@gnu.org>1992-09-23 20:32:45 +0000
commit01d8cfe4db30f0d64a5b0a997d863da40b6f20e4 (patch)
treeb8334a354a234a78267fcde3438173900cebb36e /stdlib
parentbb50c3d4092ab663070710b693d62cdcc301473a (diff)
entered into RCS
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/qsort.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/stdlib/qsort.c b/stdlib/qsort.c
index 93dd3ec786..bc8d171b79 100644
--- a/stdlib/qsort.c
+++ b/stdlib/qsort.c
@@ -88,6 +88,10 @@ DEFUN(_quicksort, (pbase, total_elems, size, cmp),
char *pivot_buffer = (char *) __alloca (size);
CONST size_t max_thresh = MAX_THRESH * size;
+ if (total_elems == 0)
+ /* Avoid lossage with unsigned arithmetic below. */
+ return;
+
if (total_elems > MAX_THRESH)
{
char *lo = base_ptr;