summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2021-11-05 21:31:31 +0900
committerYusuke Endoh <mame@ruby-lang.org>2021-11-09 16:11:10 +0900
commit3628616dd10ddbdaa92378264149565295c9f191 (patch)
treef72db4ddfbbca3414daa1a698b610ff1b0e30658
parent64007fc57f360eab4b18b26389719a85f45b25c3 (diff)
Remove a redundant condition
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5070
-rw-r--r--class.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/class.c b/class.c
index a22bb756a5..cfdd4ddc9a 100644
--- a/class.c
+++ b/class.c
@@ -1349,7 +1349,7 @@ class_descendants_recursive(VALUE klass, VALUE v)
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)
// 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;