* encoding.c (rb_locale_encoding): makes an alias for locale.

[ruby-dev:36976]

* encoding.c (rb_enc_set_default_external): ditto for external.

* encoding.c (rb_enc_set_default_internal): ditto for internal.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2008-10-30 00:31:47 +00:00
Родитель 2f2ca24b3e
Коммит 2db25b6ba0
2 изменённых файлов: 16 добавлений и 5 удалений

Просмотреть файл

@ -1,3 +1,12 @@
Thu Oct 30 09:31:45 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* encoding.c (rb_locale_encoding): makes an alias for locale.
[ruby-dev:36976]
* encoding.c (rb_enc_set_default_external): ditto for external.
* encoding.c (rb_enc_set_default_internal): ditto for internal.
Thu Oct 30 02:20:33 2008 Yusuke Endoh <mame@tsg.ne.jp> Thu Oct 30 02:20:33 2008 Yusuke Endoh <mame@tsg.ne.jp>
* array.c (rb_ary_sort_bang): remove SEGV when replacing array with * array.c (rb_ary_sort_bang): remove SEGV when replacing array with

Просмотреть файл

@ -996,11 +996,11 @@ rb_locale_encoding(void)
int idx; int idx;
if (NIL_P(charmap)) if (NIL_P(charmap))
return rb_usascii_encoding(); idx = rb_usascii_encindex();
else else if ((idx = rb_enc_find_index(StringValueCStr(charmap))) < 0)
idx = rb_enc_find_index(StringValueCStr(charmap)); idx = rb_ascii8bit_encindex();
if (idx < 0)
return rb_ascii8bit_encoding(); if (rb_enc_registered("locale") < 0) enc_alias("locale", idx);
return rb_enc_from_index(idx); return rb_enc_from_index(idx);
} }
@ -1057,6 +1057,7 @@ rb_enc_set_default_external(VALUE encoding)
{ {
default_external_index = rb_enc_to_index(rb_to_encoding(encoding)); default_external_index = rb_enc_to_index(rb_to_encoding(encoding));
default_external = 0; default_external = 0;
enc_alias("external", default_external_index);
} }
/* -2 => not yet set, -1 => nil */ /* -2 => not yet set, -1 => nil */
@ -1106,6 +1107,7 @@ rb_enc_set_default_internal(VALUE encoding)
if (default_internal_index == rb_usascii_encindex()) if (default_internal_index == rb_usascii_encindex())
default_internal_index = rb_utf8_encindex(); default_internal_index = rb_utf8_encindex();
default_internal = 0; default_internal = 0;
enc_alias("internal", default_internal_index);
} }
/* /*