summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--lib.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 80d42b26..5690c89f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-03-16 Kaz Kylheku <kaz@kylheku.com>
+
+ * lib.c (quicksort): Bugfix: incorrect loop from 0 rather than from
+ leading to unbounded recursion.
+
2012-03-15 Kaz Kylheku <kaz@kylheku.com>
Version 61
diff --git a/lib.c b/lib.c
index 6a23761b..cc5e7ed3 100644
--- a/lib.c
+++ b/lib.c
@@ -3710,7 +3710,7 @@ static void quicksort(val vec, val lessfun, val keyfun, cnum from, cnum to)
swap(vec, num_fast(pivot), num_fast(to - 1));
- for (j = 0, i = 0; i < to; i++)
+ for (j = from, i = from; i < to - 1; i++)
if (funcall2(lessfun, funcall1(keyfun, ref(vec, num_fast(i))), pkval))
swap(vec, num_fast(i), num_fast(j++));