summaryrefslogtreecommitdiff
path: root/internal.h
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-27 03:19:06 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-27 03:19:06 +0000
commitb549d14c00784b45e7248cac7e1274f8a15f9883 (patch)
tree5d4c7ce8c7a8a1f61445bac6efb9dfcf30b11460 /internal.h
parenta9ace57505c1430889f3e3eefa0e3f6f5294756a (diff)
Add rb_typeddata_is_instance_of
Similar to rb_typeddata_is_kind_of, except for that inherited type is not an instance. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66019 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'internal.h')
-rw-r--r--internal.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/internal.h b/internal.h
index b49939c61f..8f69c6f1da 100644
--- a/internal.h
+++ b/internal.h
@@ -2266,6 +2266,13 @@ NORETURN(void rb_unexpected_type(VALUE,int));
((t) == RUBY_T_DATA && RTYPEDDATA_P(v)) ? \
rb_unexpected_type((VALUE)(v), (t)) : (void)0)
+static inline int
+rb_typeddata_is_instance_of_inline(VALUE obj, const rb_data_type_t *data_type)
+{
+ return RB_TYPE_P(obj, T_DATA) && RTYPEDDATA_P(obj) && (RTYPEDDATA_TYPE(obj) == data_type);
+}
+#define rb_typeddata_is_instance_of rb_typeddata_is_instance_of_inline
+
/* file.c (export) */
#if defined HAVE_READLINK && defined RUBY_ENCODING_H
VALUE rb_readlink(VALUE path, rb_encoding *enc);