summaryrefslogtreecommitdiffstats
path: root/lib.c
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 /lib.c
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.
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c2
1 files changed, 1 insertions, 1 deletions
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++));