From 695a0a8f17e88a350042a03643a924dee4cbe0b5 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 16 Mar 2012 10:56:12 -0700 Subject: * lib.c (quicksort): Bugfix: incorrect loop from 0 rather than from leading to unbounded recursion. --- ChangeLog | 5 +++++ lib.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 80d42b26..5690c89f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-03-16 Kaz Kylheku + + * lib.c (quicksort): Bugfix: incorrect loop from 0 rather than from + leading to unbounded recursion. + 2012-03-15 Kaz Kylheku 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++)); -- cgit v1.2.3