diff options
author | murgatroid99 <mlumish@google.com> | 2016-06-02 16:00:54 -0700 |
---|---|---|
committer | murgatroid99 <mlumish@google.com> | 2016-06-02 16:00:54 -0700 |
commit | cc0f4e1c807090c97aa64f83649013e0e6ab879b (patch) | |
tree | 21ee39c0ed34334864b24369c0a2d7ae8ea8aef0 /src/ruby/ext/grpc/rb_channel.c | |
parent | e5d37dd50ef40ac4e6c5f7fe39081d3be4354f5a (diff) | |
download | grpc-grpc-cc0f4e1c807090c97aa64f83649013e0e6ab879b.tar.gz |
Remove Ruby copy initializers. They don't make sense with wrapped structs, and we don't use them anyway
Diffstat (limited to 'src/ruby/ext/grpc/rb_channel.c')
-rw-r--r-- | src/ruby/ext/grpc/rb_channel.c | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/src/ruby/ext/grpc/rb_channel.c b/src/ruby/ext/grpc/rb_channel.c index 013321ffc8..9d29b96a35 100644 --- a/src/ruby/ext/grpc/rb_channel.c +++ b/src/ruby/ext/grpc/rb_channel.c @@ -231,34 +231,6 @@ static VALUE grpc_rb_channel_watch_connectivity_state(VALUE self, return Qnil; } -/* Clones Channel instances. - - Gives Channel a consistent implementation of Ruby's object copy/dup - protocol. */ -static VALUE grpc_rb_channel_init_copy(VALUE copy, VALUE orig) { - grpc_rb_channel *orig_ch = NULL; - grpc_rb_channel *copy_ch = NULL; - - if (copy == orig) { - return copy; - } - - /* Raise an error if orig is not a channel object or a subclass. */ - if (TYPE(orig) != T_DATA || - RDATA(orig)->dfree != (RUBY_DATA_FUNC)grpc_rb_channel_free) { - rb_raise(rb_eTypeError, "not a %s", rb_obj_classname(grpc_rb_cChannel)); - return Qnil; - } - - TypedData_Get_Struct(orig, grpc_rb_channel, &grpc_channel_data_type, orig_ch); - TypedData_Get_Struct(copy, grpc_rb_channel, &grpc_channel_data_type, copy_ch); - - /* use ruby's MEMCPY to make a byte-for-byte copy of the channel wrapper - * object. */ - MEMCPY(copy_ch, orig_ch, grpc_rb_channel, 1); - return copy; -} - /* Create a call given a grpc_channel, in order to call method. The request is not sent until grpc_call_invoke is called. */ static VALUE grpc_rb_channel_create_call(VALUE self, VALUE cqueue, @@ -387,7 +359,7 @@ void Init_grpc_channel() { /* Provides a ruby constructor and support for dup/clone. */ rb_define_method(grpc_rb_cChannel, "initialize", grpc_rb_channel_init, -1); rb_define_method(grpc_rb_cChannel, "initialize_copy", - grpc_rb_channel_init_copy, 1); + grpc_rb_cannot_init_copy, 1); /* Add ruby analogues of the Channel methods. */ rb_define_method(grpc_rb_cChannel, "connectivity_state", |