Skip to content

Commit 9548473

Browse files
nobuAndrii
authored andcommitted
Remove use of RTYPEDDATA_P and rbimpl_rtypeddata_p
1 parent 07f6cfe commit 9548473

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

optional/capi/ext/typed_data_spec.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,11 @@ VALUE sws_typed_rb_check_typeddata_different_type(VALUE self, VALUE obj) {
175175
return rb_check_typeddata(obj, &sample_typed_wrapped_struct_other_data_type) == DATA_PTR(obj) ? Qtrue : Qfalse;
176176
}
177177

178+
#ifndef RUBY_VERSION_IS_4_1
178179
VALUE sws_typed_RTYPEDDATA_P(VALUE self, VALUE obj) {
179180
return RTYPEDDATA_P(obj) ? Qtrue : Qfalse;
180181
}
182+
#endif
181183

182184
void Init_typed_data_spec(void) {
183185
VALUE cls = rb_define_class("CApiAllocTypedSpecs", rb_cObject);
@@ -198,7 +200,9 @@ void Init_typed_data_spec(void) {
198200
rb_define_method(cls, "rb_check_typeddata_same_type", sws_typed_rb_check_typeddata_same_type, 1);
199201
rb_define_method(cls, "rb_check_typeddata_same_type_parent", sws_typed_rb_check_typeddata_same_type_parent, 1);
200202
rb_define_method(cls, "rb_check_typeddata_different_type", sws_typed_rb_check_typeddata_different_type, 1);
203+
#ifndef RUBY_VERSION_IS_4_1
201204
rb_define_method(cls, "RTYPEDDATA_P", sws_typed_RTYPEDDATA_P, 1);
205+
#endif
202206
}
203207

204208
#ifdef __cplusplus

optional/capi/typed_data_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,13 @@
8686
end
8787
end
8888

89-
describe "RTYPEDDATA_P" do
90-
it "returns true for a typed data" do
91-
a = @s.typed_wrap_struct(1024)
92-
@s.RTYPEDDATA_P(a).should == true
93-
end
89+
ruby_version_is ""..."4.1" do
90+
describe "RTYPEDDATA_P" do
91+
it "returns true for a typed data" do
92+
a = @s.typed_wrap_struct(1024)
93+
@s.RTYPEDDATA_P(a).should == true
94+
end
9495

95-
ruby_version_is ""..."4.1" do
9696
it "returns false for an untyped data object" do
9797
a = @s.untyped_wrap_struct(1024)
9898
@s.RTYPEDDATA_P(a).should == false

0 commit comments

Comments
 (0)