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

ruby-changes:7816

From: nobu <ko1@a...>
Date: Sun, 14 Sep 2008 16:10:14 +0900 (JST)
Subject: [ruby-changes:7816] Ruby:r19337 (trunk): * ruby.c (process_options): associates the locale encoding with $0 as

nobu	2008-09-14 16:07:31 +0900 (Sun, 14 Sep 2008)

  New Revision: 19337

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

  Log:
    * ruby.c (process_options): associates the locale encoding with $0 as
      well as ARGV.

  Modified files:
    trunk/ChangeLog
    trunk/ruby.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 19336)
+++ ChangeLog	(revision 19337)
@@ -1,3 +1,8 @@
+Sun Sep 14 16:07:04 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* ruby.c (process_options): associates the locale encoding with $0 as
+	  well as ARGV.
+
 Sun Sep 14 13:48:03 2008  Yuki Sonoda (Yugui)  <yugui@y...>
 
 	* object.c (Init_Object): added metameta-class initialization for 
Index: ruby.c
===================================================================
--- ruby.c	(revision 19336)
+++ ruby.c	(revision 19337)
@@ -967,6 +967,7 @@
     NODE *tree = 0;
     VALUE parser;
     VALUE iseq;
+    VALUE args;
     rb_encoding *enc, *lenc;
     const char *s;
     char fbuf[MAXPATHLEN];
@@ -1067,7 +1068,7 @@
 #if defined DOSISH || defined __CYGWIN__
     translate_char(RSTRING_PTR(rb_progname), '\\', '/');
 #endif
-    opt->script_name = rb_str_new4(rb_progname);
+    opt->script_name = rb_progname;
     opt->script = RSTRING_PTR(opt->script_name);
     safe = rb_safe_level();
     rb_set_safe_level_force(0);
@@ -1077,8 +1078,10 @@
     ruby_init_loadpath();
     ruby_init_gems(!(opt->disable & DISABLE_BIT(gems)));
     lenc = rb_locale_encoding();
-    for (i = 0; i < RARRAY_LEN(rb_argv); i++) {
-	rb_enc_associate(RARRAY_PTR(rb_argv)[i], lenc);
+    rb_enc_associate(rb_progname, lenc);
+    opt->script_name = rb_str_new4(rb_progname);
+    for (i = 0, args = rb_argv; i < RARRAY_LEN(args); i++) {
+	rb_enc_associate(RARRAY_PTR(args)[i], lenc);
     }
     parser = rb_parser_new();
     if (opt->yydebug) rb_parser_set_yydebug(parser, Qtrue);

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

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