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

ruby-changes:69659

From: Yusuke <ko1@a...>
Date: Tue, 9 Nov 2021 16:11:26 +0900 (JST)
Subject: [ruby-changes:69659] 3628616dd1 (master): Remove a redundant condition

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

From 3628616dd10ddbdaa92378264149565295c9f191 Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Fri, 5 Nov 2021 21:31:31 +0900
Subject: Remove a redundant condition

---
 class.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/class.c b/class.c
index a22bb756a55..cfdd4ddc9a4 100644
--- a/class.c
+++ b/class.c
@@ -1349,7 +1349,7 @@ class_descendants_recursive(VALUE klass, VALUE v) https://github.com/ruby/ruby/blob/trunk/class.c#L1349
     struct subclass_traverse_data *data = (struct subclass_traverse_data *) v;
 
     if (BUILTIN_TYPE(klass) == T_CLASS && !FL_TEST(klass, FL_SINGLETON)) {
-        if (data->buffer && (data->count < data->maxcount || data->maxcount == -1)) {
+        if (data->buffer && data->count < data->maxcount) {
             data->buffer[data->count] = klass;
         }
         data->count++;
@@ -1383,7 +1383,7 @@ rb_class_descendants(VALUE klass) https://github.com/ruby/ruby/blob/trunk/class.c#L1383
     // estimate the count of subclasses
     rb_class_foreach_subclass(klass, class_descendants_recursive, (VALUE) &data);
 
-    // this allocation may cause GC which may reduce the subclasses
+    // the following allocation may cause GC which may change the number of subclasses
     data.buffer = ALLOC_N(VALUE, data.count);
     data.maxcount = data.count;
     data.count = 0;
-- 
cgit v1.2.1


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

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