1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-11 22:31:12 +02:00

initialize 'u' slots to 0, not SCM_UNPACK(SCM_GOOPS_UNBOUND)

* goops.c (wrap_init): Initialize 'u' slots to 0, not some random
SCM value.
This commit is contained in:
Andy Wingo 2008-04-10 01:27:19 +02:00 committed by Ludovic Courtès
parent d5afe07f3b
commit 597618822f
2 changed files with 11 additions and 3 deletions

View file

@ -1,6 +1,9 @@
2008-04-10 Andy Wingo <wingo@pobox.com>
* libguile/goops.c (get_slot_value, set_slot_value): In the struct
* goops.c (wrap_init): Initialize 'u' slots to 0, not some random
SCM value.
* goops.c (get_slot_value, set_slot_value): In the struct
allocation case, don't poke the slots array directly -- we should
go through struct-ref/struct-set! code so that we get the
permissions and allocation ('u' versus 'p') correct.

View file

@ -1507,10 +1507,15 @@ static SCM
wrap_init (SCM class, SCM *m, long n)
{
long i;
scm_t_bits slayout = SCM_STRUCT_DATA (class)[scm_vtable_index_layout];
const char *layout = scm_i_symbol_chars (SCM_PACK (slayout));
/* Set all slots to unbound */
/* Set all SCM-holding slots to unbound */
for (i = 0; i < n; i++)
m[i] = SCM_GOOPS_UNBOUND;
if (layout[i*2] == 'p')
m[i] = SCM_GOOPS_UNBOUND;
else
m[i] = 0;
return scm_double_cell ((((scm_t_bits) SCM_STRUCT_DATA (class))
| scm_tc3_struct),