summaryrefslogtreecommitdiff
path: root/error.c
diff options
context:
space:
mode:
Diffstat (limited to 'error.c')
-rw-r--r--error.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/error.c b/error.c
index 375c2ff5a78..81684a112d0 100644
--- a/error.c
+++ b/error.c
@@ -541,10 +541,8 @@ rb_check_type(VALUE x, int t)
int
rb_typeddata_inherited_p(const rb_data_type_t *child, const rb_data_type_t *parent)
{
- while (child) {
- if (child == parent) return 1;
- child = child->parent;
- }
+ rb_warn("rb_typeddata_inherited_p() is deprecated");
+ if (child == parent) return 1;
return 0;
}
@@ -552,7 +550,7 @@ int
rb_typeddata_is_kind_of(VALUE obj, const rb_data_type_t *data_type)
{
if (!RB_TYPE_P(obj, T_DATA) ||
- !RTYPEDDATA_P(obj) || !rb_typeddata_inherited_p(RTYPEDDATA_TYPE(obj), data_type)) {
+ !RTYPEDDATA_P(obj) || RTYPEDDATA_TYPE(obj) != data_type) {
return 0;
}
return 1;
@@ -572,7 +570,7 @@ rb_check_typeddata(VALUE obj, const rb_data_type_t *data_type)
etype = rb_obj_classname(obj);
rb_raise(rb_eTypeError, mesg, etype, data_type->wrap_struct_name);
}
- else if (!rb_typeddata_inherited_p(RTYPEDDATA_TYPE(obj), data_type)) {
+ else if (RTYPEDDATA_TYPE(obj) != data_type) {
etype = RTYPEDDATA_TYPE(obj)->wrap_struct_name;
rb_raise(rb_eTypeError, mesg, etype, data_type->wrap_struct_name);
}