mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Removed unobservable behavior
The klass for Data_Wrap_Struct can be NULL, but it MUST NOT appear in the Ruby level. It is only for the C level implementation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7f4fbc1f09
commit
24aa9ecc47
2 changed files with 0 additions and 12 deletions
|
@ -19,11 +19,6 @@ describe "CApiWrappedStruct" do
|
|||
@s.get_struct(a).should == 1024
|
||||
end
|
||||
|
||||
it "allows for using NULL as the klass for Data_Wrap_Struct" do
|
||||
a = @s.wrap_struct_null(1024)
|
||||
@s.get_struct(a).should == 1024
|
||||
end
|
||||
|
||||
describe "RDATA()" do
|
||||
it "returns the struct data" do
|
||||
a = @s.wrap_struct(1024)
|
||||
|
|
|
@ -38,12 +38,6 @@ VALUE sws_wrap_struct(VALUE self, VALUE val) {
|
|||
return Data_Wrap_Struct(rb_cObject, &sample_wrapped_struct_mark, &sample_wrapped_struct_free, bar);
|
||||
}
|
||||
|
||||
VALUE sws_wrap_struct_null(VALUE self, VALUE val) {
|
||||
struct sample_wrapped_struct* bar = (struct sample_wrapped_struct *)malloc(sizeof(struct sample_wrapped_struct));
|
||||
bar->foo = FIX2INT(val);
|
||||
return Data_Wrap_Struct(0, &sample_wrapped_struct_mark, &sample_wrapped_struct_free, bar);
|
||||
}
|
||||
|
||||
VALUE sws_get_struct(VALUE self, VALUE obj) {
|
||||
struct sample_wrapped_struct* bar;
|
||||
Data_Get_Struct(obj, struct sample_wrapped_struct, bar);
|
||||
|
@ -84,7 +78,6 @@ void Init_data_spec(void) {
|
|||
|
||||
cls = rb_define_class("CApiWrappedStructSpecs", rb_cObject);
|
||||
rb_define_method(cls, "wrap_struct", sws_wrap_struct, 1);
|
||||
rb_define_method(cls, "wrap_struct_null", sws_wrap_struct_null, 1);
|
||||
rb_define_method(cls, "get_struct", sws_get_struct, 1);
|
||||
rb_define_method(cls, "get_struct_rdata", sws_get_struct_rdata, 1);
|
||||
rb_define_method(cls, "get_struct_data_ptr", sws_get_struct_data_ptr, 1);
|
||||
|
|
Loading…
Add table
Reference in a new issue