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

ruby-changes:69384

From: Nobuyoshi <ko1@a...>
Date: Sun, 24 Oct 2021 19:25:15 +0900 (JST)
Subject: [ruby-changes:69384] 9822ebee5b (master): suppress warnings by parenthesizing unclear expressions

https://git.ruby-lang.org/ruby.git/commit/?id=9822ebee5b

From 9822ebee5b35d9b6581ed64ac3b4bb05c972eab3 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Wed, 25 Oct 2017 18:32:44 +0900
Subject: suppress warnings by parenthesizing unclear expressions

---
 io.c     | 8 ++++----
 thread.c | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/io.c b/io.c
index 50c9fea62c..a340f5b150 100644
--- a/io.c
+++ b/io.c
@@ -322,7 +322,7 @@ rb_cloexec_open(const char *pathname, int flags, mode_t mode) https://github.com/ruby/ruby/blob/trunk/io.c#L322
 
     while ((ret = open(pathname, flags, mode)) == -1) {
         int e = errno;
-        if (e != EAGAIN && e != EWOULDBLOCK) break;
+        if ((e != EAGAIN) && (e != EWOULDBLOCK)) break;
         if (retry_count++ >= retry_max_count) break;
 
         sleep(retry_interval);
@@ -3082,7 +3082,7 @@ io_getpartial(int argc, VALUE *argv, VALUE io, int no_exception, int nonblock) https://github.com/ruby/ruby/blob/trunk/io.c#L3082
 	    int e = errno;
             if (!nonblock && fptr_wait_readable(fptr))
                 goto again;
-	    if (nonblock && (e == EWOULDBLOCK || e == EAGAIN)) {
+	    if (nonblock && ((e == EWOULDBLOCK) || (e == EAGAIN))) {
                 if (no_exception)
                     return sym_wait_readable;
                 else
@@ -3218,7 +3218,7 @@ io_read_nonblock(rb_execution_context_t *ec, VALUE io, VALUE length, VALUE str, https://github.com/ruby/ruby/blob/trunk/io.c#L3218
         n = read_internal_locktmp(str, &iis);
         if (n < 0) {
 	    int e = errno;
-	    if ((e == EWOULDBLOCK || e == EAGAIN)) {
+	    if ((e == EWOULDBLOCK) || (e == EAGAIN)) {
                 if (!ex) return sym_wait_readable;
 		rb_readwrite_syserr_fail(RB_IO_WAIT_READABLE,
 					 e, "read would block");
@@ -3260,7 +3260,7 @@ io_write_nonblock(rb_execution_context_t *ec, VALUE io, VALUE str, VALUE ex) https://github.com/ruby/ruby/blob/trunk/io.c#L3260
 
     if (n < 0) {
 	int e = errno;
-	if (e == EWOULDBLOCK || e == EAGAIN) {
+	if ((e == EWOULDBLOCK) || (e == EAGAIN)) {
             if (!ex) {
 		return sym_wait_writable;
 	    }
diff --git a/thread.c b/thread.c
index 86676d7bc6..336ac7836c 100644
--- a/thread.c
+++ b/thread.c
@@ -1670,7 +1670,7 @@ rb_nogvl(void *(*func)(void *), void *data1, https://github.com/ruby/ruby/blob/trunk/thread.c#L1670
     int saved_errno = 0;
     VALUE ubf_th = Qfalse;
 
-    if (ubf == RUBY_UBF_IO || ubf == RUBY_UBF_PROCESS) {
+    if ((ubf == RUBY_UBF_IO) || (ubf == RUBY_UBF_PROCESS)) {
 	ubf = ubf_select;
 	data2 = th;
     }
-- 
cgit v1.2.1


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

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