seqlib: stable-sort: fix bogus optimization's in #'stable-sort.

This patch fixes bug #292, where #'stable-sort weren't sorting in
place strings, when provided with predicate #'char-greaterp. This was
due to optimization, where if sequence was of type string or
vector-bit function #'sort was called (which invoked #'quicksort),
while for the rest cases merge-sort is used.

Optimization is reduced to use quicksort only on vector-bit sequences.

See: http://sourceforge.net/p/ecls/bugs/292/
This commit is contained in:
Daniel Kochmański 2015-02-24 13:30:49 +01:00
parent 642b4f9e71
commit 4570e2192c

View file

@ -882,7 +882,7 @@ SEQUENCE. See SORT."
predicate (si::coerce-to-function predicate))
(if (listp sequence)
(list-merge-sort sequence predicate key)
(if (or (stringp sequence) (bit-vector-p sequence))
(if (bit-vector-p sequence)
(sort sequence predicate :key key)
(coerce (list-merge-sort (coerce sequence 'list)
predicate