mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
2046f38aa6
commit
70b2af3b21
2 changed files with 9 additions and 4 deletions
|
@ -1,4 +1,8 @@
|
|||
Tue Sep 15 15:06:16 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
Tue Sep 15 15:15:41 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* 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.
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue