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

ruby-changes:71437

From: Peter <ko1@a...>
Date: Thu, 17 Mar 2022 04:15:48 +0900 (JST)
Subject: [ruby-changes:71437] 819f4f0e65 (master): Always skip dummy head of subclass in rb_prepend_module

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

From 819f4f0e65b78c7a57b79a5e8c527adecc3c84d6 Mon Sep 17 00:00:00 2001
From: Peter Zhu <peter@p...>
Date: Wed, 16 Mar 2022 15:10:11 -0400
Subject: Always skip dummy head of subclass in rb_prepend_module

The first node of the subclass linked list of always a dummy head, so it
should be skipped.
---
 class.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/class.c b/class.c
index 0acac96022..28743a229e 100644
--- a/class.c
+++ b/class.c
@@ -1353,7 +1353,7 @@ rb_prepend_module(VALUE klass, VALUE module) https://github.com/ruby/ruby/blob/trunk/class.c#L1353
     if (RB_TYPE_P(klass, T_MODULE)) {
         rb_subclass_entry_t *iclass = RCLASS_SUBCLASSES(klass);
         // skip the placeholder subclass entry at the head of the list if it exists
-        if (iclass && iclass->next) {
+        if (iclass) {
             RUBY_ASSERT(!iclass->klass);
             iclass = iclass->next;
         }
-- 
cgit v1.2.1


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

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