From 61391616f422bb95baff5ce6992044d2d9c7b2bd Mon Sep 17 00:00:00 2001 From: ko1 Date: Tue, 19 Jun 2018 02:46:10 +0000 Subject: NULL class Data_Wrap_Struct is not allowed. * spec/ruby/optional/capi/typed_data_spec.rb: same as r63692. * spec/ruby/optional/capi/ext/typed_data_spec.c: ditto. * vm_insnhelper.h (PUSH): re-enable assertion to check hidden objects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63694 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- spec/ruby/optional/capi/ext/typed_data_spec.c | 7 ------- spec/ruby/optional/capi/typed_data_spec.rb | 5 ----- 2 files changed, 12 deletions(-) (limited to 'spec/ruby') diff --git a/spec/ruby/optional/capi/ext/typed_data_spec.c b/spec/ruby/optional/capi/ext/typed_data_spec.c index 8c9a0708b4..2a82f0133f 100644 --- a/spec/ruby/optional/capi/ext/typed_data_spec.c +++ b/spec/ruby/optional/capi/ext/typed_data_spec.c @@ -101,12 +101,6 @@ VALUE sws_typed_wrap_struct(VALUE self, VALUE val) { return TypedData_Wrap_Struct(rb_cObject, &sample_typed_wrapped_struct_data_type, bar); } -VALUE sws_typed_wrap_struct_null(VALUE self, VALUE val) { - struct sample_typed_wrapped_struct* bar = (struct sample_typed_wrapped_struct *)malloc(sizeof(struct sample_typed_wrapped_struct)); - bar->foo = FIX2INT(val); - return TypedData_Wrap_Struct(0, &sample_typed_wrapped_struct_data_type, bar); -} - VALUE sws_typed_get_struct(VALUE self, VALUE obj) { struct sample_typed_wrapped_struct* bar; TypedData_Get_Struct(obj, struct sample_typed_wrapped_struct, &sample_typed_wrapped_struct_data_type, bar); @@ -161,7 +155,6 @@ void Init_typed_data_spec(void) { cls = rb_define_class("CApiWrappedTypedStructSpecs", rb_cObject); rb_define_method(cls, "typed_wrap_struct", sws_typed_wrap_struct, 1); - rb_define_method(cls, "typed_wrap_struct_null", sws_typed_wrap_struct_null, 1); rb_define_method(cls, "typed_get_struct", sws_typed_get_struct, 1); rb_define_method(cls, "typed_get_struct_other", sws_typed_get_struct_different_type, 1); rb_define_method(cls, "typed_get_struct_parent", sws_typed_get_struct_parent_type, 1); diff --git a/spec/ruby/optional/capi/typed_data_spec.rb b/spec/ruby/optional/capi/typed_data_spec.rb index 6283fc277e..b0c0cd48ed 100644 --- a/spec/ruby/optional/capi/typed_data_spec.rb +++ b/spec/ruby/optional/capi/typed_data_spec.rb @@ -29,11 +29,6 @@ describe "CApiWrappedTypedStruct" do @s.typed_get_struct_parent(a).should == 1024 end - it "allows for using NULL as the klass for Data_Wrap_Struct" do - a = @s.typed_wrap_struct_null(1024) - @s.typed_get_struct(a).should == 1024 - end - describe "RTYPEDATA" do it "returns the struct data" do a = @s.typed_wrap_struct(1024) -- cgit v1.2.3