From 3a97d361576d1cc198047d502c5165aa37b7f86e Mon Sep 17 00:00:00 2001 From: Koichi Sasada Date: Wed, 21 Oct 2020 23:57:44 +0900 Subject: [PATCH] refactoring frozen_shareable_p --- ractor.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/ractor.c b/ractor.c index 93a1fc59fd..2cf34cb392 100644 --- a/ractor.c +++ b/ractor.c @@ -2065,18 +2065,14 @@ rb_obj_traverse(VALUE obj, static int frozen_shareable_p(VALUE obj) { - switch (BUILTIN_TYPE(obj)) { - case T_DATA: - if (RTYPEDDATA_P(obj)) { - const rb_data_type_t *type = RTYPEDDATA_TYPE(obj); - if (type->flags & RUBY_TYPED_FROZEN_SHAREABLE) { - return true; - } - } - return false; - default: + if (!RB_TYPE_P(obj, T_DATA) || + (RTYPEDDATA_P(obj) && + RTYPEDDATA_TYPE(obj)->flags & RUBY_TYPED_FROZEN_SHAREABLE)) { return true; } + else { + return false; + } } static int