From 849bd73c4fe28ec880d111522fce05cda7126c93 Mon Sep 17 00:00:00 2001 From: Vijay Pai Date: Tue, 2 Jan 2018 23:30:47 +0000 Subject: Wrap duplicated-name definitions in anonymous namespace --- .../lb_policy/grpclb/client_load_reporting_filter.cc | 6 ++++-- src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc | 6 ++++-- .../ext/filters/client_channel/lb_policy/pick_first/pick_first.cc | 6 ++++-- .../filters/client_channel/lb_policy/round_robin/round_robin.cc | 8 +++++--- 4 files changed, 17 insertions(+), 9 deletions(-) (limited to 'src/core/ext/filters/client_channel/lb_policy') diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc index 3eedb08ecc..1708d81e61 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc @@ -32,7 +32,8 @@ static grpc_error* init_channel_elem(grpc_channel_element* elem, static void destroy_channel_elem(grpc_channel_element* elem) {} -typedef struct { +namespace { +struct call_data { // Stats object to update. grpc_grpclb_client_stats* client_stats; // State for intercepting send_initial_metadata. @@ -43,7 +44,8 @@ typedef struct { grpc_closure recv_initial_metadata_ready; grpc_closure* original_recv_initial_metadata_ready; bool recv_initial_metadata_succeeded; -} call_data; +}; +} // namespace static void on_complete_for_send(void* arg, grpc_error* error) { call_data* calld = (call_data*)arg; diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc index dd6fc602ab..5f373cdb25 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc @@ -226,6 +226,7 @@ static void wrapped_rr_closure(void* arg, grpc_error* error) { gpr_free(wc_arg->free_when_done); } +namespace { /* Linked list of pending pick requests. It stores all information needed to * eventually call (Round Robin's) pick() on them. They mainly stay pending * waiting for the RR policy to be created/updated. @@ -234,7 +235,7 @@ static void wrapped_rr_closure(void* arg, grpc_error* error) { * (in \a wrapped_on_complete and \a wrapped_on_complete_arg). This is needed in * order to correctly unref the RR policy instance upon completion of the pick. * See \a wrapped_rr_closure for details. */ -typedef struct pending_pick { +struct pending_pick { struct pending_pick* next; /* original pick()'s arguments */ @@ -246,7 +247,8 @@ typedef struct pending_pick { /* args for wrapped_on_complete */ wrapped_rr_closure_arg wrapped_on_complete_arg; -} pending_pick; +}; +} // namespace static void add_pending_pick(pending_pick** root, const grpc_lb_policy_pick_args* pick_args, diff --git a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc index 0861261359..9ff40aa53c 100644 --- a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc +++ b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc @@ -31,12 +31,14 @@ grpc_core::TraceFlag grpc_lb_pick_first_trace(false, "pick_first"); -typedef struct pending_pick { +namespace { +struct pending_pick { struct pending_pick* next; uint32_t initial_metadata_flags; grpc_connected_subchannel** target; grpc_closure* on_complete; -} pending_pick; +}; +} // namespace typedef struct { /** base policy: must be first */ diff --git a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc index b0c84017df..a964af0627 100644 --- a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc +++ b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc @@ -41,11 +41,12 @@ grpc_core::TraceFlag grpc_lb_round_robin_trace(false, "round_robin"); +namespace { /** List of entities waiting for a pick. * * Once a pick is available, \a target is updated and \a on_complete called. */ -typedef struct pending_pick { - struct pending_pick* next; +struct pending_pick { + pending_pick* next; /* output argument where to store the pick()ed user_data. It'll be NULL if no * such data is present or there's an error (the definite test for errors is @@ -62,7 +63,8 @@ typedef struct pending_pick { /* to be invoked once the pick() has completed (regardless of success) */ grpc_closure* on_complete; -} pending_pick; +}; +} // namespace typedef struct round_robin_lb_policy { /** base policy: must be first */ -- cgit v1.2.3