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

ruby-changes:8518

From: nobu <ko1@a...>
Date: Thu, 30 Oct 2008 09:32:04 +0900 (JST)
Subject: [ruby-changes:8518] Ruby:r20052 (trunk): * encoding.c (rb_locale_encoding): makes an alias for locale.

nobu	2008-10-30 09:31:47 +0900 (Thu, 30 Oct 2008)

  New Revision: 20052

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

  Log:
    * encoding.c (rb_locale_encoding): makes an alias for locale.
      [ruby-dev:36976]
    * encoding.c (rb_enc_set_default_external): ditto for external.
    
    * encoding.c (rb_enc_set_default_internal): ditto for internal.

  Modified files:
    trunk/ChangeLog
    trunk/encoding.c

Index: encoding.c
===================================================================
--- encoding.c	(revision 20051)
+++ encoding.c	(revision 20052)
@@ -996,12 +996,12 @@
     int idx;
 
     if (NIL_P(charmap))
-        return rb_usascii_encoding();
-    else
-        idx = rb_enc_find_index(StringValueCStr(charmap));
-    if (idx < 0)
-        return rb_ascii8bit_encoding();
+        idx = rb_usascii_encindex();
+    else if ((idx = rb_enc_find_index(StringValueCStr(charmap))) < 0)
+        idx = rb_ascii8bit_encindex();
 
+    if (rb_enc_registered("locale") < 0) enc_alias("locale", idx);
+
     return rb_enc_from_index(idx);
 }
 
@@ -1057,6 +1057,7 @@
 {
     default_external_index = rb_enc_to_index(rb_to_encoding(encoding));
     default_external = 0;
+    enc_alias("external", default_external_index);
 }
 
 /* -2 => not yet set, -1 => nil */
@@ -1106,6 +1107,7 @@
     if (default_internal_index == rb_usascii_encindex())
 	default_internal_index = rb_utf8_encindex();
     default_internal = 0;
+    enc_alias("internal", default_internal_index);
 }
 
 /*
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 20051)
+++ ChangeLog	(revision 20052)
@@ -1,3 +1,12 @@
+Thu Oct 30 09:31:45 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* encoding.c (rb_locale_encoding): makes an alias for locale.
+	  [ruby-dev:36976]
+
+	* encoding.c (rb_enc_set_default_external): ditto for external.
+
+	* encoding.c (rb_enc_set_default_internal): ditto for internal.
+
 Thu Oct 30 02:20:33 2008  Yusuke Endoh  <mame@t...>
 
 	* array.c (rb_ary_sort_bang): remove SEGV when replacing array with

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

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