diff options
Diffstat (limited to 'encoding.c')
-rw-r--r-- | encoding.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/encoding.c b/encoding.c index d088473d61..2c2563ab02 100644 --- a/encoding.c +++ b/encoding.c @@ -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)); } |