aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--spec/ruby/optional/capi/ext/typed_data_spec.c7
-rw-r--r--spec/ruby/optional/capi/typed_data_spec.rb5
-rw-r--r--vm_insnhelper.h2
3 files changed, 1 insertions, 13 deletions
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)
diff --git a/vm_insnhelper.h b/vm_insnhelper.h
index 1a1b2f0cd3..25bd92f6fd 100644
--- a/vm_insnhelper.h
+++ b/vm_insnhelper.h
@@ -47,7 +47,7 @@ rb_obj_hidden_p(VALUE obj)
}
}
-#define PUSH(x) (SET_SV(x), INC_SP(1))
+#define PUSH(x) (VM_ASSERT(!rb_obj_hidden_p(x)), SET_SV(x), INC_SP(1))
#define TOPN(n) (*(GET_SP()-(n)-1))
#define POPN(n) (DEC_SP(n))
#define POP() (DEC_SP(1))