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

ruby-changes:69471

From: Kazuki <ko1@a...>
Date: Wed, 27 Oct 2021 15:44:45 +0900 (JST)
Subject: [ruby-changes:69471] 9541b3b7c0 (master): random.c: simplify Random object deallocation

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

From 9541b3b7c07eeca437857bb5430dbc68d3c04858 Mon Sep 17 00:00:00 2001
From: Kazuki Yamaguchi <k@r...>
Date: Thu, 25 Feb 2021 15:52:27 +0900
Subject: random.c: simplify Random object deallocation

This is a follow-up for commit 265c0022390e ("Do not allocate
ractor-local storage in dfree function during GC", 2021-02-09).

The comparison with the default rb_random_mt_t is useless in the first
place, since it is never equal: no actual Random object is associated
with it.

[Bug #17653] https://bugs.ruby-lang.org/issues/17653
---
 random.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/random.c b/random.c
index 0503436c47f..a474e8aa050 100644
--- a/random.c
+++ b/random.c
@@ -260,14 +260,7 @@ const rb_data_type_t rb_random_data_type = { https://github.com/ruby/ruby/blob/trunk/random.c#L260
 };
 
 #define random_mt_mark rb_random_mark
-
-static void
-random_mt_free(void *ptr)
-{
-    rb_random_mt_t *rnd = rb_ractor_local_storage_ptr(default_rand_key);
-    if (ptr != rnd)
-	xfree(ptr);
-}
+#define random_mt_free RUBY_TYPED_DEFAULT_FREE
 
 static size_t
 random_mt_memsize(const void *ptr)
-- 
cgit v1.2.1


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

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