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

ruby-changes:72844

From: Nobuyoshi <ko1@a...>
Date: Sun, 7 Aug 2022 00:03:16 +0900 (JST)
Subject: [ruby-changes:72844] e545cfad20 (master): Stop using casted `rb_syswait` as `proc_syswait`

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

From e545cfad20eccf72f0b7d02660ceb56ec0f1dcf7 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sun, 7 Aug 2022 00:02:38 +0900
Subject: Stop using casted `rb_syswait` as `proc_syswait`

The argument of `rb_syswait` is now `rb_pid_t` which may differ from
`int`.  Also it is an undefined behavior to take the result of casted
void function (in `rb_protect`).
---
 process.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/process.c b/process.c
index 0ba555562c..0e4dbc40f4 100644
--- a/process.c
+++ b/process.c
@@ -3773,16 +3773,12 @@ rb_exec_atfork(void* arg, char *errmsg, size_t errmsg_buflen) https://github.com/ruby/ruby/blob/trunk/process.c#L3773
     return rb_exec_async_signal_safe(arg, errmsg, errmsg_buflen); /* hopefully async-signal-safe */
 }
 
-#if SIZEOF_INT == SIZEOF_VALUE
-#define proc_syswait (VALUE (*)(VALUE))rb_syswait
-#else
 static VALUE
 proc_syswait(VALUE pid)
 {
-    rb_syswait((int)pid);
+    rb_syswait((rb_pid_t)pid);
     return Qnil;
 }
-#endif
 
 static int
 move_fds_to_avoid_crash(int *fdp, int n, VALUE fds)
-- 
cgit v1.2.1


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

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