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

ruby-changes:31283

From: nobu <ko1@a...>
Date: Sat, 19 Oct 2013 19:55:45 +0900 (JST)
Subject: [ruby-changes:31283] nobu:r43362 (trunk): encoding.c: defer code page table

nobu	2013-10-19 19:55:39 +0900 (Sat, 19 Oct 2013)

  New Revision: 43362

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

  Log:
    encoding.c: defer code page table
    
    * encoding.c (rb_locale_encindex): defer initialization of win32 code
      page table until encoding db loaded.

  Modified files:
    trunk/ChangeLog
    trunk/encoding.c
    trunk/file.c
    trunk/win32/file.c
Index: encoding.c
===================================================================
--- encoding.c	(revision 43361)
+++ encoding.c	(revision 43362)
@@ -1272,7 +1272,13 @@ rb_locale_encindex(void) https://github.com/ruby/ruby/blob/trunk/encoding.c#L1272
     else if ((idx = rb_enc_find_index(StringValueCStr(charmap))) < 0)
         idx = ENCINDEX_ASCII;
 
-    if (rb_enc_registered("locale") < 0) enc_alias_internal("locale", idx);
+    if (rb_enc_registered("locale") < 0) {
+# if defined _WIN32
+	void Init_w32_codepage(void);
+	Init_w32_codepage();
+# endif
+	enc_alias_internal("locale", idx);
+    }
 
     return idx;
 }
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 43361)
+++ ChangeLog	(revision 43362)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Oct 19 19:55:37 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* encoding.c (rb_locale_encindex): defer initialization of win32 code
+	  page table until encoding db loaded.
+
 Sat Oct 19 08:25:05 2013  Koichi Sasada  <ko1@a...>
 
 	* gc.c: fix rb_objspace_t.
Index: win32/file.c
===================================================================
--- win32/file.c	(revision 43361)
+++ win32/file.c	(revision 43362)
@@ -686,7 +686,7 @@ rb_file_load_ok(const char *path) https://github.com/ruby/ruby/blob/trunk/win32/file.c#L686
 }
 
 void
-rb_w32_init_file(void)
+Init_w32_codepage(void)
 {
     rb_code_page = st_init_numtable();
     rb_enc_foreach_name(code_page_i, (st_data_t)rb_code_page);
Index: file.c
===================================================================
--- file.c	(revision 43361)
+++ file.c	(revision 43362)
@@ -5813,8 +5813,4 @@ Init_File(void) https://github.com/ruby/ruby/blob/trunk/file.c#L5813
     rb_define_method(rb_cStat, "setuid?",  rb_stat_suid, 0);
     rb_define_method(rb_cStat, "setgid?",  rb_stat_sgid, 0);
     rb_define_method(rb_cStat, "sticky?",  rb_stat_sticky, 0);
-
-#ifdef _WIN32
-    rb_w32_init_file();
-#endif
 }

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

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