[前][次][番号順一覧][スレッド一覧]

ruby-changes:72310

From: Nobuyoshi <ko1@a...>
Date: Sat, 25 Jun 2022 18:09:22 +0900 (JST)
Subject: [ruby-changes:72310] 8c1d3c2dce (master): [ruby/io-wait] Remove C99-ism for some platforms [ci skip]

https://git.ruby-lang.org/ruby.git/commit/?id=8c1d3c2dce

From 8c1d3c2dce972ac2d0bc973b22b7736b03c6d0df Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sat, 25 Jun 2022 18:05:52 +0900
Subject: [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
---
 ext/io/wait/wait.c | 24 ++++++++++++------------
 1 file 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) https://github.com/ruby/ruby/blob/trunk/ext/io/wait/wait.c#L146
 #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) https://github.com/ruby/ruby/blob/trunk/ext/io/wait/wait.c#L351
 #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) https://github.com/ruby/ruby/blob/trunk/ext/io/wait/wait.c#L381
         }
     }
     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) https://github.com/ruby/ruby/blob/trunk/ext/io/wait/wait.c#L391
         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);
         }
     }
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]