diff options
Diffstat (limited to 'include/ruby/random.h')
| -rw-r--r-- | include/ruby/random.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/include/ruby/random.h b/include/ruby/random.h index 39bdb6f3e3..740be6bdad 100644 --- a/include/ruby/random.h +++ b/include/ruby/random.h @@ -11,7 +11,7 @@ * * This is a set of APIs to roll your own subclass of ::rb_cRandom. An * illustrative example of such PRNG can be found at - * `ext/-test-/ramdom/loop.c`. + * `ext/-test-/random/loop.c`. */ #include "ruby/ruby.h" @@ -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); |
