Permalink
Browse files

Use index in `each_object`.

  • Loading branch information...
matz committed May 1, 2017
1 parent 24a24a4 commit a1ea2a670c781848deec3ecb8657fc4aa3b8d34b
Showing with 6 additions and 5 deletions.
  1. +6 −5 src/gc.c
View
@@ -1491,15 +1491,16 @@ gc_generational_mode_set(mrb_state *mrb, mrb_value self)
static void
gc_each_objects(mrb_state *mrb, mrb_gc *gc, mrb_each_object_callback *callback, void *data)
{
mrb_heap_page* page = gc->heaps;
mrb_heap_page* page;
page = gc->heaps;
while (page != NULL) {
RVALUE *p, *pend;
RVALUE *p;
int i;
p = objects(page);
pend = p + MRB_HEAP_PAGE_SIZE;
for (;p < pend; p++) {
if ((*callback)(mrb, &p->as.basic, data) == MRB_EACH_OBJ_BREAK)
for (i=0; i < MRB_HEAP_PAGE_SIZE; i++) {
if ((*callback)(mrb, &p[i].as.basic, data) == MRB_EACH_OBJ_BREAK)
return;
}
page = page->next;

0 comments on commit a1ea2a6

Please sign in to comment.