diff options
author | Nobuyoshi Nakada <[email protected]> | 2022-06-25 18:05:52 +0900 |
---|---|---|
committer | git <[email protected]> | 2022-06-25 18:09:11 +0900 |
commit | 8c1d3c2dce972ac2d0bc973b22b7736b03c6d0df (patch) | |
tree | 3cf825e82bdda050ec23ae6752feb942aab75fd9 | |
parent | d281347abbbe7f3b588646977a21b8f929aaa5bb (diff) |
[ruby/io-wait] Remove C99-ism for some platforms [ci skip]
Fix https://github.com/ruby/io-wait/pull/11
https://github.com/ruby/io-wait/commit/845f9a1f55
-rw-r--r-- | ext/io/wait/wait.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/ext/io/wait/wait.c b/ext/io/wait/wait.c index 1e3b43c919..30637da584 100644 --- a/ext/io/wait/wait.c +++ b/ext/io/wait/wait.c @@ -146,7 +146,7 @@ io_ready_p(VALUE io) #endif } -// Ruby 3.2+ can define these methods. This macro indicates that case. +/* Ruby 3.2+ can define these methods. This macro indicates that case. */ #ifndef RUBY_IO_WAIT_METHODS /* @@ -351,18 +351,18 @@ io_wait(int argc, VALUE *argv, VALUE io) #else VALUE timeout = Qundef; rb_io_event_t events = 0; - int return_io = 0; + int i, return_io = 0; - // The documented signature for this method is actually incorrect. - // A single timeout is allowed in any position, and multiple symbols can be given. - // Whether this is intentional or not, I don't know, and as such I consider this to - // be a legacy/slow path. + /* The documented signature for this method is actually incorrect. + * A single timeout is allowed in any position, and multiple symbols can be given. + * Whether this is intentional or not, I don't know, and as such I consider this to + * be a legacy/slow path. */ if (argc != 2 || (RB_SYMBOL_P(argv[0]) || RB_SYMBOL_P(argv[1]))) { - // We'd prefer to return the actual mask, but this form would return the io itself: + /* We'd prefer to return the actual mask, but this form would return the io itself: */ return_io = 1; - // Slow/messy path: - for (int i = 0; i < argc; i += 1) { + /* Slow/messy path: */ + for (i = 0; i < argc; i += 1) { if (RB_SYMBOL_P(argv[i])) { events |= wait_mode_sym(argv[i]); } @@ -381,7 +381,7 @@ io_wait(int argc, VALUE *argv, VALUE io) } } else /* argc == 2 and neither are symbols */ { - // This is the fast path: + /* This is the fast path: */ events = io_event_from_value(argv[0]); timeout = argv[1]; } @@ -391,9 +391,9 @@ io_wait(int argc, VALUE *argv, VALUE io) RB_IO_POINTER(io, fptr); if (rb_io_read_pending(fptr)) { - // This was the original behaviour: + /* This was the original behaviour: */ if (return_io) return Qtrue; - // New behaviour always returns an event mask: + /* New behaviour always returns an event mask: */ else return RB_INT2NUM(RUBY_IO_READABLE); } } |