Skip to content

Commit

Permalink
eval.c: invariant IDs
Browse files Browse the repository at this point in the history
* eval.c (rb_mod_include, rb_obj_extend): move invariant IDs to
  outside of loop.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Sep 27, 2012
1 parent 1bebb22 commit 454d393
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -964,12 +964,16 @@ static VALUE
rb_mod_include(int argc, VALUE *argv, VALUE module)
{
int i;
ID id_append_features, id_included;

CONST_ID(id_append_features, "append_features");
CONST_ID(id_included, "included");

for (i = 0; i < argc; i++)
Check_Type(argv[i], T_MODULE);
while (argc--) {
rb_funcall(argv[argc], rb_intern("append_features"), 1, module);
rb_funcall(argv[argc], rb_intern("included"), 1, module);
rb_funcall(argv[argc], id_append_features, 1, module);
rb_funcall(argv[argc], id_included, 1, module);
}
return module;
}
Expand Down Expand Up @@ -1280,13 +1284,17 @@ static VALUE
rb_obj_extend(int argc, VALUE *argv, VALUE obj)
{
int i;
ID id_extend_object, id_extended;

CONST_ID(id_extend_object, "extend_object");
CONST_ID(id_extended, "extended");

rb_check_arity(argc, 1, UNLIMITED_ARGUMENTS);
for (i = 0; i < argc; i++)
Check_Type(argv[i], T_MODULE);
while (argc--) {
rb_funcall(argv[argc], rb_intern("extend_object"), 1, obj);
rb_funcall(argv[argc], rb_intern("extended"), 1, obj);
rb_funcall(argv[argc], id_extend_object, 1, obj);
rb_funcall(argv[argc], id_extended, 1, obj);
}
return obj;
}
Expand Down

0 comments on commit 454d393

Please sign in to comment.