ruby-changes:63319
From: Nobuyoshi <ko1@a...>
Date: Sun, 11 Oct 2020 11:58:41 +0900 (JST)
Subject: [ruby-changes:63319] fddffa4c7a (master): Respect the original styles [ci skip]
https://git.ruby-lang.org/ruby.git/commit/?id=fddffa4c7a From fddffa4c7a86039c63c97f4e5c883de9f3bd0e02 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Sun, 11 Oct 2020 11:57:17 +0900 Subject: Respect the original styles [ci skip] diff --git a/ext/io/wait/wait.c b/ext/io/wait/wait.c index bde65f9..1252b56 100644 --- a/ext/io/wait/wait.c +++ b/ext/io/wait/wait.c @@ -69,15 +69,16 @@ io_wait_event(VALUE io, int event, VALUE timeout) https://github.com/ruby/ruby/blob/trunk/ext/io/wait/wait.c#L69 VALUE result = rb_io_wait(io, RB_INT2NUM(event), timeout); if (!RB_TEST(result)) { - return Qnil; + return Qnil; } int mask = RB_NUM2INT(result); if (mask & event) { - return io; - } else { - return Qfalse; + return io; + } + else { + return Qfalse; } } @@ -230,35 +231,37 @@ io_wait(int argc, VALUE *argv, VALUE io) https://github.com/ruby/ruby/blob/trunk/ext/io/wait/wait.c#L231 rb_io_event_t events = 0; if (argc < 2 || (argc >= 2 && RB_SYMBOL_P(argv[1]))) { - if (argc > 0) { - timeout = argv[0]; - } - - for (int i = 1; i < argc; i += 1) { - events |= wait_mode_sym(argv[i]); - } - } else if (argc == 2) { - events = RB_NUM2UINT(argv[0]); - - if (argv[1] != Qnil) { - timeout = argv[1]; - } - } else { - // TODO error - return Qnil; + if (argc > 0) { + timeout = argv[0]; + } + + for (int i = 1; i < argc; i += 1) { + events |= wait_mode_sym(argv[i]); + } + } + else if (argc == 2) { + events = RB_NUM2UINT(argv[0]); + + if (argv[1] != Qnil) { + timeout = argv[1]; + } + } + else { + // TODO error + return Qnil; } if (events == 0) { - events = RUBY_IO_READABLE; + events = RUBY_IO_READABLE; } if (events & RUBY_IO_READABLE) { - rb_io_t *fptr = NULL; - RB_IO_POINTER(io, fptr); + rb_io_t *fptr = NULL; + RB_IO_POINTER(io, fptr); - if (rb_io_read_pending(fptr)) { - return Qtrue; - } + if (rb_io_read_pending(fptr)) { + return Qtrue; + } } return io_wait_event(io, events, timeout); diff --git a/io.c b/io.c index b970244..c986ffb 100644 --- a/io.c +++ b/io.c @@ -1262,7 +1262,8 @@ io_fflush(rb_io_t *fptr) https://github.com/ruby/ruby/blob/trunk/io.c#L1262 } VALUE -rb_io_wait(VALUE io, VALUE events, VALUE timeout) { +rb_io_wait(VALUE io, VALUE events, VALUE timeout) +{ VALUE scheduler = rb_thread_current_scheduler(); if (scheduler != Qnil) { -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/