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

ruby-changes:68528

From: Nobuyoshi <ko1@a...>
Date: Tue, 19 Oct 2021 17:14:25 +0900 (JST)
Subject: [ruby-changes:68528] ec021e469d (master): Get rid of type-punning cast

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

From ec021e469d227d3f4e9c95ebb8c52b4a2526870a Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Tue, 19 Oct 2021 17:08:25 +0900
Subject: Get rid of type-punning cast

---
 vm_insnhelper.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 6c2ba1513d..f05e5e1fc7 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -1084,14 +1084,16 @@ static bool https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L1084
 iv_index_tbl_lookup(struct st_table *iv_index_tbl, ID id, struct rb_iv_index_tbl_entry **ent)
 {
     int found;
+    st_data_t ent_data;
 
     if (iv_index_tbl == NULL) return false;
 
     RB_VM_LOCK_ENTER();
     {
-        found = st_lookup(iv_index_tbl, (st_data_t)id, (st_data_t *)ent);
+        found = st_lookup(iv_index_tbl, (st_data_t)id, &ent_data);
     }
     RB_VM_LOCK_LEAVE();
+    if (found) *ent = (struct rb_iv_index_tbl_entry *)ent_data;
 
     return found ? true : false;
 }
-- 
cgit v1.2.1


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

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