mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
refactoring frozen_shareable_p
This commit is contained in:
parent
89f6644de7
commit
3a97d36157
1 changed files with 6 additions and 10 deletions
16
ractor.c
16
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
|
||||
|
|
Loading…
Add table
Reference in a new issue