Skip to content

Commit

Permalink
rb_objspace_call_finalizer_i
Browse files Browse the repository at this point in the history
  • Loading branch information
byroot committed Jun 21, 2024
1 parent c5158ef commit 7a2ce88
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -3071,7 +3071,7 @@ memsize_deprecated_rdata_object(const void *ptr)

#define DEPRECATED_DATA_FREE RBIMPL_DATA_FUNC(-3)

const rb_data_type_t deprecated_rdata_type = {
const rb_data_type_t ruby_deprecated_rdata_type = {
.wrap_struct_name = "RDATA(deprecated)",
.function = {
.dmark = mark_deprecated_rdata_object,
Expand All @@ -3086,7 +3086,7 @@ rb_data_object_wrap(VALUE klass, void *datap, RUBY_DATA_FUNC dmark, RUBY_DATA_FU
RUBY_ASSERT_ALWAYS(dfree != (RUBY_DATA_FUNC)1);
if (klass) rb_data_object_check(klass);

VALUE obj = rb_data_typed_object_zalloc(klass, sizeof(struct RData), &deprecated_rdata_type);
VALUE obj = rb_data_typed_object_zalloc(klass, sizeof(struct RData), &ruby_deprecated_rdata_type);

struct RData *rdata = (struct RData *)obj;
rdata->dmark = dmark;
Expand Down Expand Up @@ -4363,7 +4363,7 @@ rb_objspace_call_finalizer_i(VALUE obj, void *data)

switch (BUILTIN_TYPE(obj)) {
case T_DATA:
if (!rb_free_at_exit && (!DATA_PTR(obj) || !RDATA(obj)->dfree)) break;
if (!rb_free_at_exit && (!RTYPEDDATA_GET_DATA(obj) || !RANY(obj)->as.typeddata.type->function.dfree)) break;
if (rb_obj_is_thread(obj)) break;
if (rb_obj_is_mutex(obj)) break;
if (rb_obj_is_fiber(obj)) break;
Expand Down
4 changes: 2 additions & 2 deletions include/ruby/internal/core/rtypeddata.h
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,6 @@ RBIMPL_SYMBOL_EXPORT_END()
#define TypedData_Get_Struct(obj,type,data_type,sval) \
((sval) = RBIMPL_CAST((type *)rb_check_typeddata((obj), (data_type))))

extern const rb_data_type_t deprecated_rdata_type;

RBIMPL_ATTR_PURE()
RBIMPL_ATTR_ARTIFICIAL()
Expand All @@ -541,7 +540,8 @@ RBIMPL_ATTR_ARTIFICIAL()
static inline bool
rbimpl_rtypeddata_p(VALUE obj)
{
return RTYPEDDATA(obj)->type != &deprecated_rdata_type;
extern const rb_data_type_t ruby_deprecated_rdata_type;
return RTYPEDDATA(obj)->type != &ruby_deprecated_rdata_type;
}

RBIMPL_ATTR_PURE_UNLESS_DEBUG()
Expand Down

0 comments on commit 7a2ce88

Please sign in to comment.