1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

Fix off-by-one error in the off-by-one fix of `make-srfi-4-vector'.

This is a followup to d900a8557d ("Fix
off-by-one error when initializing vectors in `make-srfi-4-vector'.").

* libguile/srfi-4.c (scm_make_srfi_4_vector): Don't initialize RET when
  LEN is zero.
This commit is contained in:
Ludovic Courtès 2010-03-03 10:18:41 +01:00
parent 3278efd3fa
commit dc327575a8

View file

@ -257,7 +257,8 @@ SCM_DEFINE (scm_make_srfi_4_vector, "make-srfi-4-vector", 2, 1, 0,
case SCM_ARRAY_ELEMENT_TYPE_C64:
{
SCM ret = scm_i_make_typed_bytevector (scm_to_size_t (len), i);
if (SCM_UNBNDP (fill))
if (SCM_UNBNDP (fill) || scm_is_eq (len, SCM_INUM0))
; /* pass */
else if (scm_is_true (scm_zero_p (fill)))
memset (SCM_BYTEVECTOR_CONTENTS (ret), 0,