aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp/client/channel_cc.cc
diff options
context:
space:
mode:
authorGravatar Soheil Hassas Yeganeh <soheil@google.com>2018-09-25 21:59:15 -0400
committerGravatar Soheil Hassas Yeganeh <soheil@google.com>2018-09-25 21:59:15 -0400
commit369cfe118cbfda61c3fc205a18d1b1924d853700 (patch)
tree79f1c8dbe0c491d9c629218b07d77971dc527e11 /src/cpp/client/channel_cc.cc
parent8442cc213b2316272764b6a89e5ded5929e35a78 (diff)
Use SliceFromCopiedString() for host name.
This is to address Yang's review comment.
Diffstat (limited to 'src/cpp/client/channel_cc.cc')
-rw-r--r--src/cpp/client/channel_cc.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cpp/client/channel_cc.cc b/src/cpp/client/channel_cc.cc
index 5d1a9f4b96..510ae73478 100644
--- a/src/cpp/client/channel_cc.cc
+++ b/src/cpp/client/channel_cc.cc
@@ -111,17 +111,17 @@ internal::Call Channel::CreateCall(const internal::RpcMethod& method,
context->propagation_options_.c_bitmask(), cq->cq(),
method.channel_tag(), context->raw_deadline(), nullptr);
} else {
- const char* host_str = nullptr;
+ const string* host_str = nullptr;
if (!context->authority().empty()) {
- host_str = context->authority_.c_str();
+ host_str = &context->authority_;
} else if (!host_.empty()) {
- host_str = host_.c_str();
+ host_str = &host_;
}
grpc_slice method_slice =
SliceFromArray(method.name(), strlen(method.name()));
grpc_slice host_slice;
if (host_str != nullptr) {
- host_slice = SliceFromArray(host_str, strlen(host_str));
+ host_slice = SliceFromCopiedString(*host_str);
}
c_call = grpc_channel_create_call(
c_channel_, context->propagate_from_call_,