mirror of
https://github.com/ruby/ruby.git
synced 2026-01-26 20:19:19 +00:00
Ensure T_DATA before RTYPEDDATA_P
For the precondition of `RTYPEDDATA_P` that the argument must be a Ruby object of `::RUBY_T_DATA`.
This commit is contained in:
parent
eaa83e505f
commit
68cd46353c
Notes:
git
2025-12-28 18:41:56 +00:00
@ -332,7 +332,9 @@ RBIMPL_ATTR_PURE_UNLESS_DEBUG()
|
||||
static inline const rb_random_interface_t *
|
||||
rb_rand_if(VALUE obj)
|
||||
{
|
||||
RBIMPL_ASSERT_OR_ASSUME(RB_TYPE_P(obj, T_DATA));
|
||||
RBIMPL_ASSERT_OR_ASSUME(RTYPEDDATA_P(obj));
|
||||
RUBY_ASSERT(rb_typeddata_is_kind_of(obj, &rb_random_data_type));
|
||||
const struct rb_data_type_struct *t = RTYPEDDATA_TYPE(obj);
|
||||
const void *ret = t->data;
|
||||
return RBIMPL_CAST((const rb_random_interface_t *)ret);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user