Introduce gc_mark_table macro

This commit is contained in:
S-H-GAMELINKS 2023-05-15 17:22:01 +09:00 committed by Aaron Patterson
parent 2df5a697e2
commit 0c3f699268
Notes: git 2023-05-18 16:06:10 +00:00

View File

@ -501,12 +501,13 @@ mark_global_entry(VALUE v, void *ignored)
return ID_TABLE_CONTINUE; return ID_TABLE_CONTINUE;
} }
#define gc_mark_table(task) \
if (rb_global_tbl) { rb_id_table_foreach_values(rb_global_tbl, task##_global_entry, 0); }
void void
rb_gc_mark_global_tbl(void) rb_gc_mark_global_tbl(void)
{ {
if (rb_global_tbl) { gc_mark_table(mark);
rb_id_table_foreach_values(rb_global_tbl, mark_global_entry, 0);
}
} }
static enum rb_id_table_iterator_result static enum rb_id_table_iterator_result
@ -522,9 +523,7 @@ update_global_entry(VALUE v, void *ignored)
void void
rb_gc_update_global_tbl(void) rb_gc_update_global_tbl(void)
{ {
if (rb_global_tbl) { gc_mark_table(update);
rb_id_table_foreach_values(rb_global_tbl, update_global_entry, 0);
}
} }
static ID static ID