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:
parent
f975d1153c
commit
07bb8b4cce
3
struct.c
3
struct.c
@ -150,12 +150,13 @@ rb_struct_set(VALUE obj, VALUE val)
|
|||||||
VALUE members, slot, fsym;
|
VALUE members, slot, fsym;
|
||||||
long i, len;
|
long i, len;
|
||||||
ID fid = rb_frame_this_func();
|
ID fid = rb_frame_this_func();
|
||||||
|
ID this_func = fid;
|
||||||
|
|
||||||
members = rb_struct_members(obj);
|
members = rb_struct_members(obj);
|
||||||
len = RARRAY_LEN(members);
|
len = RARRAY_LEN(members);
|
||||||
rb_struct_modify(obj);
|
rb_struct_modify(obj);
|
||||||
fid = rb_id_attrget(fid);
|
fid = rb_id_attrget(fid);
|
||||||
if (!fid) not_a_member(rb_frame_this_func());
|
if (!fid) not_a_member(this_func);
|
||||||
fsym = ID2SYM(fid);
|
fsym = ID2SYM(fid);
|
||||||
for (i=0; i<len; i++) {
|
for (i=0; i<len; i++) {
|
||||||
slot = RARRAY_AREF(members, i);
|
slot = RARRAY_AREF(members, i);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user