summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-30 23:40:37 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-06-30 23:40:37 +0000
commit12b0ccc20483de26021d092155a722b22a225afe (patch)
treee39dee8ff864f39fbcc788e2006636605fdf52f9
parent64bcb87cc6cf6907108e76d51d9e43b305f73e38 (diff)
* 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
-rw-r--r--ChangeLog5
-rw-r--r--marshal.c10
2 files changed, 12 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 80f9d4247b..0255a35925 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/marshal.c b/marshal.c
index 24807fd529..bf76e6d524 100644
--- a/marshal.c
+++ b/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: