mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* encoding.c (rb_enc_aliases_enc_i): exclude non alias names from
Encoding.aliases. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a7e3774701
commit
d8644f632b
2 changed files with 11 additions and 4 deletions
|
@ -16,6 +16,9 @@ Fri Jan 18 09:22:07 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
|||
|
||||
* parse.y (ripper_initialize): move parser->enc initialization.
|
||||
|
||||
* encoding.c (rb_enc_aliases_enc_i): exclude non alias names from
|
||||
Encoding.aliases.
|
||||
|
||||
Fri Jan 18 07:06:25 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* io.c (Init_IO): stdin/stdout may not be duplex.
|
||||
|
|
12
encoding.c
12
encoding.c
|
@ -498,8 +498,7 @@ rb_enc_find_index(const char *name)
|
|||
}
|
||||
else {
|
||||
i = load_encoding(name);
|
||||
enc = rb_enc_from_index(i);
|
||||
if (!enc->precise_mbc_enc_len) {
|
||||
if (enc_autoload_p(rb_enc_from_index(i))) {
|
||||
rb_warn("failed to load encoding (%s); use ASCII-8BIT instead",
|
||||
name);
|
||||
return 0;
|
||||
|
@ -1149,11 +1148,16 @@ rb_enc_aliases_enc_i(st_data_t name, st_data_t orig, st_data_t arg)
|
|||
VALUE str = rb_ary_entry(ary, idx);
|
||||
|
||||
if (NIL_P(str)) {
|
||||
str = rb_str_new2(rb_enc_name(rb_enc_from_index(idx)));
|
||||
rb_encoding *enc = rb_enc_from_index(idx);
|
||||
|
||||
if (STRCASECMP((char*)name, rb_enc_name(enc)) == 0) {
|
||||
return ST_CONTINUE;
|
||||
}
|
||||
str = rb_str_new2(rb_enc_name(enc));
|
||||
rb_ary_store(ary, idx, str);
|
||||
}
|
||||
rb_hash_aset(aliases, rb_str_new2((char *)name), str);
|
||||
return 0;
|
||||
return ST_CONTINUE;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Reference in a new issue