1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

encoding.c: defer code page table

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

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2013-10-19 10:55:39 +00:00
parent 6bf78ee633
commit eeb3156eca
4 changed files with 13 additions and 6 deletions

View file

@ -1,3 +1,8 @@
Sat Oct 19 19:55:37 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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@atdot.net>
* gc.c: fix rb_objspace_t.

View file

@ -1272,7 +1272,13 @@ rb_locale_encindex(void)
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;
}

4
file.c
View file

@ -5813,8 +5813,4 @@ Init_File(void)
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
}

View file

@ -686,7 +686,7 @@ rb_file_load_ok(const char *path)
}
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);