Skip to content

Commit a61e711

Browse files
Provide compaction support for argf_type
1 parent 6012145 commit a61e711

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

io.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9996,9 +9996,20 @@ argf_memsize(const void *ptr)
99969996
return size;
99979997
}
99989998

9999+
static void
10000+
argf_compact(void *ptr)
10001+
{
10002+
struct argf *p = ptr;
10003+
p->filename = rb_gc_location(p->filename);
10004+
p->current_file = rb_gc_location(p->current_file);
10005+
p->argv = rb_gc_location(p->argv);
10006+
p->inplace = rb_gc_location(p->inplace);
10007+
p->encs.ecopts = rb_gc_location(p->encs.ecopts);
10008+
}
10009+
999910010
static const rb_data_type_t argf_type = {
1000010011
"ARGF",
10001-
{argf_mark, RUBY_TYPED_DEFAULT_FREE, argf_memsize},
10012+
{argf_mark, RUBY_TYPED_DEFAULT_FREE, argf_memsize, argf_compact},
1000210013
0, 0, RUBY_TYPED_FREE_IMMEDIATELY
1000310014
};
1000410015

0 commit comments

Comments
 (0)