diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-07 07:54:28 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-07 07:54:28 +0000 |
commit | ac3c2866c74a703d5208a9001606ac4738daadbd (patch) | |
tree | 995b4ebf38b0616393b4c0391a711544636e43de /error.c | |
parent | 74a6cc877cb0d8af8f34103a003689c9f184d85e (diff) | |
download | ruby-ac3c2866c74a703d5208a9001606ac4738daadbd.tar.gz |
* error.c (rb_typed_struct_is_kind_of): new function to see if the
given typed struct.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'error.c')
-rw-r--r-- | error.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -316,6 +316,16 @@ rb_check_type(VALUE x, int t) } } +int +rb_typed_struct_is_kind_of(VALUE obj, const rb_data_type_t *data_type) +{ + if (SPECIAL_CONST_P(obj) || BUILTIN_TYPE(obj) != T_DATA || + !RTYPEDDATA_P(obj) || RTYPEDDATA_TYPE(obj) != data_type) { + return 0; + } + return 1; +} + void * rb_check_typed_struct(VALUE obj, const rb_data_type_t *data_type) { |