[前][次][番号順一覧][スレッド一覧]

ruby-changes:10429

From: knu <ko1@a...>
Date: Mon, 2 Feb 2009 21:06:19 +0900 (JST)
Subject: [ruby-changes:10429] Ruby:r21977 (ruby_1_8): * enumerator.c: Introduce id_each to save rb_itern() and SYM2ID()

knu	2009-02-02 21:06:12 +0900 (Mon, 02 Feb 2009)

  New Revision: 21977

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=21977

  Log:
    * enumerator.c: Introduce id_each to save rb_itern() and SYM2ID()
      calls.

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/enumerator.c

Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 21976)
+++ ruby_1_8/ChangeLog	(revision 21977)
@@ -1,3 +1,8 @@
+Mon Feb  2 20:49:24 2009  Akinori MUSHA  <knu@i...>
+
+	* enumerator.c: Introduce id_each to save rb_itern() and SYM2ID()
+	  calls.
+
 Sun Feb  1 16:14:37 2009  Nobuyoshi Nakada  <nobu@r...>
 
 	* lib/optparse.rb (Switch#summarize): strips an equal sign from
Index: ruby_1_8/enumerator.c
===================================================================
--- ruby_1_8/enumerator.c	(revision 21976)
+++ ruby_1_8/enumerator.c	(revision 21977)
@@ -21,8 +21,8 @@
  * object.
  */
 VALUE rb_cEnumerator;
+static ID id_rewind, id_each;
 static VALUE sym_each;
-static ID id_rewind;
 
 VALUE rb_eStopIteration;
 
@@ -162,7 +162,7 @@
     args[0] = rb_ary_new2(size);
     args[1] = (VALUE)size;
 
-    rb_block_call(obj, SYM2ID(sym_each), 0, 0, each_slice_i, (VALUE)args);
+    rb_block_call(obj, id_each, 0, 0, each_slice_i, (VALUE)args);
 
     ary = args[0];
     if (RARRAY_LEN(ary) > 0) rb_yield(ary);
@@ -222,7 +222,7 @@
     args[0] = rb_ary_new2(size);
     args[1] = (VALUE)size;
 
-    rb_block_call(obj, SYM2ID(sym_each), 0, 0, each_cons_i, (VALUE)args);
+    rb_block_call(obj, id_each, 0, 0, each_cons_i, (VALUE)args);
 
     return Qnil;
 }
@@ -255,7 +255,7 @@
 {
     RETURN_ENUMERATOR(obj, 1, &memo);
 
-    rb_block_call(obj, SYM2ID(sym_each), 0, 0, each_with_object_i, memo);
+    rb_block_call(obj, id_each, 0, 0, each_with_object_i, memo);
 
     return memo;
 }
@@ -923,8 +923,9 @@
     rb_define_method(rb_cYielder, "yield", yielder_yield, -2);
     rb_define_method(rb_cYielder, "<<", yielder_yield, -2);
 
-    sym_each = ID2SYM(rb_intern("each"));
     id_rewind = rb_intern("rewind");
+    id_each = rb_intern("each");
+    sym_each = ID2SYM(id_each);
 
     /* backward compatibility */
     rb_provide("enumerator.so");

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]