зеркало из https://github.com/github/ruby.git
* 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/trunk@29435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
72ef219804
Коммит
e1646652e7
|
@ -1,3 +1,8 @@
|
|||
Mon Oct 11 06:11:30 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* io.c (rb_io_set_encoding): use rb_funcall2 when the io is not
|
||||
a T_FILE. [ruby-dev:42356]
|
||||
|
||||
Sun Oct 10 18:42:23 2010 Akinori MUSHA <knu@iDaemons.org>
|
||||
|
||||
* lib/set.rb (Set#replace): Apply a bit of optimization.
|
||||
|
|
7
io.c
7
io.c
|
@ -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;
|
||||
|
||||
|
@ -8687,6 +8687,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);
|
||||
}
|
||||
|
||||
argc = rb_scan_args(argc, argv, "11:", &v1, &v2, &opt);
|
||||
GetOpenFile(io, fptr);
|
||||
io_encoding_set(fptr, v1, v2, opt);
|
||||
|
@ -9863,6 +9867,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);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче