enum.c: id_call

* enum.c (id_call): intern first and share.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-09-24 01:16:36 +00:00
parent aed254f314
commit 8a3856dc1e

10
enum.c
View File

@ -19,6 +19,7 @@
VALUE rb_mEnumerable; VALUE rb_mEnumerable;
static ID id_next; static ID id_next;
static ID id_call;
#define id_each idEach #define id_each idEach
#define id_eqq idEqq #define id_eqq idEqq
#define id_cmp idCmp #define id_cmp idCmp
@ -2264,9 +2265,9 @@ chunk_ii(VALUE i, VALUE _argp, int argc, VALUE *argv)
ENUM_WANT_SVALUE(); ENUM_WANT_SVALUE();
if (NIL_P(argp->state)) if (NIL_P(argp->state))
v = rb_funcall(argp->categorize, rb_intern("call"), 1, i); v = rb_funcall(argp->categorize, id_call, 1, i);
else else
v = rb_funcall(argp->categorize, rb_intern("call"), 2, i, argp->state); v = rb_funcall(argp->categorize, id_call, 2, i, argp->state);
if (v == alone) { if (v == alone) {
if (!NIL_P(argp->prev_value)) { if (!NIL_P(argp->prev_value)) {
@ -2462,9 +2463,9 @@ slicebefore_ii(VALUE i, VALUE _argp, int argc, VALUE *argv)
if (!NIL_P(argp->sep_pat)) if (!NIL_P(argp->sep_pat))
header_p = rb_funcall(argp->sep_pat, id_eqq, 1, i); header_p = rb_funcall(argp->sep_pat, id_eqq, 1, i);
else if (NIL_P(argp->state)) else if (NIL_P(argp->state))
header_p = rb_funcall(argp->sep_pred, rb_intern("call"), 1, i); header_p = rb_funcall(argp->sep_pred, id_call, 1, i);
else else
header_p = rb_funcall(argp->sep_pred, rb_intern("call"), 2, i, argp->state); header_p = rb_funcall(argp->sep_pred, id_call, 2, i, argp->state);
if (RTEST(header_p)) { if (RTEST(header_p)) {
if (!NIL_P(argp->prev_elts)) if (!NIL_P(argp->prev_elts))
rb_funcall(argp->yielder, id_lshift, 1, argp->prev_elts); rb_funcall(argp->yielder, id_lshift, 1, argp->prev_elts);
@ -2733,4 +2734,5 @@ Init_Enumerable(void)
rb_define_method(rb_mEnumerable, "slice_before", enum_slice_before, -1); rb_define_method(rb_mEnumerable, "slice_before", enum_slice_before, -1);
id_next = rb_intern("next"); id_next = rb_intern("next");
id_call = rb_intern("call");
} }