mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* encoding.c (rb_to_encoding_index, rb_to_encoding): commit miss.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3cb10b32bb
commit
d0cbfbd995
1 changed files with 2 additions and 3 deletions
|
@ -88,7 +88,7 @@ rb_to_encoding_index(VALUE enc)
|
|||
if (NIL_P(enc)) return 0;
|
||||
idx = enc_check_encoding(enc);
|
||||
if (idx >= 0) {
|
||||
return index;
|
||||
return idx;
|
||||
}
|
||||
else {
|
||||
return rb_enc_find_index(StringValueCStr(enc));
|
||||
|
@ -98,12 +98,11 @@ rb_to_encoding_index(VALUE enc)
|
|||
rb_encoding *
|
||||
rb_to_encoding(VALUE enc)
|
||||
{
|
||||
rb_encoding *encoding;
|
||||
int idx;
|
||||
|
||||
if (NIL_P(enc)) return rb_enc_from_index(0);
|
||||
idx = enc_check_encoding(enc);
|
||||
if (idx >= 0) return RDATA(obj)->data;
|
||||
if (idx >= 0) return RDATA(enc)->data;
|
||||
if ((idx = rb_enc_find_index(StringValueCStr(enc))) < 0) {
|
||||
rb_raise(rb_eArgError, "unknown encoding name - %s", RSTRING_PTR(enc));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue