mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Prefer to use prep_io
for temporary IO instances.
This commit is contained in:
parent
68b5f14d53
commit
f75009c122
Notes:
git
2020-09-16 21:31:27 +09:00
1 changed files with 4 additions and 13 deletions
17
io.c
17
io.c
|
@ -216,6 +216,7 @@ static VALUE sym_HOLE;
|
|||
#endif
|
||||
|
||||
static VALUE rb_io_initialize(int argc, VALUE *argv, VALUE io);
|
||||
static VALUE prep_io(int fd, int fmode, VALUE klass, const char *path);
|
||||
|
||||
struct argf {
|
||||
VALUE filename, current_file;
|
||||
|
@ -1295,20 +1296,10 @@ rb_io_wait(VALUE io, VALUE events, VALUE timeout) {
|
|||
}
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_io_from_fd(int f)
|
||||
static VALUE
|
||||
rb_io_from_fd(int fd)
|
||||
{
|
||||
VALUE io = rb_obj_alloc(rb_cIO);
|
||||
VALUE argv[] = {RB_INT2NUM(f)};
|
||||
|
||||
rb_io_initialize(1, argv, io);
|
||||
|
||||
rb_io_t *fptr;
|
||||
RB_IO_POINTER(io, fptr);
|
||||
|
||||
fptr->mode |= FMODE_PREP;
|
||||
|
||||
return io;
|
||||
return prep_io(fd, FMODE_PREP, rb_cIO, NULL);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
Loading…
Reference in a new issue