diff options
author | S.H <gamelinks007@gmail.com> | 2021-08-02 12:06:44 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-02 12:06:44 +0900 |
commit | 378e8cdad69e6ba995a024da2957719789f0679e (patch) | |
tree | 99ffe0f8055bc10cba3225fb5e7a906f5c3f4543 /io.c | |
parent | 3688b476710def7290e32656b200fefc538366d0 (diff) |
Using RBOOL macro
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4695
Merged-By: nobu <nobu@ruby-lang.org>
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 19 |
1 files changed, 7 insertions, 12 deletions
@@ -2375,13 +2375,10 @@ rb_io_eof(VALUE io) READ_CHECK(fptr); #if RUBY_CRLF_ENVIRONMENT if (!NEED_READCONV(fptr) && NEED_NEWLINE_DECORATOR_ON_READ(fptr)) { - return eof(fptr->fd) ? Qtrue : Qfalse; + return RBOOL(eof(fptr->fd));; } #endif - if (io_fillbuf(fptr) < 0) { - return Qtrue; - } - return Qfalse; + return RBOOL(io_fillbuf(fptr) < 0); } /* @@ -2404,7 +2401,7 @@ rb_io_sync(VALUE io) io = GetWriteIO(io); GetOpenFile(io, fptr); - return (fptr->mode & FMODE_SYNC) ? Qtrue : Qfalse; + return RBOOL(fptr->mode & FMODE_SYNC); } #ifdef HAVE_FSYNC @@ -4589,9 +4586,7 @@ rb_io_isatty(VALUE io) rb_io_t *fptr; GetOpenFile(io, fptr); - if (isatty(fptr->fd) == 0) - return Qfalse; - return Qtrue; + return RBOOL(isatty(fptr->fd) != 0); } #if defined(HAVE_FCNTL) && defined(F_GETFD) && defined(F_SETFD) && defined(FD_CLOEXEC) @@ -5129,7 +5124,7 @@ rb_io_closed(VALUE io) } fptr = rb_io_get_fptr(io); - return 0 <= fptr->fd ? Qfalse : Qtrue; + return RBOOL(0 > fptr->fd); } /* @@ -5631,7 +5626,7 @@ rb_io_binmode_p(VALUE io) { rb_io_t *fptr; GetOpenFile(io, fptr); - return fptr->mode & FMODE_BINMODE ? Qtrue : Qfalse; + return RBOOL(fptr->mode & FMODE_BINMODE); } static const char* @@ -13054,7 +13049,7 @@ argf_binmode_m(VALUE argf) static VALUE argf_binmode_p(VALUE argf) { - return ARGF.binmode ? Qtrue : Qfalse; + return RBOOL(ARGF.binmode); } /* |