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

ruby-changes:29687

From: nobu <ko1@a...>
Date: Tue, 2 Jul 2013 17:22:36 +0900 (JST)
Subject: [ruby-changes:29687] nobu:r41740 (trunk): encoding.c: use built-in encoding indexes

nobu	2013-07-02 17:22:23 +0900 (Tue, 02 Jul 2013)

  New Revision: 41740

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

  Log:
    encoding.c: use built-in encoding indexes
    
    * encoding.c (enc_inspect, rb_locale_encindex),
      (enc_set_filesystem_encoding, rb_filesystem_encindex): use built-in
      encoding indexes directly.

  Modified files:
    trunk/ChangeLog
    trunk/encoding.c

Index: encoding.c
===================================================================
--- encoding.c	(revision 41739)
+++ encoding.c	(revision 41740)
@@ -1005,7 +1005,7 @@ enc_inspect(VALUE self) https://github.com/ruby/ruby/blob/trunk/encoding.c#L1005
     VALUE str = rb_sprintf("#<%s:%s%s>", rb_obj_classname(self),
 		      rb_enc_name((rb_encoding*)DATA_PTR(self)),
 		      (enc_dummy_p(self) ? " (dummy)" : ""));
-    ENCODING_CODERANGE_SET(str, rb_usascii_encindex(), ENC_CODERANGE_7BIT);
+    ENCODING_CODERANGE_SET(str, ENCINDEX_US_ASCII, ENC_CODERANGE_7BIT);
     return str;
 }
 
@@ -1220,9 +1220,9 @@ rb_locale_encindex(void) https://github.com/ruby/ruby/blob/trunk/encoding.c#L1220
     int idx;
 
     if (NIL_P(charmap))
-        idx = rb_usascii_encindex();
+        idx = ENCINDEX_US_ASCII;
     else if ((idx = rb_enc_find_index(StringValueCStr(charmap))) < 0)
-        idx = rb_ascii8bit_encindex();
+        idx = ENCINDEX_ASCII;
 
     if (rb_enc_registered("locale") < 0) enc_alias_internal("locale", idx);
 
@@ -1245,7 +1245,7 @@ enc_set_filesystem_encoding(void) https://github.com/ruby/ruby/blob/trunk/encoding.c#L1245
     char cp[sizeof(int) * 8 / 3 + 4];
     snprintf(cp, sizeof cp, "CP%d", AreFileApisANSI() ? GetACP() : GetOEMCP());
     idx = rb_enc_find_index(cp);
-    if (idx < 0) idx = rb_ascii8bit_encindex();
+    if (idx < 0) idx = ENCINDEX_ASCII;
 #else
     idx = rb_enc_to_index(rb_default_external_encoding());
 #endif
@@ -1259,7 +1259,7 @@ rb_filesystem_encindex(void) https://github.com/ruby/ruby/blob/trunk/encoding.c#L1259
 {
     int idx = rb_enc_registered("filesystem");
     if (idx < 0)
-	idx = rb_ascii8bit_encindex();
+	idx = ENCINDEX_ASCII;
     return idx;
 }
 
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41739)
+++ ChangeLog	(revision 41740)
@@ -1,4 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
-Tue Jul  2 17:22:16 2013  Nobuyoshi Nakada  <nobu@r...>
+Tue Jul  2 17:22:21 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* encoding.c (enc_inspect, rb_locale_encindex),
+	  (enc_set_filesystem_encoding, rb_filesystem_encindex): use built-in
+	  encoding indexes directly.
 
 	* encoding.c (rb_enc_set_index, rb_enc_associate_index): validate
 	  argument encoding index.

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

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