ruby-changes:39785
From: nobu <ko1@a...>
Date: Tue, 15 Sep 2015 15:15:55 +0900 (JST)
Subject: [ruby-changes:39785] nobu:r51866 (trunk): win32.c: no xmalloc at sys_init
nobu 2015-09-15 15:15:44 +0900 (Tue, 15 Sep 2015) New Revision: 51866 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51866 Log: win32.c: no xmalloc at sys_init * win32/win32.c (rb_w32_sysinit, rb_w32_readdir): compare by encoding index to get rid of encoding initialization before VM object space allocation. Modified files: trunk/ChangeLog trunk/win32/win32.c Index: ChangeLog =================================================================== --- ChangeLog (revision 51865) +++ ChangeLog (revision 51866) @@ -1,4 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 -Tue Sep 15 15:06:16 2015 Nobuyoshi Nakada <nobu@r...> +Tue Sep 15 15:15:41 2015 Nobuyoshi Nakada <nobu@r...> + + * win32/win32.c (rb_w32_sysinit, rb_w32_readdir): compare by + encoding index to get rid of encoding initialization before VM + object space allocation. * dir.c (fundamental_encoding_p, push_glob): compare by encoding index immediately. Index: win32/win32.c =================================================================== --- win32/win32.c (revision 51865) +++ win32/win32.c (revision 51866) @@ -779,7 +779,7 @@ rb_w32_sysinit(int *argc, char ***argv) https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L779 // // subvert cmd.exe's feeble attempt at command line parsing // - *argc = w32_cmdvector(GetCommandLineW(), argv, CP_UTF8, rb_utf8_encoding()); + *argc = w32_cmdvector(GetCommandLineW(), argv, CP_UTF8, &OnigEncodingUTF_8); // // Now set up the correct time stuff @@ -2222,11 +2222,12 @@ readdir_internal(DIR *dirp, BOOL (*conv) https://github.com/ruby/ruby/blob/trunk/win32/win32.c#L2222 struct direct * rb_w32_readdir(DIR *dirp, rb_encoding *enc) { - if (!enc || enc == rb_ascii8bit_encoding()) { + int idx = rb_enc_to_index(enc); + if (idx == ENCINDEX_ASCII) { const UINT cp = filecp(); return readdir_internal(dirp, win32_direct_conv, &cp); } - else if (enc == rb_utf8_encoding()) { + else if (idx == ENCINDEX_UTF_8) { const UINT cp = CP_UTF8; return readdir_internal(dirp, win32_direct_conv, &cp); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/