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

ruby-changes:8479

From: nobu <ko1@a...>
Date: Wed, 29 Oct 2008 09:23:29 +0900 (JST)
Subject: [ruby-changes:8479] Ruby:r20012 (trunk): * ruby.c (load_file_internal): cache common interned IDs.

nobu	2008-10-29 09:23:04 +0900 (Wed, 29 Oct 2008)

  New Revision: 20012

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

  Log:
    * ruby.c (load_file_internal): cache common interned IDs.

  Modified files:
    trunk/ChangeLog
    trunk/ruby.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 20011)
+++ ChangeLog	(revision 20012)
@@ -1,3 +1,7 @@
+Wed Oct 29 09:23:01 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* ruby.c (load_file_internal): cache common interned IDs.
+
 Wed Oct 29 00:43:39 2008  Tadayoshi Funaba  <tadf@d...>
 
 	* complex.c: uses macro in declarations.
Index: ruby.c
===================================================================
--- ruby.c	(revision 20011)
+++ ruby.c	(revision 20012)
@@ -1223,6 +1223,7 @@
     int line_start = 1;
     NODE *tree = 0;
     rb_encoding *enc;
+    ID set_encoding;
 
     if (!fname)
 	rb_load_fail(fname);
@@ -1245,6 +1246,7 @@
 	f = rb_io_fdopen(fd, mode, fname);
     }
 
+    CONST_ID(set_encoding, "set_encoding");
     if (script) {
 	VALUE c = 1;		/* something not nil */
 	VALUE line;
@@ -1254,7 +1256,7 @@
 	int no_int_enc = !opt->intern.enc.name;
 
 	enc = rb_usascii_encoding();
-	rb_funcall(f, rb_intern("set_encoding"), 1, rb_enc_from_encoding(enc));
+	rb_funcall(f, set_encoding, 1, rb_enc_from_encoding(enc));
 
 	if (opt->xflag) {
 	    forbid_setid("-x");
@@ -1356,9 +1358,9 @@
     else {
 	enc = rb_usascii_encoding();
     }
-    rb_funcall(f, rb_intern("set_encoding"), 1, rb_enc_from_encoding(enc));
+    rb_funcall(f, set_encoding, 1, rb_enc_from_encoding(enc));
     tree = (NODE *)rb_parser_compile_file(parser, fname, f, line_start);
-    rb_funcall(f, rb_intern("set_encoding"), 1, rb_parser_encoding(parser));
+    rb_funcall(f, set_encoding, 1, rb_parser_encoding(parser));
     if (script && rb_parser_end_seen_p(parser)) {
 	rb_define_global_const("DATA", f);
     }

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

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