summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--error.c10
-rw-r--r--include/ruby/ruby.h4
3 files changed, 12 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 0aba67c..3fdb9f4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Sat Nov 29 16:14:50 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * error.c (rb_typeddata_is_kind_of, rb_check_typeddata): ditto.
+
+ * error.c (rb_typeddata_inherited_p): deprecate. still keep for
+ potential binary compatibility.
+
Sat Nov 29 10:49:23 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* win32/win32.c (win32_direct_conv, rb_w32_readdir): convert UTF-8
diff --git a/error.c b/error.c
index 375c2ff..81684a1 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);
}
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index fb51132..635076f 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -973,7 +973,7 @@ struct rb_data_type_struct {
void *reserved[2]; /* For future extension.
This array *must* be filled with ZERO. */
} function;
- const rb_data_type_t *parent;
+ void *const reserved;
void *data; /* This area can be used for any purpose
by a programmer who define the type. */
VALUE flags; /* FL_WB_PROTECTED */
@@ -981,7 +981,6 @@ struct rb_data_type_struct {
#define HAVE_TYPE_RB_DATA_TYPE_T 1
#define HAVE_RB_DATA_TYPE_T_FUNCTION 1
-#define HAVE_RB_DATA_TYPE_T_PARENT 1
struct RTypedData {
struct RBasic basic;
@@ -1010,7 +1009,6 @@ typedef void (*RUBY_DATA_FUNC)(void*);
#endif
VALUE rb_data_object_alloc(VALUE,void*,RUBY_DATA_FUNC,RUBY_DATA_FUNC);
VALUE rb_data_typed_object_alloc(VALUE klass, void *datap, const rb_data_type_t *);
-int rb_typeddata_inherited_p(const rb_data_type_t *child, const rb_data_type_t *parent);
int rb_typeddata_is_kind_of(VALUE, const rb_data_type_t *);
void *rb_check_typeddata(VALUE, const rb_data_type_t *);
#define Check_TypedStruct(v,t) rb_check_typeddata((VALUE)(v),(t))