diff options
author | Marius Vollmer <mvo@zagadka.de> | 2004-10-19 15:58:49 +0000 |
---|---|---|
committer | Marius Vollmer <mvo@zagadka.de> | 2004-10-19 15:58:49 +0000 |
commit | 3bdf7962a7cf5a73e2235d7af811ed310806e545 (patch) | |
tree | 59ca8ea20ff275db0c680e08a86eab8bf5a9749b | |
parent | 9b0018a11321247054f43156e30c89aa02d385bb (diff) | |
download | guile-3bdf7962a7cf5a73e2235d7af811ed310806e545.tar.gz |
(scm_restricted_vector_sort_x): Validate startpos <= endpos. State
inclusiveness/exclusiveness if bounds in docstring.
-rw-r--r-- | libguile/sort.c | 5 |
1 files 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); |