aboutsummaryrefslogtreecommitdiffstats
path: root/ext/io/nonblock/nonblock.c
diff options
context:
space:
mode:
authorSamuel Williams <samuel.williams@oriontransfer.co.nz>2022-06-26 01:13:33 +1200
committergit <svn-admin@ruby-lang.org>2023-10-23 22:53:00 +0000
commit30f5a2bbcd0151ce25b1e55dcff31626d4ab253a (patch)
tree23003e8f948531a0a42624493d67cb19995af13d /ext/io/nonblock/nonblock.c
parent39207b496eb1f45750bc664c8796f5aa3f5d641e (diff)
downloadruby-30f5a2bbcd0151ce25b1e55dcff31626d4ab253a.tar.gz
[ruby/io-nonblock] Don't define nonblock methods if they are defined by core.
https://github.com/ruby/io-nonblock/commit/5d3991859c
Diffstat (limited to 'ext/io/nonblock/nonblock.c')
-rw-r--r--ext/io/nonblock/nonblock.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/io/nonblock/nonblock.c b/ext/io/nonblock/nonblock.c
index 4c729a760c..d90538f735 100644
--- a/ext/io/nonblock/nonblock.c
+++ b/ext/io/nonblock/nonblock.c
@@ -66,6 +66,8 @@ set_fcntl_flags(int fd, int f)
rb_sys_fail(0);
}
+#ifndef RUBY_IO_NONBLOCK_METHODS
+
static int
io_nonblock_set(int fd, int f, int nb)
{
@@ -146,6 +148,8 @@ rb_io_nonblock_set(VALUE self, VALUE value)
return self;
}
+#endif /* RUBY_IO_NONBLOCK_METHODS */
+
static VALUE
io_nonblock_restore(VALUE arg)
{
@@ -193,7 +197,10 @@ rb_io_nonblock_block(int argc, VALUE *argv, VALUE self)
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_set, 1);
+#endif
+
rb_define_method(rb_cIO, "nonblock", rb_io_nonblock_block, -1);
}