X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/9385eb3d10ebe5eb398c52040ec3dbfba9b0cdcf..5f4d86c1219d56604890d932a3152b3b5dd15b55:/stdlib/FreeBSD/radixsort.c diff --git a/stdlib/FreeBSD/radixsort.c b/stdlib/FreeBSD/radixsort.c index 7f14966..5f9eaeb 100644 --- a/stdlib/FreeBSD/radixsort.c +++ b/stdlib/FreeBSD/radixsort.c @@ -38,7 +38,7 @@ static char sccsid[] = "@(#)radixsort.c 8.2 (Berkeley) 4/28/95"; #endif /* LIBC_SCCS and not lint */ #include -__FBSDID("$FreeBSD: src/lib/libc/stdlib/radixsort.c,v 1.6 2002/03/22 09:18:34 obrien Exp $"); +__FBSDID("$FreeBSD: src/lib/libc/stdlib/radixsort.c,v 1.7 2003/11/11 04:59:23 kientzle Exp $"); /* * Radixsort routines. @@ -176,6 +176,17 @@ r_sort_a(a, n, i, tr, endch) } } + /* + * Special case: if all strings have the same + * character at position i, move on to the next + * character. + */ + if (nc == 1 && count[bmin] == n) { + push(a, n, i+1); + nc = count[bmin] = 0; + continue; + } + /* * Set top[]; push incompletely sorted bins onto stack. * top[] = pointers to last out-of-place element in bins.