ruby-changes:39876
From: nobu <ko1@a...>
Date: Sun, 27 Sep 2015 18:58:18 +0900 (JST)
Subject: [ruby-changes:39876] nobu:r51957 (trunk): tkutil.c: use local variables
nobu 2015-09-27 18:57:58 +0900 (Sun, 27 Sep 2015) New Revision: 51957 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51957 Log: tkutil.c: use local variables * ext/tk/tkutil/tkutil.c (cbsubst_table_setup): use local variables instead of repeating RARRAY_PTR. Modified files: trunk/ext/tk/tkutil/tkutil.c Index: ext/tk/tkutil/tkutil.c =================================================================== --- ext/tk/tkutil/tkutil.c (revision 51956) +++ ext/tk/tkutil/tkutil.c (revision 51957) @@ -1615,14 +1615,15 @@ cbsubst_table_setup(argc, argv, self) https://github.com/ruby/ruby/blob/trunk/ext/tk/tkutil/tkutil.c#L1615 */ len = RARRAY_LEN(proc_inf); for(idx = 0; idx < len; idx++) { + VALUE type, proc; inf = RARRAY_PTR(proc_inf)[idx]; if (!RB_TYPE_P(inf, T_ARRAY)) continue; if (RARRAY_LEN(inf) < 2) continue; - rb_hash_aset(subst_inf->proc, - (RB_TYPE_P(RARRAY_PTR(inf)[0], T_STRING)? - INT2FIX(*(RSTRING_PTR(RARRAY_PTR(inf)[0]))) : - RARRAY_PTR(inf)[0]), - RARRAY_PTR(inf)[1]); + type = rb_ary_entry(inf, 0); + proc = rb_ary_entry(inf, 1); + if (RB_TYPE_P(type, T_STRING)) + type = INT2FIX(*(RSTRING_PTR(type))); + rb_hash_aset(subst_inf->proc, type, proc); } rb_const_set(self, ID_SUBST_INFO, cbsubst_obj); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/