ruby-changes:56313
From: Nobuyoshi <ko1@a...>
Date: Mon, 1 Jul 2019 16:25:56 +0900 (JST)
Subject: [ruby-changes:56313] Nobuyoshi Nakada: 0b1e26398e (master): Hoisted out w_ivar_each
https://git.ruby-lang.org/ruby.git/commit/?id=0b1e26398e From 0b1e26398e018116180bf41cb63887f77d5d1b82 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Mon, 1 Jul 2019 16:18:51 +0900 Subject: Hoisted out w_ivar_each diff --git a/marshal.c b/marshal.c index a1ee01e..c89ef96 100644 --- a/marshal.c +++ b/marshal.c @@ -665,13 +665,20 @@ has_ivars(VALUE obj, VALUE encname, VALUE *ivobj) https://github.com/ruby/ruby/blob/trunk/marshal.c#L665 } static void +w_ivar_each(VALUE obj, st_index_t num, struct dump_call_arg *arg) +{ + struct w_ivar_arg ivarg = {arg, num}; + if (!num) return; + rb_ivar_foreach(obj, w_obj_each, (st_data_t)&ivarg); +} + +static void w_ivar(st_index_t num, VALUE ivobj, VALUE encname, struct dump_call_arg *arg) { w_long(num, arg->arg); w_encoding(encname, arg); if (ivobj != Qundef) { - struct w_ivar_arg ivarg = {arg, num}; - rb_ivar_foreach(ivobj, w_obj_each, (st_data_t)&ivarg); + w_ivar_each(ivobj, num, arg); } } @@ -682,10 +689,7 @@ w_objivar(VALUE obj, struct dump_call_arg *arg) https://github.com/ruby/ruby/blob/trunk/marshal.c#L689 rb_ivar_foreach(obj, obj_count_ivars, (st_data_t)&num); w_long(num, arg->arg); - if (num != 0) { - struct w_ivar_arg ivarg = {arg, num}; - rb_ivar_foreach(obj, w_obj_each, (st_data_t)&ivarg); - } + w_ivar_each(obj, num, arg); } static void -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/