mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-07-03 08:10:31 +02:00
Bounds error in vector_handle_ref/set is implementation error
* libguile/vectors.c: bounds are already checked unless impl is called directly, so don't check again. * libguile/strings.c, libguile/bitvectors.c: fix comments.
This commit is contained in:
parent
86263a20cd
commit
d2053db7d8
3 changed files with 5 additions and 9 deletions
|
@ -852,8 +852,7 @@ scm_istr2bve (SCM str)
|
|||
return res;
|
||||
}
|
||||
|
||||
/* FIXME: We know that bitvector is such, so can skip the checks in
|
||||
scm_c_bitvector_... */
|
||||
/* FIXME: We know that bitvector is such, so can skip the checks */
|
||||
static SCM
|
||||
bitvector_handle_ref (SCM bitvector, size_t pos)
|
||||
{
|
||||
|
|
|
@ -2460,8 +2460,7 @@ scm_i_get_substring_spec (size_t len,
|
|||
*cend = scm_to_unsigned_integer (end, *cstart, len);
|
||||
}
|
||||
|
||||
/* FIXME: We know that bitvector is such, so can skip the checks in
|
||||
scm_c_string_... */
|
||||
/* FIXME: We know that string is such, so can skip checks */
|
||||
static SCM
|
||||
string_handle_ref (SCM string, size_t index)
|
||||
{
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
|
||||
#include "libguile/bdw-gc.h"
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
#define VECTOR_MAX_LENGTH (SCM_T_BITS_MAX >> 8)
|
||||
|
@ -436,16 +436,14 @@ SCM_DEFINE (scm_vector_move_right_x, "vector-move-right!", 5, 0, 0,
|
|||
static SCM
|
||||
vector_handle_ref (SCM vector, size_t idx)
|
||||
{
|
||||
if (idx >= SCM_I_VECTOR_LENGTH (vector))
|
||||
scm_out_of_range ("vector-handle-ref", scm_from_size_t (idx));
|
||||
assert (idx < SCM_I_VECTOR_LENGTH (vector));
|
||||
return SCM_I_VECTOR_WELTS(vector)[idx];
|
||||
}
|
||||
|
||||
static void
|
||||
vector_handle_set (SCM vector, size_t idx, SCM val)
|
||||
{
|
||||
if (idx >= SCM_I_VECTOR_LENGTH (vector))
|
||||
scm_out_of_range ("vector-handle-set!", scm_from_size_t (idx));
|
||||
assert (idx < SCM_I_VECTOR_LENGTH (vector));
|
||||
SCM_I_VECTOR_WELTS(vector)[idx] = val;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue