diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-02 08:06:23 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-12-02 08:06:23 +0000 |
commit | 9b6125398f81ae359a67b00fcfab8cc08ebcbe8d (patch) | |
tree | c2ac057ba0601925b48b5c7a0bdbefec111a72c7 /io.c | |
parent | 93d4433c14d87a32e5fec5fab678a6b1a94beaab (diff) |
merges r29435 from trunk into ruby_1_9_2.
--
* io.c (rb_io_set_encoding): use rb_funcall2 when the io is not
a T_FILE. [ruby-dev:42356]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@30034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -137,7 +137,7 @@ VALUE rb_default_rs; static VALUE argf; -static ID id_write, id_read, id_getc, id_flush, id_readpartial; +static ID id_write, id_read, id_getc, id_flush, id_readpartial, id_set_encoding; static VALUE sym_mode, sym_perm, sym_extenc, sym_intenc, sym_encoding, sym_open_args; static VALUE sym_textmode, sym_binmode, sym_autoclose; @@ -8661,6 +8661,10 @@ rb_io_set_encoding(int argc, VALUE *argv, VALUE io) rb_io_t *fptr; VALUE v1, v2, opt; + if (TYPE(io) != T_FILE) { + return rb_funcall2(io, id_set_encoding, argc, argv); + } + opt = pop_last_hash(&argc, argv); rb_scan_args(argc, argv, "11", &v1, &v2); GetOpenFile(io, fptr); @@ -9838,6 +9842,7 @@ Init_IO(void) id_getc = rb_intern("getc"); id_flush = rb_intern("flush"); id_readpartial = rb_intern("readpartial"); + id_set_encoding = rb_intern("set_encoding"); rb_define_global_function("syscall", rb_f_syscall, -1); |