entered into RCS
authorroland <roland>
Wed, 23 Sep 1992 20:32:45 +0000 (20:32 +0000)
committerroland <roland>
Wed, 23 Sep 1992 20:32:45 +0000 (20:32 +0000)
stdlib/qsort.c

index 93dd3ec..bc8d171 100644 (file)
@@ -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;