diff --git a/src/ruby/ext/grpc/rb_call.c b/src/ruby/ext/grpc/rb_call.c index 1b1958fd26337a016188520fcb712dcf277baf97..acb3c7e5ccf4cec9340f798e6596649a8489a5c3 100644 --- a/src/ruby/ext/grpc/rb_call.c +++ b/src/ruby/ext/grpc/rb_call.c @@ -42,6 +42,18 @@ #include "rb_completion_queue.h" #include "rb_grpc.h" +/* grpc_rb_cCall is the Call class whose instances proxy grpc_call. */ +static VALUE grpc_rb_cCall; + +/* grpc_rb_eCallError is the ruby class of the exception thrown during call + operations; */ +VALUE grpc_rb_eCallError = Qnil; + +/* grpc_rb_eOutOfTime is the ruby class of the exception thrown to indicate + a timeout. */ +static VALUE grpc_rb_eOutOfTime = Qnil; + + /* grpc_rb_sBatchResult is struct class used to hold the results of a batch * call. */ static VALUE grpc_rb_sBatchResult; @@ -582,17 +594,6 @@ static VALUE grpc_rb_call_run_batch(VALUE self, VALUE cqueue, VALUE tag, return result; } -/* grpc_rb_cCall is the ruby class that proxies grpc_call. */ -VALUE grpc_rb_cCall = Qnil; - -/* grpc_rb_eCallError is the ruby class of the exception thrown during call - operations; */ -VALUE grpc_rb_eCallError = Qnil; - -/* grpc_rb_eOutOfTime is the ruby class of the exception thrown to indicate - a timeout. */ -VALUE grpc_rb_eOutOfTime = Qnil; - void Init_grpc_error_codes() { /* Constants representing the error codes of grpc_call_error in grpc.h */ VALUE grpc_rb_mRpcErrors = diff --git a/src/ruby/ext/grpc/rb_call.h b/src/ruby/ext/grpc/rb_call.h index e20a34c74e27a70f2f8e8a058ec3576d24973861..003ce0429e05b98aefa98009721d795826ecfd48 100644 --- a/src/ruby/ext/grpc/rb_call.h +++ b/src/ruby/ext/grpc/rb_call.h @@ -49,17 +49,10 @@ const char* grpc_call_error_detail_of(grpc_call_error err); /* Converts a metadata array to a hash. */ VALUE grpc_rb_md_ary_to_h(grpc_metadata_array *md_ary); -/* grpc_rb_cCall is the Call class whose instances proxy grpc_call. */ -extern VALUE grpc_rb_cCall; - /* grpc_rb_eCallError is the ruby class of the exception thrown during call operations. */ extern VALUE grpc_rb_eCallError; -/* grpc_rb_eOutOfTime is the ruby class of the exception thrown to indicate - a timeout. */ -extern VALUE grpc_rb_eOutOfTime; - /* Initializes the Call class. */ void Init_grpc_call(); diff --git a/src/ruby/ext/grpc/rb_channel.c b/src/ruby/ext/grpc/rb_channel.c index 3480280a03cab1e3fd08c6980763b1b3f02824c4..9bd7c2edf99672a1b883d912979d6bb8993855b0 100644 --- a/src/ruby/ext/grpc/rb_channel.c +++ b/src/ruby/ext/grpc/rb_channel.c @@ -58,6 +58,8 @@ static ID id_target; * GCed before the channel */ static ID id_cqueue; +/* grpc_rb_cChannel is the ruby class that proxies grpc_channel. */ +static VALUE grpc_rb_cChannel = Qnil; /* Used during the conversion of a hash to channel args during channel setup */ static VALUE grpc_rb_cChannelArgs; @@ -240,9 +242,6 @@ static VALUE grpc_rb_channel_destroy(VALUE self) { return Qnil; } -/* grpc_rb_cChannel is the ruby class that proxies grpc_channel. */ -VALUE grpc_rb_cChannel = Qnil; - void Init_grpc_channel() { grpc_rb_cChannelArgs = rb_define_class("TmpChannelArgs", rb_cObject); grpc_rb_cChannel = diff --git a/src/ruby/ext/grpc/rb_channel.h b/src/ruby/ext/grpc/rb_channel.h index 5c57b31fb2831ad740c42cbc90834a15abd49582..6e3c087689e70ce1c2583f94c3d44492ce8fd35a 100644 --- a/src/ruby/ext/grpc/rb_channel.h +++ b/src/ruby/ext/grpc/rb_channel.h @@ -37,9 +37,6 @@ #include <ruby.h> #include <grpc/grpc.h> -/* grpc_rb_cChannel is the Channel class whose instances proxy grpc_channel. */ -extern VALUE grpc_rb_cChannel; - /* Initializes the Channel class. */ void Init_grpc_channel(); diff --git a/src/ruby/ext/grpc/rb_completion_queue.c b/src/ruby/ext/grpc/rb_completion_queue.c index 20ce1b909c16ccc388c42e752f8a24b1e127d25b..a72f01ffb86f436efa384c15f934c4cd958fa733 100644 --- a/src/ruby/ext/grpc/rb_completion_queue.c +++ b/src/ruby/ext/grpc/rb_completion_queue.c @@ -39,6 +39,10 @@ #include <grpc/support/time.h> #include "rb_grpc.h" +/* grpc_rb_cCompletionQueue is the ruby class that proxies + * grpc_completion_queue. */ +static VALUE grpc_rb_cCompletionQueue = Qnil; + /* Used to allow grpc_completion_queue_next call to release the GIL */ typedef struct next_call_stack { grpc_completion_queue *cq; @@ -166,10 +170,6 @@ grpc_event* grpc_rb_completion_queue_pluck_event(VALUE self, VALUE tag, return next_call.event; } -/* grpc_rb_cCompletionQueue is the ruby class that proxies - * grpc_completion_queue. */ -VALUE grpc_rb_cCompletionQueue = Qnil; - void Init_grpc_completion_queue() { grpc_rb_cCompletionQueue = rb_define_class_under(grpc_rb_mGrpcCore, "CompletionQueue", rb_cObject); diff --git a/src/ruby/ext/grpc/rb_completion_queue.h b/src/ruby/ext/grpc/rb_completion_queue.h index 1bfb80e49950bbc8d14aedc06b445307e7f6dc2d..4d0f49ac478290ee151d597ee639bb1b342b3ffc 100644 --- a/src/ruby/ext/grpc/rb_completion_queue.h +++ b/src/ruby/ext/grpc/rb_completion_queue.h @@ -48,10 +48,6 @@ grpc_completion_queue *grpc_rb_get_wrapped_completion_queue(VALUE v); grpc_event* grpc_rb_completion_queue_pluck_event(VALUE cqueue, VALUE tag, VALUE timeout); -/* grpc_rb_cCompletionQueue is the CompletionQueue class whose instances proxy - grpc_completion_queue. */ -extern VALUE grpc_rb_cCompletionQueue; - /* Initializes the CompletionQueue class. */ void Init_grpc_completion_queue(); diff --git a/src/ruby/ext/grpc/rb_credentials.c b/src/ruby/ext/grpc/rb_credentials.c index 1504a4884ea3a47dc3b0c424ed62bce8e35fdc1e..122cffc92f1c6be40d8914f43be025117dc49032 100644 --- a/src/ruby/ext/grpc/rb_credentials.c +++ b/src/ruby/ext/grpc/rb_credentials.c @@ -40,6 +40,9 @@ #include "rb_grpc.h" +/* grpc_rb_cCredentials is the ruby class that proxies grpc_credentials. */ +static VALUE grpc_rb_cCredentials = Qnil; + /* grpc_rb_credentials wraps a grpc_credentials. It provides a * peer ruby object, 'mark' to minimize copying when a credential is * created from ruby. */ @@ -242,9 +245,6 @@ static VALUE grpc_rb_credentials_init(int argc, VALUE *argv, VALUE self) { return self; } -/* grpc_rb_cCredentials is the ruby class that proxies grpc_credentials. */ -VALUE grpc_rb_cCredentials = Qnil; - void Init_grpc_credentials() { grpc_rb_cCredentials = rb_define_class_under(grpc_rb_mGrpcCore, "Credentials", rb_cObject); diff --git a/src/ruby/ext/grpc/rb_credentials.h b/src/ruby/ext/grpc/rb_credentials.h index dc0a3d01e81b99194534f412dade71747c552369..e7c43c9c781909e198ece24e4e2411af2daa8a48 100644 --- a/src/ruby/ext/grpc/rb_credentials.h +++ b/src/ruby/ext/grpc/rb_credentials.h @@ -37,10 +37,6 @@ #include <ruby.h> #include <grpc/grpc_security.h> -/* grpc_rb_cCredentials is the ruby class whose instances proxy - grpc_credentials. */ -extern VALUE grpc_rb_cCredentials; - /* Initializes the ruby Credentials class. */ void Init_grpc_credentials(); diff --git a/src/ruby/ext/grpc/rb_grpc.c b/src/ruby/ext/grpc/rb_grpc.c index 4f30a6216a3514727dedefb694d3da8ded98df8a..51d1872e8a8f79f3c62609c327a993dea36517fc 100644 --- a/src/ruby/ext/grpc/rb_grpc.c +++ b/src/ruby/ext/grpc/rb_grpc.c @@ -50,7 +50,7 @@ const RUBY_DATA_FUNC GC_NOT_MARKED = NULL; const RUBY_DATA_FUNC GC_DONT_FREE = NULL; -VALUE grpc_rb_cTimeVal = Qnil; +static VALUE grpc_rb_cTimeVal = Qnil; /* Alloc func that blocks allocation of a given object by raising an * exception. */ diff --git a/src/ruby/ext/grpc/rb_grpc.h b/src/ruby/ext/grpc/rb_grpc.h index 3a93029556f53997f305794abfad72048f1c165f..fac4c6d67188d0d2f7ca4027cc48853e36b78dd6 100644 --- a/src/ruby/ext/grpc/rb_grpc.h +++ b/src/ruby/ext/grpc/rb_grpc.h @@ -41,9 +41,6 @@ /* grpc_rb_mGrpcCore is the module containing the ruby wrapper GRPC classes. */ extern VALUE grpc_rb_mGrpcCore; -/* Class used to wrap timeval structs. */ -extern VALUE grpc_rb_cTimeVal; - /* grpc_rb_sNewServerRpc is the struct that holds new server rpc details. */ extern VALUE grpc_rb_sNewServerRpc; diff --git a/src/ruby/ext/grpc/rb_server.c b/src/ruby/ext/grpc/rb_server.c index 33d9d695008de2adbff78b2a324a03fc6a3418ac..80f7760ebb652cc91b614dc5efd6f59bb8ca148b 100644 --- a/src/ruby/ext/grpc/rb_server.c +++ b/src/ruby/ext/grpc/rb_server.c @@ -44,7 +44,7 @@ #include "rb_grpc.h" /* grpc_rb_cServer is the ruby class that proxies grpc_server. */ -VALUE grpc_rb_cServer = Qnil; +static VALUE grpc_rb_cServer = Qnil; /* id_at is the constructor method of the ruby standard Time class. */ static ID id_at; diff --git a/src/ruby/ext/grpc/rb_server.h b/src/ruby/ext/grpc/rb_server.h index 22e88a7d46e9eb52f172bee882802b9e1b93d48c..5e4b711d35b8816eb11cd87d3d280c7baa79e4cd 100644 --- a/src/ruby/ext/grpc/rb_server.h +++ b/src/ruby/ext/grpc/rb_server.h @@ -37,10 +37,6 @@ #include <ruby.h> #include <grpc/grpc.h> -/* grpc_rb_cServer is the Server class whose instances proxy - grpc_byte_buffer. */ -extern VALUE grpc_rb_cServer; - /* Initializes the Server class. */ void Init_grpc_server(); diff --git a/src/ruby/ext/grpc/rb_server_credentials.c b/src/ruby/ext/grpc/rb_server_credentials.c index 8b813eaca1cfd954aef740562d3f62055a7d3342..5109b96b5f6fe3b8bfc73d59bb91f57bdc1a88a6 100644 --- a/src/ruby/ext/grpc/rb_server_credentials.c +++ b/src/ruby/ext/grpc/rb_server_credentials.c @@ -40,6 +40,10 @@ #include "rb_grpc.h" +/* grpc_rb_cServerCredentials is the ruby class that proxies + grpc_server_credentials. */ +static VALUE grpc_rb_cServerCredentials = Qnil; + /* grpc_rb_server_credentials wraps a grpc_server_credentials. It provides a peer ruby object, 'mark' to minimize copying when a server credential is created from ruby. */ @@ -180,10 +184,6 @@ static VALUE grpc_rb_server_credentials_init(VALUE self, VALUE pem_root_certs, return self; } -/* grpc_rb_cServerCredentials is the ruby class that proxies - grpc_server_credentials. */ -VALUE grpc_rb_cServerCredentials = Qnil; - void Init_grpc_server_credentials() { grpc_rb_cServerCredentials = rb_define_class_under(grpc_rb_mGrpcCore, "ServerCredentials", rb_cObject); diff --git a/src/ruby/ext/grpc/rb_server_credentials.h b/src/ruby/ext/grpc/rb_server_credentials.h index f79a8693581ebebfec22cc842e55cbe709af133e..35b395ad5ccd757081eb4a23cf816f65e2b5ae5d 100644 --- a/src/ruby/ext/grpc/rb_server_credentials.h +++ b/src/ruby/ext/grpc/rb_server_credentials.h @@ -37,10 +37,6 @@ #include <ruby.h> #include <grpc/grpc_security.h> -/* grpc_rb_cServerCredentials is the ruby class whose instances proxy - grpc_server_credentials. */ -extern VALUE grpc_rb_cServerCredentials; - /* Initializes the ruby ServerCredentials class. */ void Init_grpc_server_credentials();