From a75923bb037e14730d8abbfee5a383d35e6427ba Mon Sep 17 00:00:00 2001 From: Dirk Herrmann Date: Wed, 26 Jul 2000 09:20:09 +0000 Subject: [PATCH] * Fix vector initialization. --- libguile/ChangeLog | 5 +++++ libguile/vectors.c | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/libguile/ChangeLog b/libguile/ChangeLog index ca986cfdd..64f58afba 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,8 @@ +2000-07-26 Dirk Herrmann + + * vectors.c (scm_make_vector): Fix the initialization order of + the vector such that the type cell is initialized last. + 2000-07-26 Dirk Herrmann * struct.[ch] (scm_struct_init): Made static. Fixed not to rely diff --git a/libguile/vectors.c b/libguile/vectors.c index 1c59b96c1..e2e94e156 100644 --- a/libguile/vectors.c +++ b/libguile/vectors.c @@ -268,10 +268,10 @@ SCM_DEFINE (scm_make_vector, "make-vector", 1, 1, 0, SCM_NEWCELL(v); SCM_DEFER_INTS; SCM_SETCHARS(v, scm_must_malloc(i?(long)(i*sizeof(SCM)):1L, FUNC_NAME)); - SCM_SETLENGTH(v, i, scm_tc7_vector); velts = SCM_VELTS(v); - j = 0; - while(--i >= j) (velts)[i] = fill; + for (j = 0; j < i; ++j) + velts[j] = fill; + SCM_SETLENGTH(v, i, scm_tc7_vector); SCM_ALLOW_INTS; return v; }