summaryrefslogtreecommitdiff
path: root/ext/marshal/marshal.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/marshal/marshal.c')
-rw-r--r--ext/marshal/marshal.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/ext/marshal/marshal.c b/ext/marshal/marshal.c
index 47cb0fcd2a..a74ecd70eb 100644
--- a/ext/marshal/marshal.c
+++ b/ext/marshal/marshal.c
@@ -620,7 +620,9 @@ r_object(arg)
case TYPE_FLOAT:
{
+#ifndef atof
double atof();
+#endif
char *buf;
r_bytes(buf, arg);
@@ -695,15 +697,17 @@ r_object(arg)
len = r_long(arg);
values = ary_new2(len);
- i = 0;
+ for (i=0; i<len; i++) {
+ ary_push(values, Qnil);
+ }
+ v = struct_alloc(class, values);
+ r_regist(v, arg);
for (i=0; i<len; i++) {
ID slot = r_symbol(arg);
if (RARRAY(mem)->ptr[i] != INT2FIX(slot))
TypeError("struct not compatible");
- ary_push(values, r_object(arg));
+ struct_aset(v, INT2FIX(i), r_object(arg));
}
- v = struct_alloc(class, values);
- st_insert(arg->data, num, v); /* re-regist */
return v;
}
break;