summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@unquote.local>2008-04-10 01:27:19 +0200
committerLudovic Courtès <ludo@gnu.org>2008-04-10 23:21:30 +0200
commit4125c767611836b984749045d4566d3d1c9ed393 (patch)
treea93fe0f4ef1fb05b93bf5c4d76b5ed464b18e085
parent54ee7cdfce93366c10a28e54ac14090b8c94b91b (diff)
downloadguile-4125c767611836b984749045d4566d3d1c9ed393.tar.gz
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.
-rw-r--r--libguile/ChangeLog5
-rw-r--r--libguile/goops.c9
2 files changed, 11 insertions, 3 deletions
diff --git a/libguile/ChangeLog b/libguile/ChangeLog
index 3e7b39820..cce8dbb3b 100644
--- a/libguile/ChangeLog
+++ b/libguile/ChangeLog
@@ -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.
diff --git a/libguile/goops.c b/libguile/goops.c
index a6769cd15..abb96abce 100644
--- a/libguile/goops.c
+++ b/libguile/goops.c
@@ -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),