From 9208c7471849a137297c262177cce70ef8c28de1 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 28 Aug 2002 15:58:35 +0000 Subject: [PATCH] * 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 --- ChangeLog | 4 ++++ marshal.c | 24 ++++++++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2c2ba5a991..63bd0961b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Aug 29 00:55:55 2002 Nobuyoshi Nakada + + * marshal.c (r_object): yield loaded objects, not intermediates. + Wed Aug 28 23:59:15 2002 Michal Rokos * signal.c: remove #ifdef SIGINT for struct signals. diff --git a/marshal.c b/marshal.c index 96ab7fc6a4..3b4761ea7c 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,12 +1109,19 @@ 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;