summaryrefslogtreecommitdiff
path: root/marshal.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-08 05:20:41 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-08 05:20:41 (GMT)
commit1fadd438811426523a79ccea93a45f0a202a50f6 (patch)
tree4b6ed75880270e5280b4f051d96945f48ea20e35 /marshal.c
parent95184065445e2888a624911214db67fe3695ec85 (diff)
marshal.c: skip internal names
* marshal.c (w_objivar): skip internal instance variables in T_OBJECT too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'marshal.c')
-rw-r--r--marshal.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/marshal.c b/marshal.c
index 3b7f79d..8bc8019 100644
--- a/marshal.c
+++ b/marshal.c
@@ -637,16 +637,9 @@ w_ivar(st_index_t num, VALUE ivobj, VALUE encname, struct dump_call_arg *arg)
static void
w_objivar(VALUE obj, struct dump_call_arg *arg)
{
- VALUE *ptr;
- long i, len, num;
-
- len = ROBJECT_NUMIV(obj);
- ptr = ROBJECT_IVPTR(obj);
- num = 0;
- for (i = 0; i < len; i++)
- if (ptr[i] != Qundef)
- num += 1;
+ st_data_t num = 0;
+ rb_ivar_foreach(obj, obj_count_ivars, (st_data_t)&num);
w_long(num, arg->arg);
if (num != 0) {
rb_ivar_foreach(obj, w_obj_each, (st_data_t)arg);