diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-09-15 06:15:44 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-09-15 06:15:44 +0000 |
commit | 70b2af3b211f9746a5f9fe6bd76cc0fff3fbe2b0 (patch) | |
tree | bd57f5f81f4fc62649ac1a47ffa2b1f2f8e65e79 /win32 | |
parent | 2046f38aa6e2a28aea582ba84887ccef6fdd31d6 (diff) |
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.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'win32')
-rw-r--r-- | win32/win32.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/win32/win32.c b/win32/win32.c index c3e8ce11e1..fd46ec84bd 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -779,7 +779,7 @@ rb_w32_sysinit(int *argc, char ***argv) // // 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)(const WCHAR *, const WCHAR *, struct di 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); } |