aboutsummaryrefslogtreecommitdiffstats
path: root/gc.c
diff options
context:
space:
mode:
authoreileencodes <eileencodes@gmail.com>2024-03-25 13:53:51 -0400
committerPeter Zhu <peter@peterzhu.ca>2024-03-26 14:29:36 -0400
commite16086b7f25d334c8049bd0e237191bdb3300d88 (patch)
tree4cefaf13d402b54c27f9391ec7c81e3a6f982c54 /gc.c
parent16cf9047c63aad5483bebe2068cdaa832447ba77 (diff)
downloadruby-e16086b7f25d334c8049bd0e237191bdb3300d88.tar.gz
Refactor init_copy gc attributes
This PR moves `rb_copy_wb_protected_attribute` and `rb_gc_copy_finalizer` into a single function called `rb_gc_copy_attributes` to be called by `init_copy`. This reduces the surface area of the GC API. Co-authored-by: Peter Zhu <peter@peterzhu.ca>
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gc.c b/gc.c
index 4b30bb171d..8812c0fea5 100644
--- a/gc.c
+++ b/gc.c
@@ -8691,11 +8691,12 @@ rb_gc_writebarrier_remember(VALUE obj)
}
void
-rb_copy_wb_protected_attribute(VALUE dest, VALUE obj)
+rb_gc_copy_attributes(VALUE dest, VALUE obj)
{
if (RVALUE_WB_UNPROTECTED(obj)) {
rb_gc_writebarrier_unprotect(dest);
}
+ rb_gc_copy_finalizer(dest, obj);
}
size_t