summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authoreileencodes <[email protected]>2024-03-25 13:53:51 -0400
committerPeter Zhu <[email protected]>2024-03-26 14:29:36 -0400
commite16086b7f25d334c8049bd0e237191bdb3300d88 (patch)
tree4cefaf13d402b54c27f9391ec7c81e3a6f982c54 /object.c
parent16cf9047c63aad5483bebe2068cdaa832447ba77 (diff)
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 <[email protected]>
Diffstat (limited to 'object.c')
-rw-r--r--object.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/object.c b/object.c
index 8eee22fbb4..4673ba9f69 100644
--- a/object.c
+++ b/object.c
@@ -396,10 +396,8 @@ init_copy(VALUE dest, VALUE obj)
RBASIC(dest)->flags &= ~(T_MASK|FL_EXIVAR);
// Copies the shape id from obj to dest
RBASIC(dest)->flags |= RBASIC(obj)->flags & (T_MASK|FL_EXIVAR);
- rb_copy_wb_protected_attribute(dest, obj);
+ rb_gc_copy_attributes(dest, obj);
rb_copy_generic_ivar(dest, obj);
- rb_gc_copy_finalizer(dest, obj);
-
if (RB_TYPE_P(obj, T_OBJECT)) {
rb_obj_copy_ivar(dest, obj);
}