struct.c: trivial optimization

* struct.c (rb_struct_set): get rid of calling rb_frame_this_func
  twice.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-12-08 04:18:01 +00:00
parent f975d1153c
commit 07bb8b4cce

View File

@ -150,12 +150,13 @@ rb_struct_set(VALUE obj, VALUE val)
VALUE members, slot, fsym;
long i, len;
ID fid = rb_frame_this_func();
ID this_func = fid;
members = rb_struct_members(obj);
len = RARRAY_LEN(members);
rb_struct_modify(obj);
fid = rb_id_attrget(fid);
if (!fid) not_a_member(rb_frame_this_func());
if (!fid) not_a_member(this_func);
fsym = ID2SYM(fid);
for (i=0; i<len; i++) {
slot = RARRAY_AREF(members, i);