aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/ext/transport/chttp2
diff options
context:
space:
mode:
authorGravatar Mark D. Roth <roth@google.com>2017-06-09 09:08:23 -0700
committerGravatar Mark D. Roth <roth@google.com>2017-06-09 09:08:23 -0700
commit8d5e60b8787d1a6aefca037a08799f58a22aa78d (patch)
tree1793acde49dfa0407c5da12816304a691c622221 /src/core/ext/transport/chttp2
parent74923accac565cd7a4bd07b6ff054e8464f65fc1 (diff)
Add helpers for creating channel args.
Diffstat (limited to 'src/core/ext/transport/chttp2')
-rw-r--r--src/core/ext/transport/chttp2/client/insecure/channel_create.c8
-rw-r--r--src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c6
-rw-r--r--src/core/ext/transport/chttp2/client/secure/secure_channel_create.c8
3 files changed, 8 insertions, 14 deletions
diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create.c b/src/core/ext/transport/chttp2/client/insecure/channel_create.c
index 99bae76237..cccb347bf1 100644
--- a/src/core/ext/transport/chttp2/client/insecure/channel_create.c
+++ b/src/core/ext/transport/chttp2/client/insecure/channel_create.c
@@ -54,11 +54,9 @@ static grpc_channel *client_channel_factory_create_channel(
return NULL;
}
// Add channel arg containing the server URI.
- grpc_arg arg;
- arg.type = GRPC_ARG_STRING;
- arg.key = GRPC_ARG_SERVER_URI;
- arg.value.string =
- grpc_resolver_factory_add_default_prefix_if_needed(exec_ctx, target);
+ grpc_arg arg = grpc_channel_arg_string_create(
+ GRPC_ARG_SERVER_URI,
+ grpc_resolver_factory_add_default_prefix_if_needed(exec_ctx, target));
const char *to_remove[] = {GRPC_ARG_SERVER_URI};
grpc_channel_args *new_args =
grpc_channel_args_copy_and_add_and_remove(args, to_remove, 1, &arg, 1);
diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c b/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c
index 05145aeb2f..0346d50b6c 100644
--- a/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c
+++ b/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.c
@@ -41,10 +41,8 @@ grpc_channel *grpc_insecure_channel_create_from_fd(
GRPC_API_TRACE("grpc_insecure_channel_create(target=%p, fd=%d, args=%p)", 3,
(target, fd, args));
- grpc_arg default_authority_arg;
- default_authority_arg.type = GRPC_ARG_STRING;
- default_authority_arg.key = GRPC_ARG_DEFAULT_AUTHORITY;
- default_authority_arg.value.string = "test.authority";
+ grpc_arg default_authority_arg = grpc_channel_arg_string_create(
+ GRPC_ARG_DEFAULT_AUTHORITY, "test.authority");
grpc_channel_args *final_args =
grpc_channel_args_copy_and_add(args, &default_authority_arg, 1);
diff --git a/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c b/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c
index 7b76caba17..d4580f15f5 100644
--- a/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c
+++ b/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c
@@ -163,11 +163,9 @@ static grpc_channel *client_channel_factory_create_channel(
return NULL;
}
// Add channel arg containing the server URI.
- grpc_arg arg;
- arg.type = GRPC_ARG_STRING;
- arg.key = GRPC_ARG_SERVER_URI;
- arg.value.string =
- grpc_resolver_factory_add_default_prefix_if_needed(exec_ctx, target);
+ grpc_arg arg = grpc_channel_arg_string_create(
+ GRPC_ARG_SERVER_URI,
+ grpc_resolver_factory_add_default_prefix_if_needed(exec_ctx, target));
const char *to_remove[] = {GRPC_ARG_SERVER_URI};
grpc_channel_args *new_args =
grpc_channel_args_copy_and_add_and_remove(args, to_remove, 1, &arg, 1);