summaryrefslogtreecommitdiff
path: root/marshal.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-08-28 15:58:35 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-08-28 15:58:35 +0000
commit9208c7471849a137297c262177cce70ef8c28de1 (patch)
tree4ec5a8fe9c8a009f4cc3adadc5c20bf6b0b0a8cc /marshal.c
parent5c70716bdc3796ec62400b939dc2f5450def6b87 (diff)
* marshal.c (r_object): yield loaded objects, not intermediates.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'marshal.c')
-rw-r--r--marshal.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/marshal.c b/marshal.c
index 96ab7fc..3b4761e 100644
--- a/marshal.c
+++ b/marshal.c
@@ -814,8 +814,9 @@ r_ivar(obj, arg)
}
static VALUE
-r_object(arg)
+r_object0(arg, proc)
struct load_arg *arg;
+ VALUE proc;
{
VALUE v = Qnil;
int type = r_byte(arg);
@@ -831,15 +832,15 @@ r_object(arg)
return v;
case TYPE_IVAR:
- v = r_object(arg);
+ v = r_object0(arg, 0);
r_ivar(v, arg);
- return v;
+ break;
case TYPE_UCLASS:
{
VALUE c = rb_path2class(r_unique(arg));
- v = r_object(arg);
+ v = r_object0(arg, 0);
if (rb_special_const_p(v) || TYPE(v) == T_OBJECT || TYPE(v) == T_CLASS) {
format_error:
rb_raise(rb_eArgError, "dump format error (user class)");
@@ -850,8 +851,8 @@ r_object(arg)
if (TYPE(v) != TYPE(tmp)) goto format_error;
}
RBASIC(v)->klass = c;
- return v;
}
+ break;
case TYPE_NIL:
v = Qnil;
@@ -1061,7 +1062,7 @@ r_object(arg)
"class %s needs to have instance method `_load_data'",
rb_class2name(klass));
}
- rb_funcall(v, s_load_data, 1, r_object(arg));
+ rb_funcall(v, s_load_data, 1, r_object0(arg, 0));
}
break;
@@ -1108,13 +1109,20 @@ r_object(arg)
rb_raise(rb_eArgError, "dump format error(0x%x)", type);
break;
}
- if (arg->proc) {
- rb_funcall(arg->proc, rb_intern("yield"), 1, v);
+ if (proc) {
+ rb_funcall(proc, rb_intern("yield"), 1, v);
}
return v;
}
static VALUE
+r_object(arg)
+ struct load_arg *arg;
+{
+ return r_object0(arg, arg->proc);
+}
+
+static VALUE
load(arg)
struct load_arg *arg;
{