diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-02 08:22:34 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-02 08:22:34 +0000 |
commit | 42a2f89b3918cbe352528a0addc5ec59dfe2ad83 (patch) | |
tree | 288b9e2285d4d25e588def7e0915b62840b59888 /io.c | |
parent | ea2b115efda5e1f0c7edea3d9951a073fbaacb37 (diff) | |
download | ruby-42a2f89b3918cbe352528a0addc5ec59dfe2ad83.tar.gz |
io.c: use built-in encoding indexes
* internal.h: add UTF-{16,32}{BE,LE}.
* io.c (io_strip_bom): use built-in encoding indexes in internal.h.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -5319,7 +5319,7 @@ io_strip_bom(VALUE io) case INT2FIX(0xFE): if (NIL_P(b2 = rb_io_getbyte(io))) break; if (b2 == INT2FIX(0xFF)) { - return rb_enc_find_index("UTF-16BE"); + return ENCINDEX_UTF_16BE; } rb_io_ungetbyte(io, b2); break; @@ -5330,14 +5330,14 @@ io_strip_bom(VALUE io) b3 = rb_io_getbyte(io); if (b3 == INT2FIX(0) && !NIL_P(b4 = rb_io_getbyte(io))) { if (b4 == INT2FIX(0)) { - return rb_enc_find_index("UTF-32LE"); + return ENCINDEX_UTF_32LE; } rb_io_ungetbyte(io, b4); rb_io_ungetbyte(io, b3); } else { rb_io_ungetbyte(io, b3); - return rb_enc_find_index("UTF-16LE"); + return ENCINDEX_UTF_16LE; } } rb_io_ungetbyte(io, b2); @@ -5348,7 +5348,7 @@ io_strip_bom(VALUE io) if (b2 == INT2FIX(0) && !NIL_P(b3 = rb_io_getbyte(io))) { if (b3 == INT2FIX(0xFE) && !NIL_P(b4 = rb_io_getbyte(io))) { if (b4 == INT2FIX(0xFF)) { - return rb_enc_find_index("UTF-32BE"); + return ENCINDEX_UTF_32BE; } rb_io_ungetbyte(io, b4); } |