From 3bdf7962a7cf5a73e2235d7af811ed310806e545 Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Tue, 19 Oct 2004 15:58:49 +0000 Subject: [PATCH] (scm_restricted_vector_sort_x): Validate startpos <= endpos. State inclusiveness/exclusiveness if bounds in docstring. --- libguile/sort.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libguile/sort.c b/libguile/sort.c index d5adb9525..ce6c4dbd3 100644 --- a/libguile/sort.c +++ b/libguile/sort.c @@ -286,7 +286,8 @@ compare_function (SCM less, unsigned int arg_nr, const char* fname) SCM_DEFINE (scm_restricted_vector_sort_x, "restricted-vector-sort!", 4, 0, 0, (SCM vec, SCM less, SCM startpos, SCM endpos), "Sort the vector @var{vec}, using @var{less} for comparing\n" - "the vector elements. @var{startpos} and @var{endpos} delimit\n" + "the vector elements. @var{startpos} (inclusively) and\n" + "@var{endpos} (exclusively) delimit\n" "the range of the vector which gets sorted. The return value\n" "is not specified.") #define FUNC_NAME s_scm_restricted_vector_sort_x @@ -300,7 +301,7 @@ SCM_DEFINE (scm_restricted_vector_sort_x, "restricted-vector-sort!", 4, 0, 0, vlen = SCM_VECTOR_LENGTH (vec); spos = scm_to_unsigned_integer (startpos, 0, vlen); - len = scm_to_unsigned_integer (endpos, 0, vlen) - spos; + len = scm_to_unsigned_integer (endpos, spos, vlen) - spos; quicksort (&vp[spos], len, cmp, less); scm_remember_upto_here_1 (vec);