1
0
Fork 0
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:
Samuel Williams 2021-12-25 02:26:06 +13:00 committed by GitHub
parent 4f74153846
commit 548c8f5f7a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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

View file

@ -556,7 +556,7 @@ console_getch(int argc, VALUE *argv, VALUE io)
if (!(w & RB_WAITFD_IN)) return Qnil;
# else
VALUE result = rb_io_wait(io, RUBY_IO_READABLE, timeout);
if (result == Qfalse) return Qnil;
if (!RTEST(result)) return Qnil;
# endif
}
else if (optp->vtime) {

2
io.c
View file

@ -1483,7 +1483,7 @@ rb_io_maybe_wait(int error, VALUE io, VALUE events, VALUE timeout)
default:
// Non-specific error, no event is ready:
return RB_INT2NUM(0);
return Qfalse;
}
}