ruby-changes:70547
From: Samuel <ko1@a...>
Date: Fri, 24 Dec 2021 22:26:22 +0900 (JST)
Subject: [ruby-changes:70547] 548c8f5f7a (master): Prefer to use RTEST when checking result of `rb_io_wait`. (#5341)
https://git.ruby-lang.org/ruby.git/commit/?id=548c8f5f7a From 548c8f5f7aa743ae05610ed372f857a6b488e89c Mon Sep 17 00:00:00 2001 From: Samuel Williams <samuel.williams@o...> Date: Sat, 25 Dec 2021 02:26:06 +1300 Subject: 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. --- ext/io/console/console.c | 2 +- io.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ext/io/console/console.c b/ext/io/console/console.c index 5dec1a4c068..4c5f89f80df 100644 --- a/ext/io/console/console.c +++ b/ext/io/console/console.c @@ -556,7 +556,7 @@ console_getch(int argc, VALUE *argv, VALUE io) https://github.com/ruby/ruby/blob/trunk/ext/io/console/console.c#L556 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) { diff --git a/io.c b/io.c index f104ff53710..4ed4ee34f84 100644 --- a/io.c +++ b/io.c @@ -1483,7 +1483,7 @@ rb_io_maybe_wait(int error, VALUE io, VALUE events, VALUE timeout) https://github.com/ruby/ruby/blob/trunk/io.c#L1483 default: // Non-specific error, no event is ready: - return RB_INT2NUM(0); + return Qfalse; } } -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/