summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2012-03-16 10:56:12 -0700
committerKaz Kylheku <kaz@kylheku.com>2012-03-16 10:56:12 -0700
commit695a0a8f17e88a350042a03643a924dee4cbe0b5 (patch)
tree6997ae0469629d8783ef913c99f1bd57c10b7e10
parentbdb1339f8b042fdf752f3c5503371c42512d223e (diff)
downloadtxr-695a0a8f17e88a350042a03643a924dee4cbe0b5.tar.gz
txr-695a0a8f17e88a350042a03643a924dee4cbe0b5.tar.bz2
txr-695a0a8f17e88a350042a03643a924dee4cbe0b5.zip
* lib.c (quicksort): Bugfix: incorrect loop from 0 rather than from
leading to unbounded recursion.
-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++));