fixed qsort() for 0 elements

This commit is contained in:
eck 1990-08-28 14:03:24 +00:00
parent ebc37d14b4
commit 12114e4e08

View File

@ -15,6 +15,8 @@ void
qsort(void *base, size_t nel, size_t width,
int (*compar)(const void *, const void *))
{
/* when nel is 0, the expression '(nel - 1) * width' is wrong */
if (!nel) return;
qcompar = (int (*)(const char *, const char *)) compar;
qsort1(base, (char *)base + (nel - 1) * width, width);
}