aboutsummaryrefslogtreecommitdiffstats
path: root/marshal.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-19 04:03:29 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-19 04:03:29 +0000
commit1dd06612a5fe377d191f5d88ffd598d9f39d6f1b (patch)
treebcd6485af110465b96b49e5eb659d92950f1ab43 /marshal.c
parent597aa8bafb91d648edad356db8748f724c6db1ed (diff)
downloadruby-1dd06612a5fe377d191f5d88ffd598d9f39d6f1b.tar.gz
marshal.c: no duplicated encoding
* marshal.c (w_object): do not dump encoding which is dumped with marshal_dump data. [ruby-core:54334] [Bug #8276] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'marshal.c')
-rw-r--r--marshal.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/marshal.c b/marshal.c
index 304e9d0a6b..d2a35fb4a1 100644
--- a/marshal.c
+++ b/marshal.c
@@ -598,7 +598,8 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
st_table *ivtbl = 0;
st_data_t num;
int hasiv = 0;
-#define has_ivars(obj, ivtbl) (((ivtbl) = rb_generic_ivar_table(obj)) != 0 || \
+#define has_ivars_noenc(obj, ivtbl) (((ivtbl) = rb_generic_ivar_table(obj)) != 0)
+#define has_ivars(obj, ivtbl) (has_ivars_noenc(obj, ivtbl) || \
(!SPECIAL_CONST_P(obj) && !ENCODING_IS_ASCII8BIT(obj)))
if (limit == 0) {
@@ -656,7 +657,7 @@ w_object(VALUE obj, struct dump_arg *arg, int limit)
v = rb_funcall2(obj, s_mdump, 0, 0);
check_dump_arg(arg, s_mdump);
- hasiv = has_ivars(v, ivtbl);
+ hasiv = has_ivars_noenc(v, ivtbl);
if (hasiv) w_byte(TYPE_IVAR, arg);
w_class(TYPE_USRMARSHAL, obj, arg, FALSE);
w_object(v, arg, limit);