mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Prefer to use RTEST when checking result of rb_io_wait. (#5341)
* Prefer to use RTEST when checking result of `rb_io_wait`. * Consistently use false for signifying no events ready.
This commit is contained in:
parent
4f74153846
commit
548c8f5f7a
Notes:
git
2021-12-24 22:26:32 +09:00
Merged-By: ioquatix <samuel@codeotaku.com>
2 changed files with 2 additions and 2 deletions
|
|
@ -556,7 +556,7 @@ console_getch(int argc, VALUE *argv, VALUE io)
|
||||||
if (!(w & RB_WAITFD_IN)) return Qnil;
|
if (!(w & RB_WAITFD_IN)) return Qnil;
|
||||||
# else
|
# else
|
||||||
VALUE result = rb_io_wait(io, RUBY_IO_READABLE, timeout);
|
VALUE result = rb_io_wait(io, RUBY_IO_READABLE, timeout);
|
||||||
if (result == Qfalse) return Qnil;
|
if (!RTEST(result)) return Qnil;
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
else if (optp->vtime) {
|
else if (optp->vtime) {
|
||||||
|
|
|
||||||
2
io.c
2
io.c
|
|
@ -1483,7 +1483,7 @@ rb_io_maybe_wait(int error, VALUE io, VALUE events, VALUE timeout)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// Non-specific error, no event is ready:
|
// Non-specific error, no event is ready:
|
||||||
return RB_INT2NUM(0);
|
return Qfalse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue