From e3ef21c3077c4b45edb44c06b0d580a4c913c557 Mon Sep 17 00:00:00 2001 From: Matt Valentine-House Date: Tue, 26 Jan 2021 16:56:16 +0000 Subject: [PATCH] Use RCLASS_EXT macro instead of directly accessing ptr --- gc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gc.c b/gc.c index b1e115faf0..2d76b54509 100644 --- a/gc.c +++ b/gc.c @@ -2847,9 +2847,9 @@ obj_free(rb_objspace_t *objspace, VALUE obj) } rb_class_remove_from_module_subclasses(obj); rb_class_remove_from_super_subclasses(obj); - if (RANY(obj)->as.klass.ptr) - xfree(RANY(obj)->as.klass.ptr); - RANY(obj)->as.klass.ptr = NULL; + if (RCLASS_EXT(obj)) + xfree(RCLASS_EXT(obj)); + RCLASS_EXT(obj) = NULL; (void)RB_DEBUG_COUNTER_INC_IF(obj_module_ptr, BUILTIN_TYPE(obj) == T_MODULE); (void)RB_DEBUG_COUNTER_INC_IF(obj_class_ptr, BUILTIN_TYPE(obj) == T_CLASS); @@ -3015,8 +3015,8 @@ obj_free(rb_objspace_t *objspace, VALUE obj) cc_table_free(objspace, obj, FALSE); rb_class_remove_from_module_subclasses(obj); rb_class_remove_from_super_subclasses(obj); - xfree(RANY(obj)->as.klass.ptr); - RANY(obj)->as.klass.ptr = NULL; + xfree(RCLASS_EXT(obj)); + RCLASS_EXT(obj) = NULL; RB_DEBUG_COUNTER_INC(obj_iclass_ptr); break;