mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Assert that typed data is distinguished from non-typed
This commit is contained in:
parent
cc8f55e9e3
commit
42ac3f79ba
Notes:
git
2020-04-25 11:15:28 +09:00
1 changed files with 2 additions and 0 deletions
2
gc.c
2
gc.c
|
|
@ -2327,6 +2327,7 @@ rb_imemo_new_debug(enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0,
|
|||
VALUE
|
||||
rb_data_object_wrap(VALUE klass, void *datap, RUBY_DATA_FUNC dmark, RUBY_DATA_FUNC dfree)
|
||||
{
|
||||
RUBY_ASSERT_ALWAYS(dfree != (RUBY_DATA_FUNC)1);
|
||||
if (klass) Check_Type(klass, T_CLASS);
|
||||
return newobj_of(klass, T_DATA, (VALUE)dmark, (VALUE)dfree, (VALUE)datap, FALSE);
|
||||
}
|
||||
|
|
@ -2342,6 +2343,7 @@ rb_data_object_zalloc(VALUE klass, size_t size, RUBY_DATA_FUNC dmark, RUBY_DATA_
|
|||
VALUE
|
||||
rb_data_typed_object_wrap(VALUE klass, void *datap, const rb_data_type_t *type)
|
||||
{
|
||||
RUBY_ASSERT_ALWAYS(type);
|
||||
if (klass) Check_Type(klass, T_CLASS);
|
||||
return newobj_of(klass, T_DATA, (VALUE)type, (VALUE)1, (VALUE)datap, type->flags & RUBY_FL_WB_PROTECTED);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue