summaryrefslogtreecommitdiff
path: root/ext/tk
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-27 09:57:58 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-09-27 09:57:58 +0000
commitdca6009c3ee9e04bde94c17cfc8526673b4e6988 (patch)
treece93d1d64f78e4295ad3f63fa4b00059088a4ad6 /ext/tk
parent05b844723beff79b7df76f7b9d180f8d8e65f5a5 (diff)
tkutil.c: use local variables
* ext/tk/tkutil/tkutil.c (cbsubst_table_setup): use local variables instead of repeating RARRAY_PTR. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk')
-rw-r--r--ext/tk/tkutil/tkutil.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/ext/tk/tkutil/tkutil.c b/ext/tk/tkutil/tkutil.c
index c104bbbd99..676581d641 100644
--- a/ext/tk/tkutil/tkutil.c
+++ b/ext/tk/tkutil/tkutil.c
@@ -1615,14 +1615,15 @@ cbsubst_table_setup(argc, argv, self)
*/
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);