Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
d98db4a6
Commit
d98db4a6
authored
9 years ago
by
Yuki Yugui Sonoda
Browse files
Options
Downloads
Patches
Plain Diff
Use TypedData for TmpChannelArgs
parent
c9b7d1cb
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/ruby/ext/grpc/rb_channel_args.c
+12
-4
12 additions, 4 deletions
src/ruby/ext/grpc/rb_channel_args.c
with
12 additions
and
4 deletions
src/ruby/ext/grpc/rb_channel_args.c
+
12
−
4
View file @
d98db4a6
...
@@ -38,6 +38,13 @@
...
@@ -38,6 +38,13 @@
#include
"rb_grpc.h"
#include
"rb_grpc.h"
static
rb_data_type_t
grpc_rb_channel_args_data_type
=
{
"grpc_channel_args"
,
{
GRPC_RB_GC_NOT_MARKED
,
GRPC_RB_GC_DONT_FREE
,
GRPC_RB_MEMSIZE_UNAVAILABLE
},
NULL
,
NULL
,
RUBY_TYPED_FREE_IMMEDIATELY
};
/* A callback the processes the hash key values in channel_args hash */
/* A callback the processes the hash key values in channel_args hash */
static
int
grpc_rb_channel_create_in_process_add_args_hash_cb
(
VALUE
key
,
static
int
grpc_rb_channel_create_in_process_add_args_hash_cb
(
VALUE
key
,
VALUE
val
,
VALUE
val
,
...
@@ -60,7 +67,8 @@ static int grpc_rb_channel_create_in_process_add_args_hash_cb(VALUE key,
...
@@ -60,7 +67,8 @@ static int grpc_rb_channel_create_in_process_add_args_hash_cb(VALUE key,
return
ST_STOP
;
return
ST_STOP
;
}
}
Data_Get_Struct
(
args_obj
,
grpc_channel_args
,
args
);
TypedData_Get_Struct
(
args_obj
,
grpc_channel_args
,
&
grpc_rb_channel_args_data_type
,
args
);
if
(
args
->
num_args
<=
0
)
{
if
(
args
->
num_args
<=
0
)
{
rb_raise
(
rb_eRuntimeError
,
"hash_cb bug: num_args is %lu for key:%s"
,
rb_raise
(
rb_eRuntimeError
,
"hash_cb bug: num_args is %lu for key:%s"
,
args
->
num_args
,
StringValueCStr
(
key
));
args
->
num_args
,
StringValueCStr
(
key
));
...
@@ -126,9 +134,9 @@ static VALUE grpc_rb_hash_convert_to_channel_args0(VALUE as_value) {
...
@@ -126,9 +134,9 @@ static VALUE grpc_rb_hash_convert_to_channel_args0(VALUE as_value) {
MEMZERO
(
params
->
dst
->
args
,
grpc_arg
,
num_args
);
MEMZERO
(
params
->
dst
->
args
,
grpc_arg
,
num_args
);
rb_hash_foreach
(
params
->
src_hash
,
rb_hash_foreach
(
params
->
src_hash
,
grpc_rb_channel_create_in_process_add_args_hash_cb
,
grpc_rb_channel_create_in_process_add_args_hash_cb
,
Data_Wrap_Struct
(
grpc_rb_cChannelArgs
,
Typed
Data_Wrap_Struct
(
grpc_rb_cChannelArgs
,
GRPC_RB_GC_NOT_MARKED
,
&
grpc_rb_channel_args_data_type
,
GRPC_RB_GC_DONT_FREE
,
params
->
dst
));
params
->
dst
));
/* reset num_args as grpc_rb_channel_create_in_process_add_args_hash_cb
/* reset num_args as grpc_rb_channel_create_in_process_add_args_hash_cb
* decrements it during has processing */
* decrements it during has processing */
params
->
dst
->
num_args
=
num_args
;
params
->
dst
->
num_args
=
num_args
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment