Use array initialization rather than for loop

This commit is contained in:
Peter Zhu 2024-02-28 14:54:21 -05:00
parent c5b568bab6
commit 4b92b60f0b

6
gc.c
View File

@ -4857,7 +4857,7 @@ static VALUE
count_objects(int argc, VALUE *argv, VALUE os)
{
rb_objspace_t *objspace = &rb_objspace;
size_t counts[T_MASK+1];
size_t counts[T_MASK + 1] = { 0 };
size_t freed = 0;
size_t total = 0;
size_t i;
@ -4869,10 +4869,6 @@ count_objects(int argc, VALUE *argv, VALUE os)
rb_raise(rb_eTypeError, "non-hash given");
}
for (i = 0; i <= T_MASK; i++) {
counts[i] = 0;
}
for (i = 0; i < heap_allocated_pages; i++) {
struct heap_page *page = heap_pages_sorted[i];
short stride = page->slot_size;