summaryrefslogtreecommitdiff
path: root/marshal.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-04-09 05:08:25 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-04-09 05:08:25 +0000
commitdb24e481b356aab7a2f589f096f8672b42be42c0 (patch)
tree34f7112e623f732f2716f5020685725b05525885 /marshal.c
parentf92f8b565f2e749c58f0998fdcf6f23d52096fe3 (diff)
* marshal.c (w_object): preserve extended module on struct.
(ruby-bugs-ja:PR#422) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'marshal.c')
-rw-r--r--marshal.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/marshal.c b/marshal.c
index b8319dc..27d038a 100644
--- a/marshal.c
+++ b/marshal.c
@@ -505,13 +505,12 @@ w_object(obj, arg, limit)
break;
case T_STRUCT:
- w_byte(TYPE_STRUCT, arg);
+ w_class(TYPE_STRUCT, obj, arg);
{
long len = RSTRUCT(obj)->len;
VALUE mem;
long i;
- w_unique(rb_obj_classname(obj), arg);
w_long(len, arg);
mem = rb_struct_iv_get(rb_obj_class(obj), "__member__");
if (mem == Qnil) {
@@ -529,20 +528,20 @@ w_object(obj, arg, limit)
w_ivar(ROBJECT(obj)->iv_tbl, &c_arg);
break;
- case T_DATA:
- {
- VALUE v;
-
- w_class(TYPE_DATA, obj, arg);
- if (!rb_respond_to(obj, s_dump_data)) {
- rb_raise(rb_eTypeError,
- "class %s needs to have instance method `_dump_data'",
- rb_obj_classname(obj));
- }
- v = rb_funcall(obj, s_dump_data, 0);
- w_object(v, arg, limit);
- }
- break;
+ case T_DATA:
+ {
+ VALUE v;
+
+ w_class(TYPE_DATA, obj, arg);
+ if (!rb_respond_to(obj, s_dump_data)) {
+ rb_raise(rb_eTypeError,
+ "class %s needs to have instance method `_dump_data'",
+ rb_obj_classname(obj));
+ }
+ v = rb_funcall(obj, s_dump_data, 0);
+ w_object(v, arg, limit);
+ }
+ break;
default:
rb_raise(rb_eTypeError, "can't dump %s",
@@ -1185,7 +1184,6 @@ marshal_load(argc, argv)
VALUE port, proc;
int major, minor;
VALUE v;
- OpenFile *fptr;
struct load_arg arg;
volatile VALUE hash; /* protect from GC */