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

ruby-changes:29692

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

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

  New Revision: 41744

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

  Log:
    dir.c: use built-in encoding indexes
    
    * internal.h: add UTF8-MAC.
    * dir.c (rb_utf8mac_encoding): use built-in encoding indexes in
      internal.h.

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

Index: encoding.c
===================================================================
--- encoding.c	(revision 41743)
+++ encoding.c	(revision 41744)
@@ -565,6 +565,7 @@ rb_enc_init(void) https://github.com/ruby/ruby/blob/trunk/encoding.c#L565
     ENCDB_REGISTER("UTF-32LE", UTF_32LE);
     ENCDB_REGISTER("UTF-16", UTF_16);
     ENCDB_REGISTER("UTF-32", UTF_32);
+    ENCDB_REGISTER("UTF8-MAC", UTF8_MAC);
 #undef ENCDB_REGISTER
 #endif
     enc_table.count = ENCINDEX_BUILTIN_MAX;
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41743)
+++ ChangeLog	(revision 41744)
@@ -1,4 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
-Tue Jul  2 17:22:36 2013  Nobuyoshi Nakada  <nobu@r...>
+Tue Jul  2 17:22:40 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* internal.h: add UTF8-MAC.
+
+	* dir.c (rb_utf8mac_encoding): use built-in encoding indexes in
+	  internal.h.
 
 	* internal.h: add UTF-{16,32} dummy encodings.
 
Index: dir.c
===================================================================
--- dir.c	(revision 41743)
+++ dir.c	(revision 41744)
@@ -91,9 +91,7 @@ char *strchr(char*,char); https://github.com/ruby/ruby/blob/trunk/dir.c#L91
 rb_encoding *
 rb_utf8mac_encoding(void)
 {
-    static rb_encoding *utf8mac;
-    if (!utf8mac) utf8mac = rb_enc_find("UTF8-MAC");
-    return utf8mac;
+    return rb_enc_from_index(ENCINDEX_UTF8_MAC);
 }
 
 static inline int
Index: internal.h
===================================================================
--- internal.h	(revision 41743)
+++ internal.h	(revision 41744)
@@ -210,6 +210,7 @@ enum ruby_preserved_encindex { https://github.com/ruby/ruby/blob/trunk/internal.h#L210
     ENCINDEX_UTF_32LE,
     ENCINDEX_UTF_16,
     ENCINDEX_UTF_32,
+    ENCINDEX_UTF8_MAC,
 #endif
 
     ENCINDEX_BUILTIN_MAX

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

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