mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
use RB_TYPE_P() instead of comparison of TYPE()
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
87c8c5edf4
commit
b0dd250dc9
21 changed files with 46 additions and 46 deletions
4
error.c
4
error.c
|
@ -451,7 +451,7 @@ rb_typeddata_inherited_p(const rb_data_type_t *child, const rb_data_type_t *pare
|
|||
int
|
||||
rb_typeddata_is_kind_of(VALUE obj, const rb_data_type_t *data_type)
|
||||
{
|
||||
if (SPECIAL_CONST_P(obj) || BUILTIN_TYPE(obj) != T_DATA ||
|
||||
if (!RB_TYPE_P(obj, T_DATA) ||
|
||||
!RTYPEDDATA_P(obj) || !rb_typeddata_inherited_p(RTYPEDDATA_TYPE(obj), data_type)) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -464,7 +464,7 @@ rb_check_typeddata(VALUE obj, const rb_data_type_t *data_type)
|
|||
const char *etype;
|
||||
static const char mesg[] = "wrong argument type %s (expected %s)";
|
||||
|
||||
if (SPECIAL_CONST_P(obj) || BUILTIN_TYPE(obj) != T_DATA) {
|
||||
if (!RB_TYPE_P(obj, T_DATA)) {
|
||||
etype = builtin_type_name(obj);
|
||||
rb_raise(rb_eTypeError, mesg, etype, data_type->wrap_struct_name);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue