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

ruby-changes:29693

From: nobu <ko1@a...>
Date: Tue, 2 Jul 2013 17:23:12 +0900 (JST)
Subject: [ruby-changes:29693] nobu:r41745 (trunk): re.c: use built-in encoding indexes

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

  New Revision: 41745

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

  Log:
    re.c: use built-in encoding indexes
    
    * internal.h: add EUC-JP and Windows-31J.
    * re.c (rb_char_to_option_kcode): use built-in encoding indexes in
      internal.h.

  Modified files:
    trunk/ChangeLog
    trunk/encoding.c
    trunk/internal.h
    trunk/re.c

Index: encoding.c
===================================================================
--- encoding.c	(revision 41744)
+++ encoding.c	(revision 41745)
@@ -566,6 +566,9 @@ rb_enc_init(void) https://github.com/ruby/ruby/blob/trunk/encoding.c#L566
     ENCDB_REGISTER("UTF-16", UTF_16);
     ENCDB_REGISTER("UTF-32", UTF_32);
     ENCDB_REGISTER("UTF8-MAC", UTF8_MAC);
+
+    ENCDB_REGISTER("EUC-JP", EUC_JP);
+    ENCDB_REGISTER("Windows-31J", Windows_31J);
 #undef ENCDB_REGISTER
 #endif
     enc_table.count = ENCINDEX_BUILTIN_MAX;
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41744)
+++ ChangeLog	(revision 41745)
@@ -1,4 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
-Tue Jul  2 17:22:40 2013  Nobuyoshi Nakada  <nobu@r...>
+Tue Jul  2 17:22:44 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* internal.h: add EUC-JP and Windows-31J.
+
+	* re.c (rb_char_to_option_kcode): use built-in encoding indexes in
+	  internal.h.
 
 	* internal.h: add UTF8-MAC.
 
Index: re.c
===================================================================
--- re.c	(revision 41744)
+++ re.c	(revision 41745)
@@ -307,10 +307,10 @@ rb_char_to_option_kcode(int c, int *opti https://github.com/ruby/ruby/blob/trunk/re.c#L307
         *kcode = rb_ascii8bit_encindex();
         return (*option = ARG_ENCODING_NONE);
       case 'e':
-	*kcode = rb_enc_find_index("EUC-JP");
+	*kcode = ENCINDEX_EUC_JP;
 	break;
       case 's':
-	*kcode = rb_enc_find_index("Windows-31J");
+	*kcode = ENCINDEX_Windows_31J;
 	break;
       case 'u':
 	*kcode = rb_utf8_encindex();
Index: internal.h
===================================================================
--- internal.h	(revision 41744)
+++ internal.h	(revision 41745)
@@ -211,6 +211,10 @@ enum ruby_preserved_encindex { https://github.com/ruby/ruby/blob/trunk/internal.h#L211
     ENCINDEX_UTF_16,
     ENCINDEX_UTF_32,
     ENCINDEX_UTF8_MAC,
+
+    /* for old options of regexp */
+    ENCINDEX_EUC_JP,
+    ENCINDEX_Windows_31J,
 #endif
 
     ENCINDEX_BUILTIN_MAX

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

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