[ruby/io-nonblock] Don't define nonblock methods if they are defined by core.
https://github.com/ruby/io-nonblock/commit/5d3991859c
This commit is contained in:
parent
39207b496e
commit
30f5a2bbcd
@ -66,6 +66,8 @@ set_fcntl_flags(int fd, int f)
|
|||||||
rb_sys_fail(0);
|
rb_sys_fail(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef RUBY_IO_NONBLOCK_METHODS
|
||||||
|
|
||||||
static int
|
static int
|
||||||
io_nonblock_set(int fd, int f, int nb)
|
io_nonblock_set(int fd, int f, int nb)
|
||||||
{
|
{
|
||||||
@ -146,6 +148,8 @@ rb_io_nonblock_set(VALUE self, VALUE value)
|
|||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* RUBY_IO_NONBLOCK_METHODS */
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
io_nonblock_restore(VALUE arg)
|
io_nonblock_restore(VALUE arg)
|
||||||
{
|
{
|
||||||
@ -193,7 +197,10 @@ rb_io_nonblock_block(int argc, VALUE *argv, VALUE self)
|
|||||||
void
|
void
|
||||||
Init_nonblock(void)
|
Init_nonblock(void)
|
||||||
{
|
{
|
||||||
|
#ifndef RUBY_IO_NONBLOCK_METHODS
|
||||||
rb_define_method(rb_cIO, "nonblock?", rb_io_nonblock_p, 0);
|
rb_define_method(rb_cIO, "nonblock?", rb_io_nonblock_p, 0);
|
||||||
rb_define_method(rb_cIO, "nonblock=", rb_io_nonblock_set, 1);
|
rb_define_method(rb_cIO, "nonblock=", rb_io_nonblock_set, 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
rb_define_method(rb_cIO, "nonblock", rb_io_nonblock_block, -1);
|
rb_define_method(rb_cIO, "nonblock", rb_io_nonblock_block, -1);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user