mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-11 14:21:10 +02:00
(scm_restricted_vector_sort_x): Validate startpos <= endpos. State
inclusiveness/exclusiveness if bounds in docstring.
This commit is contained in:
parent
9b0018a113
commit
3bdf7962a7
1 changed files with 3 additions and 2 deletions
|
@ -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_DEFINE (scm_restricted_vector_sort_x, "restricted-vector-sort!", 4, 0, 0,
|
||||||
(SCM vec, SCM less, SCM startpos, SCM endpos),
|
(SCM vec, SCM less, SCM startpos, SCM endpos),
|
||||||
"Sort the vector @var{vec}, using @var{less} for comparing\n"
|
"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"
|
"the range of the vector which gets sorted. The return value\n"
|
||||||
"is not specified.")
|
"is not specified.")
|
||||||
#define FUNC_NAME s_scm_restricted_vector_sort_x
|
#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);
|
vlen = SCM_VECTOR_LENGTH (vec);
|
||||||
|
|
||||||
spos = scm_to_unsigned_integer (startpos, 0, vlen);
|
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);
|
quicksort (&vp[spos], len, cmp, less);
|
||||||
scm_remember_upto_here_1 (vec);
|
scm_remember_upto_here_1 (vec);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue