diff options
author | 2018-10-14 22:47:15 -0400 | |
---|---|---|
committer | 2018-10-14 22:47:15 -0400 | |
commit | a280d89937db5a2f14aa05642dccfd00131498cc (patch) | |
tree | a206c8e779b81e1f31e13502243ed82e8251c989 | |
parent | d6b140df030f4032a2e039b0af174374141300b0 (diff) |
Use grpc_mdelem_create() directly.
Remove grpc_mdelem_from_slices_no_unref() since it's a wrapper
around grpc_mdelem_create().
-rw-r--r-- | src/core/ext/filters/client_channel/client_channel.cc | 4 | ||||
-rw-r--r-- | src/core/ext/filters/http/client_authority_filter.cc | 4 | ||||
-rw-r--r-- | src/core/ext/transport/chttp2/transport/chttp2_transport.cc | 4 | ||||
-rw-r--r-- | src/core/lib/security/credentials/plugin/plugin_credentials.cc | 2 | ||||
-rw-r--r-- | src/core/lib/surface/channel.cc | 8 | ||||
-rw-r--r-- | src/core/lib/transport/metadata.cc | 5 | ||||
-rw-r--r-- | src/core/lib/transport/metadata.h | 3 |
7 files changed, 11 insertions, 19 deletions
diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index 3df5f6f2a0..d2c88742bf 100644 --- a/src/core/ext/filters/client_channel/client_channel.cc +++ b/src/core/ext/filters/client_channel/client_channel.cc @@ -2211,9 +2211,9 @@ static void add_retriable_send_initial_metadata_op( .grpc_previous_rpc_attempts); } if (GPR_UNLIKELY(calld->num_attempts_completed > 0)) { - grpc_mdelem retry_md = grpc_mdelem_from_slices_no_unref( + grpc_mdelem retry_md = grpc_mdelem_create( GRPC_MDSTR_GRPC_PREVIOUS_RPC_ATTEMPTS, - *retry_count_strings[calld->num_attempts_completed - 1]); + *retry_count_strings[calld->num_attempts_completed - 1], nullptr); grpc_error* error = grpc_metadata_batch_add_tail( &retry_state->send_initial_metadata, &retry_state->send_initial_metadata_storage[calld->send_initial_metadata diff --git a/src/core/ext/filters/http/client_authority_filter.cc b/src/core/ext/filters/http/client_authority_filter.cc index 40b3ea22fd..6383f12594 100644 --- a/src/core/ext/filters/http/client_authority_filter.cc +++ b/src/core/ext/filters/http/client_authority_filter.cc @@ -59,8 +59,8 @@ void authority_start_transport_stream_op_batch( initial_metadata->idx.named.authority == nullptr) { grpc_error* error = grpc_metadata_batch_add_head( initial_metadata, &calld->authority_storage, - grpc_mdelem_from_slices_no_unref(GRPC_MDSTR_AUTHORITY, - chand->default_authority)); + grpc_mdelem_create(GRPC_MDSTR_AUTHORITY, chand->default_authority, + nullptr)); if (error != GRPC_ERROR_NONE) { grpc_transport_stream_op_batch_finish_with_failure(batch, error, calld->call_combiner); diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index 77a0a69393..8a481bb7d5 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -2127,8 +2127,8 @@ void grpc_chttp2_fake_status(grpc_chttp2_transport* t, grpc_chttp2_stream* s, GRPC_LOG_IF_ERROR( "add_status_message", grpc_chttp2_incoming_metadata_buffer_replace_or_add( - &s->metadata_buffer[1], grpc_mdelem_from_slices_no_unref( - GRPC_MDSTR_GRPC_MESSAGE, slice))); + &s->metadata_buffer[1], + grpc_mdelem_create(GRPC_MDSTR_GRPC_MESSAGE, slice, nullptr))); } s->published_metadata[1] = GRPC_METADATA_SYNTHESIZED_FROM_FAKE; grpc_chttp2_maybe_complete_recv_trailing_metadata(t, s); diff --git a/src/core/lib/security/credentials/plugin/plugin_credentials.cc b/src/core/lib/security/credentials/plugin/plugin_credentials.cc index d97963d891..4015124298 100644 --- a/src/core/lib/security/credentials/plugin/plugin_credentials.cc +++ b/src/core/lib/security/credentials/plugin/plugin_credentials.cc @@ -102,7 +102,7 @@ static grpc_error* process_plugin_result( } else { for (size_t i = 0; i < num_md; ++i) { grpc_mdelem mdelem = - grpc_mdelem_from_slices_no_unref(md[i].key, md[i].value); + grpc_mdelem_create(md[i].key, md[i].value, nullptr); grpc_credentials_mdelem_array_add(r->md_array, mdelem); GRPC_MDELEM_UNREF(mdelem); } diff --git a/src/core/lib/surface/channel.cc b/src/core/lib/surface/channel.cc index ebc532c4fd..044241470b 100644 --- a/src/core/lib/surface/channel.cc +++ b/src/core/lib/surface/channel.cc @@ -336,9 +336,9 @@ grpc_call* grpc_channel_create_call(grpc_channel* channel, grpc_core::ExecCtx exec_ctx; grpc_call* call = grpc_channel_create_call_internal( channel, parent_call, propagation_mask, cq, nullptr, - grpc_mdelem_from_slices_no_unref(GRPC_MDSTR_PATH, method), + grpc_mdelem_create(GRPC_MDSTR_PATH, method, nullptr), host != nullptr - ? grpc_mdelem_from_slices_no_unref(GRPC_MDSTR_AUTHORITY, *host) + ? grpc_mdelem_create(GRPC_MDSTR_AUTHORITY, *host, nullptr) : GRPC_MDNULL, grpc_timespec_to_millis_round_up(deadline)); @@ -352,9 +352,9 @@ grpc_call* grpc_channel_create_pollset_set_call( GPR_ASSERT(!reserved); return grpc_channel_create_call_internal( channel, parent_call, propagation_mask, nullptr, pollset_set, - grpc_mdelem_from_slices_no_unref(GRPC_MDSTR_PATH, method), + grpc_mdelem_create(GRPC_MDSTR_PATH, method, nullptr), host != nullptr - ? grpc_mdelem_from_slices_no_unref(GRPC_MDSTR_AUTHORITY, *host) + ? grpc_mdelem_create(GRPC_MDSTR_AUTHORITY, *host, nullptr) : GRPC_MDNULL, deadline); } diff --git a/src/core/lib/transport/metadata.cc b/src/core/lib/transport/metadata.cc index 8f84e06fae..60af22393e 100644 --- a/src/core/lib/transport/metadata.cc +++ b/src/core/lib/transport/metadata.cc @@ -332,11 +332,6 @@ grpc_mdelem grpc_mdelem_from_slices(const grpc_slice& key, return out; } -grpc_mdelem grpc_mdelem_from_slices_no_unref(const grpc_slice& key, - const grpc_slice& value) { - return grpc_mdelem_create(key, value, nullptr); -} - grpc_mdelem grpc_mdelem_from_grpc_metadata(grpc_metadata* metadata) { bool changed = false; grpc_slice key_slice = diff --git a/src/core/lib/transport/metadata.h b/src/core/lib/transport/metadata.h index 22481d6824..989c7544c1 100644 --- a/src/core/lib/transport/metadata.h +++ b/src/core/lib/transport/metadata.h @@ -111,9 +111,6 @@ struct grpc_mdelem { /* Unrefs the slices. */ grpc_mdelem grpc_mdelem_from_slices(const grpc_slice& key, const grpc_slice& value); -/* Does not unref the slices. */ -grpc_mdelem grpc_mdelem_from_slices_no_unref(const grpc_slice& key, - const grpc_slice& value); /* Cheaply convert a grpc_metadata to a grpc_mdelem; may use the grpc_metadata object as backing storage (so lifetimes should align) */ |