[前][次][番号順一覧][スレッド一覧]

ruby-changes:51482

From: nobu <ko1@a...>
Date: Tue, 19 Jun 2018 08:19:45 +0900 (JST)
Subject: [ruby-changes:51482] nobu:r63692 (trunk): Removed unobservable behavior

nobu	2018-06-19 08:19:38 +0900 (Tue, 19 Jun 2018)

  New Revision: 63692

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63692

  Log:
    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.

  Modified files:
    trunk/spec/ruby/optional/capi/data_spec.rb
    trunk/spec/ruby/optional/capi/ext/data_spec.c
Index: spec/ruby/optional/capi/data_spec.rb
===================================================================
--- spec/ruby/optional/capi/data_spec.rb	(revision 63691)
+++ spec/ruby/optional/capi/data_spec.rb	(revision 63692)
@@ -19,11 +19,6 @@ describe "CApiWrappedStruct" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/data_spec.rb#L19
     @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)
Index: spec/ruby/optional/capi/ext/data_spec.c
===================================================================
--- spec/ruby/optional/capi/ext/data_spec.c	(revision 63691)
+++ spec/ruby/optional/capi/ext/data_spec.c	(revision 63692)
@@ -38,12 +38,6 @@ VALUE sws_wrap_struct(VALUE self, VALUE https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/ext/data_spec.c#L38
   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) { https://github.com/ruby/ruby/blob/trunk/spec/ruby/optional/capi/ext/data_spec.c#L78
 
   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);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]