summaryrefslogtreecommitdiff
path: root/struct.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-03-03 02:39:35 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-03-03 02:39:35 +0000
commit0861165bdcef50bb504526153d87d8e0a7be0140 (patch)
tree41d899ef727f1b9adbb8efdb349eb4853eb2db62 /struct.c
parent6bb525282cdd551bd240557daf019378ee211952 (diff)
*** empty log message ***
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'struct.c')
-rw-r--r--struct.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/struct.c b/struct.c
index 5220072d6a..1819c3c1dc 100644
--- a/struct.c
+++ b/struct.c
@@ -210,9 +210,9 @@ struct_alloc(klass, values)
else {
NEWOBJ(st, struct RStruct);
OBJSETUP(st, klass, T_STRUCT);
- st->len = n;
- st->ptr = 0; /* avoid GC crashing */
+ st->len = 0; /* avoid GC crashing */
st->ptr = ALLOC_N(VALUE, n);
+ st->len = n;
MEMCPY(st->ptr, RARRAY(values)->ptr, VALUE, RARRAY(values)->len);
memclear(st->ptr+RARRAY(values)->len, n - RARRAY(values)->len);
@@ -318,9 +318,9 @@ struct_clone(s)
{
NEWOBJ(st, struct RStruct);
CLONESETUP(st, s);
- st->len = RSTRUCT(s)->len;
- st->ptr = 0; /* avoid GC crashing */
+ st->len = 0; /* avoid GC crashing */
st->ptr = ALLOC_N(VALUE, RSTRUCT(s)->len);
+ st->len = RSTRUCT(s)->len;
MEMCPY(st->ptr, RSTRUCT(s)->ptr, VALUE, st->len);
return (VALUE)st;