mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* marshal.c (w_object): suppress empty instance variable entry on
compatible dump objects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
64bcb87cc6
commit
12b0ccc204
2 changed files with 12 additions and 3 deletions
|
@ -1,3 +1,8 @@
|
|||
Thu Jul 1 08:40:26 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* marshal.c (w_object): suppress empty instance variable entry on
|
||||
compatible dump objects.
|
||||
|
||||
Wed Jun 30 07:29:11 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* test/ruby/test_rubyoptions.rb (test_script_from_stdin): by using
|
||||
|
|
10
marshal.c
10
marshal.c
|
@ -607,9 +607,6 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
|
|||
return;
|
||||
}
|
||||
|
||||
if ((hasiv = has_ivars(obj, ivtbl)) != 0) {
|
||||
w_byte(TYPE_IVAR, arg);
|
||||
}
|
||||
if (obj == Qnil) {
|
||||
w_byte(TYPE_NIL, arg);
|
||||
}
|
||||
|
@ -646,6 +643,8 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
|
|||
|
||||
v = rb_funcall(obj, s_mdump, 0, 0);
|
||||
check_dump_arg(arg, s_mdump);
|
||||
hasiv = has_ivars(obj, ivtbl);
|
||||
if (hasiv) w_byte(TYPE_IVAR, arg);
|
||||
w_class(TYPE_USRMARSHAL, obj, arg, FALSE);
|
||||
w_object(v, arg, limit);
|
||||
if (hasiv) w_ivar(obj, ivtbl, &c_arg);
|
||||
|
@ -661,6 +660,8 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
|
|||
if (TYPE(v) != T_STRING) {
|
||||
rb_raise(rb_eTypeError, "_dump() must return string");
|
||||
}
|
||||
hasiv = has_ivars(obj, ivtbl);
|
||||
if (hasiv) w_byte(TYPE_IVAR, arg);
|
||||
if ((hasiv2 = has_ivars(v, ivtbl2)) != 0 && !hasiv) {
|
||||
w_byte(TYPE_IVAR, arg);
|
||||
}
|
||||
|
@ -678,6 +679,7 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
|
|||
|
||||
st_add_direct(arg->data, obj, arg->data->num_entries);
|
||||
|
||||
hasiv = has_ivars(obj, ivtbl);
|
||||
{
|
||||
st_data_t compat_data;
|
||||
rb_alloc_func_t allocator = rb_get_alloc_func(RBASIC(obj)->klass);
|
||||
|
@ -688,8 +690,10 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
|
|||
VALUE real_obj = obj;
|
||||
obj = compat->dumper(real_obj);
|
||||
st_insert(arg->compat_tbl, (st_data_t)obj, (st_data_t)real_obj);
|
||||
if (obj != real_obj && !ivtbl) hasiv = 0;
|
||||
}
|
||||
}
|
||||
if (hasiv) w_byte(TYPE_IVAR, arg);
|
||||
|
||||
switch (BUILTIN_TYPE(obj)) {
|
||||
case T_CLASS:
|
||||
|
|
Loading…
Reference in a new issue