aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Noah Eisen <ncteisen@google.com>2018-02-09 09:34:04 -0800
committerGravatar Noah Eisen <ncteisen@google.com>2018-02-09 09:34:04 -0800
commit4d20a666850b732cf1562487fb5f46ab9654105f (patch)
tree9059162d0f125e02780f506c2476d5d9bbc0eb7d /src/core
parentcddf6f838aa48c8d5c9f75cee5a8ed8abdcb25b9 (diff)
Run clang fmt
Diffstat (limited to 'src/core')
-rw-r--r--src/core/ext/census/grpc_context.cc3
-rw-r--r--src/core/ext/filters/client_channel/backup_poller.cc3
-rw-r--r--src/core/ext/filters/client_channel/channel_connectivity.cc4
-rw-r--r--src/core/ext/filters/client_channel/client_channel.cc28
-rw-r--r--src/core/ext/filters/client_channel/client_channel_factory.cc6
-rw-r--r--src/core/ext/filters/client_channel/http_connect_handshaker.cc19
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc6
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc34
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc12
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc39
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc6
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc18
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc18
-rw-r--r--src/core/ext/filters/client_channel/lb_policy_factory.cc3
-rw-r--r--src/core/ext/filters/client_channel/parse_address.cc3
-rw-r--r--src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc3
-rw-r--r--src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc3
-rw-r--r--src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc37
-rw-r--r--src/core/ext/filters/client_channel/retry_throttle.cc24
-rw-r--r--src/core/ext/filters/client_channel/subchannel.cc19
-rw-r--r--src/core/ext/filters/client_channel/subchannel_index.cc18
-rw-r--r--src/core/ext/filters/deadline/deadline_filter.cc27
-rw-r--r--src/core/ext/filters/http/client/http_client_filter.cc14
-rw-r--r--src/core/ext/filters/http/http_filters_plugin.cc3
-rw-r--r--src/core/ext/filters/http/message_compress/message_compress_filter.cc7
-rw-r--r--src/core/ext/filters/http/server/http_server_filter.cc16
-rw-r--r--src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc3
-rw-r--r--src/core/ext/filters/max_age/max_age_filter.cc4
-rw-r--r--src/core/ext/filters/message_size/message_size_filter.cc12
-rw-r--r--src/core/ext/filters/workarounds/workaround_utils.cc8
-rw-r--r--src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc7
-rw-r--r--src/core/ext/transport/chttp2/server/chttp2_server.cc12
-rw-r--r--src/core/ext/transport/chttp2/transport/bin_decoder.cc11
-rw-r--r--src/core/ext/transport/chttp2/transport/bin_encoder.cc15
-rw-r--r--src/core/ext/transport/chttp2/transport/chttp2_transport.cc89
-rw-r--r--src/core/ext/transport/chttp2/transport/flow_control.cc19
-rw-r--r--src/core/ext/transport/chttp2/transport/flow_control.h7
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_data.cc41
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_goaway.cc8
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_rst_stream.cc3
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_settings.cc7
-rw-r--r--src/core/ext/transport/chttp2/transport/hpack_encoder.cc22
-rw-r--r--src/core/ext/transport/chttp2/transport/hpack_parser.cc19
-rw-r--r--src/core/ext/transport/chttp2/transport/hpack_table.cc13
-rw-r--r--src/core/ext/transport/chttp2/transport/incoming_metadata.cc4
-rw-r--r--src/core/ext/transport/chttp2/transport/parsing.cc30
-rw-r--r--src/core/ext/transport/chttp2/transport/stream_map.cc10
-rw-r--r--src/core/ext/transport/chttp2/transport/writing.cc24
-rw-r--r--src/core/ext/transport/cronet/transport/cronet_transport.cc30
-rw-r--r--src/core/ext/transport/inproc/inproc_transport.cc18
-rw-r--r--src/core/lib/backoff/backoff.cc9
-rw-r--r--src/core/lib/channel/channel_args.cc9
-rw-r--r--src/core/lib/channel/channel_stack.cc15
-rw-r--r--src/core/lib/channel/channel_stack_builder.cc13
-rw-r--r--src/core/lib/channel/connected_channel.cc3
-rw-r--r--src/core/lib/channel/handshaker.cc8
-rw-r--r--src/core/lib/channel/handshaker_registry.cc3
-rw-r--r--src/core/lib/compression/compression_internal.cc3
-rw-r--r--src/core/lib/compression/message_compress.cc6
-rw-r--r--src/core/lib/compression/stream_compression_gzip.cc6
-rw-r--r--src/core/lib/debug/stats.cc10
-rw-r--r--src/core/lib/gpr/arena.cc20
-rw-r--r--src/core/lib/gpr/log.cc3
-rw-r--r--src/core/lib/gpr/string.cc6
-rw-r--r--src/core/lib/gpr/thd_posix.cc8
-rw-r--r--src/core/lib/gpr/time.cc8
-rw-r--r--src/core/lib/http/format_request.cc3
-rw-r--r--src/core/lib/http/httpcli_security_connector.cc4
-rw-r--r--src/core/lib/http/parser.cc13
-rw-r--r--src/core/lib/iomgr/call_combiner.cc15
-rw-r--r--src/core/lib/iomgr/combiner.cc3
-rw-r--r--src/core/lib/iomgr/error.cc38
-rw-r--r--src/core/lib/iomgr/ev_epoll1_linux.cc4
-rw-r--r--src/core/lib/iomgr/ev_epollex_linux.cc24
-rw-r--r--src/core/lib/iomgr/ev_epollsig_linux.cc10
-rw-r--r--src/core/lib/iomgr/ev_poll_posix.cc47
-rw-r--r--src/core/lib/iomgr/exec_ctx.cc7
-rw-r--r--src/core/lib/iomgr/executor.cc13
-rw-r--r--src/core/lib/iomgr/is_epollexclusive_available.cc3
-rw-r--r--src/core/lib/iomgr/load_file.cc4
-rw-r--r--src/core/lib/iomgr/resolve_address_posix.cc8
-rw-r--r--src/core/lib/iomgr/resource_quota.cc10
-rw-r--r--src/core/lib/iomgr/sockaddr_utils.cc48
-rw-r--r--src/core/lib/iomgr/socket_utils_common_posix.cc6
-rw-r--r--src/core/lib/iomgr/socket_utils_linux.cc3
-rw-r--r--src/core/lib/iomgr/tcp_client_posix.cc7
-rw-r--r--src/core/lib/iomgr/tcp_posix.cc29
-rw-r--r--src/core/lib/iomgr/tcp_server_posix.cc9
-rw-r--r--src/core/lib/iomgr/tcp_server_utils_posix_common.cc4
-rw-r--r--src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc7
-rw-r--r--src/core/lib/iomgr/timer_generic.cc11
-rw-r--r--src/core/lib/iomgr/timer_heap.cc8
-rw-r--r--src/core/lib/iomgr/timer_manager.cc3
-rw-r--r--src/core/lib/iomgr/udp_server.cc24
-rw-r--r--src/core/lib/iomgr/unix_sockets_posix.cc20
-rw-r--r--src/core/lib/iomgr/wakeup_fd_cv.cc4
-rw-r--r--src/core/lib/json/json_reader.cc6
-rw-r--r--src/core/lib/json/json_string.cc3
-rw-r--r--src/core/lib/json/json_writer.cc6
-rw-r--r--src/core/lib/security/context/security_context.cc24
-rw-r--r--src/core/lib/security/credentials/composite/composite_credentials.cc17
-rw-r--r--src/core/lib/security/credentials/credentials.cc7
-rw-r--r--src/core/lib/security/credentials/credentials_metadata.cc4
-rw-r--r--src/core/lib/security/credentials/fake/fake_credentials.cc19
-rw-r--r--src/core/lib/security/credentials/google_default/google_default_credentials.cc9
-rw-r--r--src/core/lib/security/credentials/iam/iam_credentials.cc6
-rw-r--r--src/core/lib/security/credentials/jwt/json_token.cc3
-rw-r--r--src/core/lib/security/credentials/jwt/jwt_credentials.cc4
-rw-r--r--src/core/lib/security/credentials/jwt/jwt_verifier.cc22
-rw-r--r--src/core/lib/security/credentials/oauth2/oauth2_credentials.cc29
-rw-r--r--src/core/lib/security/credentials/plugin/plugin_credentials.cc16
-rw-r--r--src/core/lib/security/credentials/ssl/ssl_credentials.cc39
-rw-r--r--src/core/lib/security/transport/client_auth_filter.cc20
-rw-r--r--src/core/lib/security/transport/lb_targets_info.cc8
-rw-r--r--src/core/lib/security/transport/secure_endpoint.cc10
-rw-r--r--src/core/lib/security/transport/security_connector.cc37
-rw-r--r--src/core/lib/security/transport/security_handshaker.cc19
-rw-r--r--src/core/lib/slice/b64.cc9
-rw-r--r--src/core/lib/slice/slice.cc20
-rw-r--r--src/core/lib/slice/slice_buffer.cc18
-rw-r--r--src/core/lib/slice/slice_hash_table.cc3
-rw-r--r--src/core/lib/slice/slice_intern.cc21
-rw-r--r--src/core/lib/slice/slice_string_helpers.cc9
-rw-r--r--src/core/lib/surface/call.cc34
-rw-r--r--src/core/lib/surface/channel.cc12
-rw-r--r--src/core/lib/surface/channel_init.cc9
-rw-r--r--src/core/lib/surface/completion_queue.cc67
-rw-r--r--src/core/lib/surface/server.cc54
-rw-r--r--src/core/lib/transport/bdp_estimator.cc7
-rw-r--r--src/core/lib/transport/byte_stream.cc24
-rw-r--r--src/core/lib/transport/connectivity_state.cc8
-rw-r--r--src/core/lib/transport/error_utils.cc13
-rw-r--r--src/core/lib/transport/metadata.cc31
-rw-r--r--src/core/lib/transport/service_config.cc4
-rw-r--r--src/core/lib/transport/timeout_encoding.cc3
-rw-r--r--src/core/lib/transport/transport.cc3
-rw-r--r--src/core/tsi/fake_transport_security.cc51
-rw-r--r--src/core/tsi/ssl_transport_security.cc82
-rw-r--r--src/core/tsi/transport_security.cc4
-rw-r--r--src/core/tsi/transport_security_adapter.cc22
140 files changed, 1246 insertions, 878 deletions
diff --git a/src/core/ext/census/grpc_context.cc b/src/core/ext/census/grpc_context.cc
index 5cd3b18614..069e8f1486 100644
--- a/src/core/ext/census/grpc_context.cc
+++ b/src/core/ext/census/grpc_context.cc
@@ -31,5 +31,6 @@ void grpc_census_call_set_context(grpc_call* call, census_context* context) {
census_context* grpc_census_call_get_context(grpc_call* call) {
GRPC_API_TRACE("grpc_census_call_get_context(call=%p)", 1, (call));
- return static_cast<census_context*>(grpc_call_context_get(call, GRPC_CONTEXT_TRACING));
+ return static_cast<census_context*>(
+ grpc_call_context_get(call, GRPC_CONTEXT_TRACING));
}
diff --git a/src/core/ext/filters/client_channel/backup_poller.cc b/src/core/ext/filters/client_channel/backup_poller.cc
index 35f1b97b77..ee90b499eb 100644
--- a/src/core/ext/filters/client_channel/backup_poller.cc
+++ b/src/core/ext/filters/client_channel/backup_poller.cc
@@ -134,7 +134,8 @@ void grpc_client_channel_start_backup_polling(
gpr_mu_lock(&g_poller_mu);
if (g_poller == nullptr) {
g_poller = static_cast<backup_poller*>(gpr_zalloc(sizeof(backup_poller)));
- g_poller->pollset = static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
+ g_poller->pollset =
+ static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
g_poller->shutting_down = false;
grpc_pollset_init(g_poller->pollset, &g_poller->pollset_mu);
gpr_ref_init(&g_poller->refs, 0);
diff --git a/src/core/ext/filters/client_channel/channel_connectivity.cc b/src/core/ext/filters/client_channel/channel_connectivity.cc
index 74c6cfe93c..31a5c31124 100644
--- a/src/core/ext/filters/client_channel/channel_connectivity.cc
+++ b/src/core/ext/filters/client_channel/channel_connectivity.cc
@@ -227,8 +227,8 @@ void grpc_channel_watch_connectivity_state(
w->channel = channel;
w->error = nullptr;
- watcher_timer_init_arg* wa =
- static_cast<watcher_timer_init_arg*>(gpr_malloc(sizeof(watcher_timer_init_arg)));
+ watcher_timer_init_arg* wa = static_cast<watcher_timer_init_arg*>(
+ gpr_malloc(sizeof(watcher_timer_init_arg)));
wa->w = w;
wa->deadline = deadline;
GRPC_CLOSURE_INIT(&w->watcher_timer_init, watcher_timer_init, wa,
diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc
index ee2f21a064..50d562f946 100644
--- a/src/core/ext/filters/client_channel/client_channel.cc
+++ b/src/core/ext/filters/client_channel/client_channel.cc
@@ -260,7 +260,8 @@ static void set_channel_connectivity_state_locked(channel_data* chand,
}
static void on_lb_policy_state_changed_locked(void* arg, grpc_error* error) {
- lb_policy_connectivity_watcher* w = static_cast<lb_policy_connectivity_watcher*>(arg);
+ lb_policy_connectivity_watcher* w =
+ static_cast<lb_policy_connectivity_watcher*>(arg);
/* check if the notification is for the latest policy */
if (w->lb_policy == w->chand->lb_policy) {
if (grpc_client_channel_trace.enabled()) {
@@ -353,7 +354,8 @@ static void parse_retry_throttle_params(const grpc_json* field, void* arg) {
&whole_value)) {
return;
}
- milli_token_ratio = static_cast<int>((whole_value * multiplier) + decimal_value);
+ milli_token_ratio =
+ static_cast<int>((whole_value * multiplier) + decimal_value);
if (milli_token_ratio <= 0) return;
}
}
@@ -364,7 +366,8 @@ static void parse_retry_throttle_params(const grpc_json* field, void* arg) {
}
static void request_reresolution_locked(void* arg, grpc_error* error) {
- reresolution_request_args* args = static_cast<reresolution_request_args*>(arg);
+ reresolution_request_args* args =
+ static_cast<reresolution_request_args*>(arg);
channel_data* chand = args->chand;
// If this invocation is for a stale LB policy, treat it as an LB shutdown
// signal.
@@ -458,7 +461,8 @@ static void on_resolver_result_changed_locked(void* arg, grpc_error* error) {
lb_policy_name);
} else {
reresolution_request_args* args =
- static_cast<reresolution_request_args*>(gpr_zalloc(sizeof(*args)));
+ static_cast<reresolution_request_args*>(
+ gpr_zalloc(sizeof(*args)));
args->chand = chand;
args->lb_policy = new_lb_policy;
GRPC_CLOSURE_INIT(&args->closure, request_reresolution_locked, args,
@@ -973,8 +977,8 @@ static void apply_service_config_to_call_locked(grpc_call_element* elem) {
grpc_server_retry_throttle_data_ref(chand->retry_throttle_data);
}
if (chand->method_params_table != nullptr) {
- calld->method_params = static_cast<method_parameters*>(grpc_method_config_table_get(
- chand->method_params_table, calld->path));
+ calld->method_params = static_cast<method_parameters*>(
+ grpc_method_config_table_get(chand->method_params_table, calld->path));
if (calld->method_params != nullptr) {
method_parameters_ref(calld->method_params);
// If the deadline from the service config is shorter than the one
@@ -1161,7 +1165,8 @@ typedef struct {
// holding the call combiner.
static void pick_after_resolver_result_cancel_locked(void* arg,
grpc_error* error) {
- pick_after_resolver_result_args* args = static_cast<pick_after_resolver_result_args*>(arg);
+ pick_after_resolver_result_args* args =
+ static_cast<pick_after_resolver_result_args*>(arg);
if (args->finished) {
gpr_free(args);
return;
@@ -1195,7 +1200,8 @@ static void pick_after_resolver_result_start_locked(grpc_call_element* elem);
static void pick_after_resolver_result_done_locked(void* arg,
grpc_error* error) {
- pick_after_resolver_result_args* args = static_cast<pick_after_resolver_result_args*>(arg);
+ pick_after_resolver_result_args* args =
+ static_cast<pick_after_resolver_result_args*>(arg);
if (args->finished) {
/* cancelled, do nothing */
if (grpc_client_channel_trace.enabled()) {
@@ -1595,7 +1601,8 @@ int grpc_client_channel_num_external_connectivity_watchers(
}
static void on_external_watch_complete_locked(void* arg, grpc_error* error) {
- external_connectivity_watcher* w = static_cast<external_connectivity_watcher*>(arg);
+ external_connectivity_watcher* w =
+ static_cast<external_connectivity_watcher*>(arg);
grpc_closure* follow_up = w->on_complete;
grpc_polling_entity_del_from_pollset_set(&w->pollent,
w->chand->interested_parties);
@@ -1608,7 +1615,8 @@ static void on_external_watch_complete_locked(void* arg, grpc_error* error) {
static void watch_connectivity_state_locked(void* arg,
grpc_error* error_ignored) {
- external_connectivity_watcher* w = static_cast<external_connectivity_watcher*>(arg);
+ external_connectivity_watcher* w =
+ static_cast<external_connectivity_watcher*>(arg);
external_connectivity_watcher* found = nullptr;
if (w->state != nullptr) {
external_connectivity_watcher_list_append(w->chand, w);
diff --git a/src/core/ext/filters/client_channel/client_channel_factory.cc b/src/core/ext/filters/client_channel/client_channel_factory.cc
index a21db1ff69..3baf5b31ab 100644
--- a/src/core/ext/filters/client_channel/client_channel_factory.cc
+++ b/src/core/ext/filters/client_channel/client_channel_factory.cc
@@ -39,12 +39,14 @@ grpc_channel* grpc_client_channel_factory_create_channel(
}
static void* factory_arg_copy(void* factory) {
- grpc_client_channel_factory_ref(static_cast<grpc_client_channel_factory*>(factory));
+ grpc_client_channel_factory_ref(
+ static_cast<grpc_client_channel_factory*>(factory));
return factory;
}
static void factory_arg_destroy(void* factory) {
- grpc_client_channel_factory_unref(static_cast<grpc_client_channel_factory*>(factory));
+ grpc_client_channel_factory_unref(
+ static_cast<grpc_client_channel_factory*>(factory));
}
static int factory_arg_cmp(void* factory1, void* factory2) {
diff --git a/src/core/ext/filters/client_channel/http_connect_handshaker.cc b/src/core/ext/filters/client_channel/http_connect_handshaker.cc
index b4684a81dc..6bb4cefe73 100644
--- a/src/core/ext/filters/client_channel/http_connect_handshaker.cc
+++ b/src/core/ext/filters/client_channel/http_connect_handshaker.cc
@@ -119,7 +119,8 @@ static void handshake_failed_locked(http_connect_handshaker* handshaker,
// Callback invoked when finished writing HTTP CONNECT request.
static void on_write_done(void* arg, grpc_error* error) {
- http_connect_handshaker* handshaker = static_cast<http_connect_handshaker*>(arg);
+ http_connect_handshaker* handshaker =
+ static_cast<http_connect_handshaker*>(arg);
gpr_mu_lock(&handshaker->mu);
if (error != GRPC_ERROR_NONE || handshaker->shutdown) {
// If the write failed or we're shutting down, clean up and invoke the
@@ -139,7 +140,8 @@ static void on_write_done(void* arg, grpc_error* error) {
// Callback invoked for reading HTTP CONNECT response.
static void on_read_done(void* arg, grpc_error* error) {
- http_connect_handshaker* handshaker = static_cast<http_connect_handshaker*>(arg);
+ http_connect_handshaker* handshaker =
+ static_cast<http_connect_handshaker*>(arg);
gpr_mu_lock(&handshaker->mu);
if (error != GRPC_ERROR_NONE || handshaker->shutdown) {
// If the read failed or we're shutting down, clean up and invoke the
@@ -224,13 +226,15 @@ done:
//
static void http_connect_handshaker_destroy(grpc_handshaker* handshaker_in) {
- http_connect_handshaker* handshaker = reinterpret_cast<http_connect_handshaker*>(handshaker_in);
+ http_connect_handshaker* handshaker =
+ reinterpret_cast<http_connect_handshaker*>(handshaker_in);
http_connect_handshaker_unref(handshaker);
}
static void http_connect_handshaker_shutdown(grpc_handshaker* handshaker_in,
grpc_error* why) {
- http_connect_handshaker* handshaker = reinterpret_cast<http_connect_handshaker*>(handshaker_in);
+ http_connect_handshaker* handshaker =
+ reinterpret_cast<http_connect_handshaker*>(handshaker_in);
gpr_mu_lock(&handshaker->mu);
if (!handshaker->shutdown) {
handshaker->shutdown = true;
@@ -244,7 +248,8 @@ static void http_connect_handshaker_shutdown(grpc_handshaker* handshaker_in,
static void http_connect_handshaker_do_handshake(
grpc_handshaker* handshaker_in, grpc_tcp_server_acceptor* acceptor,
grpc_closure* on_handshake_done, grpc_handshaker_args* args) {
- http_connect_handshaker* handshaker = reinterpret_cast<http_connect_handshaker*>(handshaker_in);
+ http_connect_handshaker* handshaker =
+ reinterpret_cast<http_connect_handshaker*>(handshaker_in);
// Check for HTTP CONNECT channel arg.
// If not found, invoke on_handshake_done without doing anything.
const grpc_arg* arg =
@@ -270,8 +275,8 @@ static void http_connect_handshaker_do_handshake(
GPR_ASSERT(arg->type == GRPC_ARG_STRING);
gpr_string_split(arg->value.string, "\n", &header_strings,
&num_header_strings);
- headers = static_cast<grpc_http_header*>(gpr_malloc(sizeof(grpc_http_header) *
- num_header_strings));
+ headers = static_cast<grpc_http_header*>(
+ gpr_malloc(sizeof(grpc_http_header) * num_header_strings));
for (size_t i = 0; i < num_header_strings; ++i) {
char* sep = strchr(header_strings[i], ':');
if (sep == nullptr) {
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 b048989d4e..1a3a1f029c 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
@@ -70,9 +70,9 @@ static grpc_error* init_call_elem(grpc_call_element* elem,
// Get stats object from context and take a ref.
GPR_ASSERT(args->context != nullptr);
if (args->context[GRPC_GRPCLB_CLIENT_STATS].value != nullptr) {
- calld->client_stats = grpc_grpclb_client_stats_ref(
- static_cast<grpc_grpclb_client_stats*>(args->context[GRPC_GRPCLB_CLIENT_STATS]
- .value));
+ calld->client_stats =
+ grpc_grpclb_client_stats_ref(static_cast<grpc_grpclb_client_stats*>(
+ args->context[GRPC_GRPCLB_CLIENT_STATS].value));
// Record call started.
grpc_grpclb_client_stats_add_call_started(calld->client_stats);
}
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 9ebc15d985..04bf798267 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
@@ -320,7 +320,8 @@ static void glb_lb_call_data_ref(glb_lb_call_data* lb_calld,
const gpr_atm count = gpr_atm_acq_load(&lb_calld->refs.count);
gpr_log(GPR_DEBUG, "[%s %p] lb_calld %p REF %lu->%lu (%s)",
grpc_lb_glb_trace.name(), lb_calld->glb_policy, lb_calld,
- static_cast<unsigned long>(count - 1), static_cast<unsigned long>(count), reason);
+ static_cast<unsigned long>(count - 1),
+ static_cast<unsigned long>(count), reason);
}
}
@@ -331,7 +332,8 @@ static void glb_lb_call_data_unref(glb_lb_call_data* lb_calld,
const gpr_atm count = gpr_atm_acq_load(&lb_calld->refs.count);
gpr_log(GPR_DEBUG, "[%s %p] lb_calld %p UNREF %lu->%lu (%s)",
grpc_lb_glb_trace.name(), lb_calld->glb_policy, lb_calld,
- static_cast<unsigned long>(count + 1), static_cast<unsigned long>(count), reason);
+ static_cast<unsigned long>(count + 1),
+ static_cast<unsigned long>(count), reason);
}
if (done) {
GPR_ASSERT(lb_calld->lb_call != nullptr);
@@ -493,13 +495,15 @@ static void parse_server(const grpc_grpclb_server* server,
const grpc_grpclb_ip_address* ip = &server->ip_address;
if (ip->size == 4) {
addr->len = sizeof(struct sockaddr_in);
- struct sockaddr_in* addr4 = reinterpret_cast<struct sockaddr_in*>(&addr->addr);
+ struct sockaddr_in* addr4 =
+ reinterpret_cast<struct sockaddr_in*>(&addr->addr);
addr4->sin_family = AF_INET;
memcpy(&addr4->sin_addr, ip->bytes, ip->size);
addr4->sin_port = netorder_port;
} else if (ip->size == 16) {
addr->len = sizeof(struct sockaddr_in6);
- struct sockaddr_in6* addr6 = reinterpret_cast<struct sockaddr_in6*>(&addr->addr);
+ struct sockaddr_in6* addr6 =
+ reinterpret_cast<struct sockaddr_in6*>(&addr->addr);
addr6->sin6_family = AF_INET6;
memcpy(&addr6->sin6_addr, ip->bytes, ip->size);
addr6->sin6_port = netorder_port;
@@ -716,7 +720,8 @@ static grpc_lb_policy_args* lb_policy_args_create(glb_lb_policy* glb_policy) {
addresses = grpc_lb_addresses_copy(glb_policy->fallback_backend_addresses);
}
GPR_ASSERT(addresses != nullptr);
- grpc_lb_policy_args* args = static_cast<grpc_lb_policy_args*>(gpr_zalloc(sizeof(*args)));
+ grpc_lb_policy_args* args =
+ static_cast<grpc_lb_policy_args*>(gpr_zalloc(sizeof(*args)));
args->client_channel_factory = glb_policy->cc_factory;
args->combiner = glb_policy->base.combiner;
// Replace the LB addresses in the channel args that we pass down to
@@ -887,8 +892,8 @@ static grpc_channel_args* build_lb_channel_args(
grpc_lb_addresses* lb_addresses =
grpc_lb_addresses_create(num_grpclb_addrs, nullptr);
grpc_slice_hash_table_entry* targets_info_entries =
- static_cast<grpc_slice_hash_table_entry*>(gpr_zalloc(sizeof(*targets_info_entries) *
- num_grpclb_addrs));
+ static_cast<grpc_slice_hash_table_entry*>(
+ gpr_zalloc(sizeof(*targets_info_entries) * num_grpclb_addrs));
size_t lb_addresses_idx = 0;
for (size_t i = 0; i < addresses->num_addresses; ++i) {
@@ -1257,7 +1262,8 @@ static void client_load_report_done_locked(void* arg, grpc_error* error) {
static bool load_report_counters_are_zero(grpc_grpclb_request* request) {
grpc_grpclb_dropped_call_counts* drop_entries =
- static_cast<grpc_grpclb_dropped_call_counts*>(request->client_stats.calls_finished_with_drop.arg);
+ static_cast<grpc_grpclb_dropped_call_counts*>(
+ request->client_stats.calls_finished_with_drop.arg);
return request->client_stats.num_calls_started == 0 &&
request->client_stats.num_calls_finished == 0 &&
request->client_stats.num_calls_finished_with_client_failed_to_send ==
@@ -1338,7 +1344,8 @@ static glb_lb_call_data* lb_call_data_create_locked(glb_lb_policy* glb_policy) {
glb_policy->lb_call_timeout_ms == 0
? GRPC_MILLIS_INF_FUTURE
: grpc_core::ExecCtx::Get()->Now() + glb_policy->lb_call_timeout_ms;
- glb_lb_call_data* lb_calld = static_cast<glb_lb_call_data*>(gpr_zalloc(sizeof(*lb_calld)));
+ glb_lb_call_data* lb_calld =
+ static_cast<glb_lb_call_data*>(gpr_zalloc(sizeof(*lb_calld)));
lb_calld->lb_call = grpc_channel_create_pollset_set_call(
glb_policy->lb_channel, nullptr, GRPC_PROPAGATE_DEFAULTS,
glb_policy->base.interested_parties,
@@ -1809,14 +1816,16 @@ static grpc_lb_policy* glb_create(grpc_lb_policy_factory* factory,
if (arg == nullptr || arg->type != GRPC_ARG_POINTER) {
return nullptr;
}
- grpc_lb_addresses* addresses = static_cast<grpc_lb_addresses*>(arg->value.pointer.p);
+ grpc_lb_addresses* addresses =
+ static_cast<grpc_lb_addresses*>(arg->value.pointer.p);
size_t num_grpclb_addrs = 0;
for (size_t i = 0; i < addresses->num_addresses; ++i) {
if (addresses->addresses[i].is_balancer) ++num_grpclb_addrs;
}
if (num_grpclb_addrs == 0) return nullptr;
- glb_lb_policy* glb_policy = static_cast<glb_lb_policy*>(gpr_zalloc(sizeof(*glb_policy)));
+ glb_lb_policy* glb_policy =
+ static_cast<glb_lb_policy*>(gpr_zalloc(sizeof(*glb_policy)));
/* Get server name. */
arg = grpc_channel_args_find(args->args, GRPC_ARG_SERVER_URI);
@@ -1920,7 +1929,8 @@ static bool maybe_add_client_load_reporting_filter(
if (channel_arg != nullptr && channel_arg->type == GRPC_ARG_STRING &&
strcmp(channel_arg->value.string, "grpclb") == 0) {
return grpc_channel_stack_builder_append_filter(
- builder, static_cast<const grpc_channel_filter*>(arg), nullptr, nullptr);
+ builder, static_cast<const grpc_channel_filter*>(arg), nullptr,
+ nullptr);
}
return true;
}
diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc
index f9ffea6c39..3929ed0843 100644
--- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc
@@ -88,8 +88,8 @@ void grpc_grpclb_client_stats_add_call_dropped_locked(
// Record the drop.
if (client_stats->drop_token_counts == nullptr) {
client_stats->drop_token_counts =
- static_cast<grpc_grpclb_dropped_call_counts*>(gpr_zalloc(
- sizeof(grpc_grpclb_dropped_call_counts)));
+ static_cast<grpc_grpclb_dropped_call_counts*>(
+ gpr_zalloc(sizeof(grpc_grpclb_dropped_call_counts)));
}
grpc_grpclb_dropped_call_counts* drop_token_counts =
client_stats->drop_token_counts;
@@ -104,9 +104,9 @@ void grpc_grpclb_client_stats_add_call_dropped_locked(
while (new_num_entries < drop_token_counts->num_entries + 1) {
new_num_entries *= 2;
}
- drop_token_counts->token_counts = static_cast<grpc_grpclb_drop_token_count*>(gpr_realloc(
- drop_token_counts->token_counts,
- new_num_entries * sizeof(grpc_grpclb_drop_token_count)));
+ drop_token_counts->token_counts = static_cast<grpc_grpclb_drop_token_count*>(
+ gpr_realloc(drop_token_counts->token_counts,
+ new_num_entries * sizeof(grpc_grpclb_drop_token_count)));
grpc_grpclb_drop_token_count* new_entry =
&drop_token_counts->token_counts[drop_token_counts->num_entries++];
new_entry->token = gpr_strdup(token);
@@ -114,7 +114,7 @@ void grpc_grpclb_client_stats_add_call_dropped_locked(
}
static void atomic_get_and_reset_counter(int64_t* value, gpr_atm* counter) {
- *value = static_cast<int64_t>gpr_atm_acq_load(counter);
+ *value = static_cast<int64_t> gpr_atm_acq_load(counter);
gpr_atm_full_fetch_add(counter, (gpr_atm)(-*value));
}
diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc
index ee6dd27eb5..c388b6ba77 100644
--- a/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc
@@ -60,8 +60,8 @@ static bool decode_serverlist(pb_istream_t* stream, const pb_field_t* field,
}
grpc_grpclb_request* grpc_grpclb_request_create(const char* lb_service_name) {
- grpc_grpclb_request* req =
- static_cast<grpc_grpclb_request*>(gpr_malloc(sizeof(grpc_grpclb_request)));
+ grpc_grpclb_request* req = static_cast<grpc_grpclb_request*>(
+ gpr_malloc(sizeof(grpc_grpclb_request)));
req->has_client_stats = false;
req->has_initial_request = true;
req->initial_request.has_name = true;
@@ -107,8 +107,8 @@ static bool encode_drops(pb_ostream_t* stream, const pb_field_t* field,
grpc_grpclb_request* grpc_grpclb_load_report_request_create_locked(
grpc_grpclb_client_stats* client_stats) {
- grpc_grpclb_request* req =
- static_cast<grpc_grpclb_request*>(gpr_zalloc(sizeof(grpc_grpclb_request)));
+ grpc_grpclb_request* req = static_cast<grpc_grpclb_request*>(
+ gpr_zalloc(sizeof(grpc_grpclb_request)));
req->has_client_stats = true;
req->client_stats.has_timestamp = true;
populate_timestamp(gpr_now(GPR_CLOCK_REALTIME), &req->client_stats.timestamp);
@@ -123,8 +123,8 @@ grpc_grpclb_request* grpc_grpclb_load_report_request_create_locked(
&req->client_stats.num_calls_finished,
&req->client_stats.num_calls_finished_with_client_failed_to_send,
&req->client_stats.num_calls_finished_known_received,
- reinterpret_cast<grpc_grpclb_dropped_call_counts**>(&req->client_stats
- .calls_finished_with_drop.arg));
+ reinterpret_cast<grpc_grpclb_dropped_call_counts**>(
+ &req->client_stats.calls_finished_with_drop.arg));
return req;
}
@@ -148,7 +148,8 @@ grpc_slice grpc_grpclb_request_encode(const grpc_grpclb_request* request) {
void grpc_grpclb_request_destroy(grpc_grpclb_request* request) {
if (request->has_client_stats) {
grpc_grpclb_dropped_call_counts* drop_entries =
- static_cast<grpc_grpclb_dropped_call_counts*>(request->client_stats.calls_finished_with_drop.arg);
+ static_cast<grpc_grpclb_dropped_call_counts*>(
+ request->client_stats.calls_finished_with_drop.arg);
grpc_grpclb_dropped_call_counts_destroy(drop_entries);
}
gpr_free(request);
@@ -170,8 +171,8 @@ grpc_grpclb_initial_response* grpc_grpclb_initial_response_parse(
if (!res.has_initial_response) return nullptr;
grpc_grpclb_initial_response* initial_res =
- static_cast<grpc_grpclb_initial_response*>(gpr_malloc(
- sizeof(grpc_grpclb_initial_response)));
+ static_cast<grpc_grpclb_initial_response*>(
+ gpr_malloc(sizeof(grpc_grpclb_initial_response)));
memcpy(initial_res, &res.initial_response,
sizeof(grpc_grpclb_initial_response));
@@ -184,8 +185,8 @@ grpc_grpclb_serverlist* grpc_grpclb_response_parse_serverlist(
pb_istream_from_buffer(GRPC_SLICE_START_PTR(encoded_grpc_grpclb_response),
GRPC_SLICE_LENGTH(encoded_grpc_grpclb_response));
pb_istream_t stream_at_start = stream;
- grpc_grpclb_serverlist* sl =
- static_cast<grpc_grpclb_serverlist*>(gpr_zalloc(sizeof(grpc_grpclb_serverlist)));
+ grpc_grpclb_serverlist* sl = static_cast<grpc_grpclb_serverlist*>(
+ gpr_zalloc(sizeof(grpc_grpclb_serverlist)));
grpc_grpclb_response res;
memset(&res, 0, sizeof(grpc_grpclb_response));
// First pass: count number of servers.
@@ -199,8 +200,8 @@ grpc_grpclb_serverlist* grpc_grpclb_response_parse_serverlist(
}
// Second pass: populate servers.
if (sl->num_servers > 0) {
- sl->servers = static_cast<grpc_grpclb_server**>(gpr_zalloc(sizeof(grpc_grpclb_server*) *
- sl->num_servers));
+ sl->servers = static_cast<grpc_grpclb_server**>(
+ gpr_zalloc(sizeof(grpc_grpclb_server*) * sl->num_servers));
decode_serverlist_arg decode_arg;
memset(&decode_arg, 0, sizeof(decode_arg));
decode_arg.serverlist = sl;
@@ -230,14 +231,14 @@ void grpc_grpclb_destroy_serverlist(grpc_grpclb_serverlist* serverlist) {
grpc_grpclb_serverlist* grpc_grpclb_serverlist_copy(
const grpc_grpclb_serverlist* sl) {
- grpc_grpclb_serverlist* copy =
- static_cast<grpc_grpclb_serverlist*>(gpr_zalloc(sizeof(grpc_grpclb_serverlist)));
+ grpc_grpclb_serverlist* copy = static_cast<grpc_grpclb_serverlist*>(
+ gpr_zalloc(sizeof(grpc_grpclb_serverlist)));
copy->num_servers = sl->num_servers;
- copy->servers = static_cast<grpc_grpclb_server**>(gpr_malloc(sizeof(grpc_grpclb_server*) *
- sl->num_servers));
+ copy->servers = static_cast<grpc_grpclb_server**>(
+ gpr_malloc(sizeof(grpc_grpclb_server*) * sl->num_servers));
for (size_t i = 0; i < sl->num_servers; i++) {
- copy->servers[i] =
- static_cast<grpc_grpclb_server*>(gpr_malloc(sizeof(grpc_grpclb_server)));
+ copy->servers[i] = static_cast<grpc_grpclb_server*>(
+ gpr_malloc(sizeof(grpc_grpclb_server)));
memcpy(copy->servers[i], sl->servers[i], sizeof(grpc_grpclb_server));
}
return copy;
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 7e957e082c..1485f7caf5 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
@@ -348,7 +348,8 @@ static void pf_update_locked(grpc_lb_policy* policy,
static void pf_connectivity_changed_locked(void* arg, grpc_error* error) {
grpc_lb_subchannel_data* sd = static_cast<grpc_lb_subchannel_data*>(arg);
- pick_first_lb_policy* p = reinterpret_cast<pick_first_lb_policy*>(sd->subchannel_list->policy);
+ pick_first_lb_policy* p =
+ reinterpret_cast<pick_first_lb_policy*>(sd->subchannel_list->policy);
if (grpc_lb_pick_first_trace.enabled()) {
gpr_log(GPR_DEBUG,
"Pick First %p connectivity changed for subchannel %p (%" PRIuPTR
@@ -547,7 +548,8 @@ static void pick_first_factory_unref(grpc_lb_policy_factory* factory) {}
static grpc_lb_policy* create_pick_first(grpc_lb_policy_factory* factory,
grpc_lb_policy_args* args) {
GPR_ASSERT(args->client_channel_factory != nullptr);
- pick_first_lb_policy* p = static_cast<pick_first_lb_policy*>(gpr_zalloc(sizeof(*p)));
+ pick_first_lb_policy* p =
+ static_cast<pick_first_lb_policy*>(gpr_zalloc(sizeof(*p)));
if (grpc_lb_pick_first_trace.enabled()) {
gpr_log(GPR_DEBUG, "Pick First %p created.", (void*)p);
}
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 b0e1c79500..f657a2af10 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
@@ -82,7 +82,8 @@ static size_t get_next_ready_subchannel_index_locked(
gpr_log(GPR_INFO,
"[RR %p] getting next ready subchannel (out of %lu), "
"last_ready_subchannel_index=%lu",
- (void*)p, static_cast<unsigned long>(p->subchannel_list->num_subchannels),
+ (void*)p,
+ static_cast<unsigned long>(p->subchannel_list->num_subchannels),
static_cast<unsigned long>(p->last_ready_subchannel_index));
}
for (size_t i = 0; i < p->subchannel_list->num_subchannels; ++i) {
@@ -334,7 +335,8 @@ static void update_lb_connectivity_status_locked(grpc_lb_subchannel_data* sd,
* subchannel_list->num_subchannels.
*/
grpc_lb_subchannel_list* subchannel_list = sd->subchannel_list;
- round_robin_lb_policy* p = reinterpret_cast<round_robin_lb_policy*>(subchannel_list->policy);
+ round_robin_lb_policy* p =
+ reinterpret_cast<round_robin_lb_policy*>(subchannel_list->policy);
GPR_ASSERT(sd->curr_connectivity_state != GRPC_CHANNEL_IDLE);
if (subchannel_list->num_ready > 0) {
/* 1) READY */
@@ -426,7 +428,8 @@ static void rr_connectivity_changed_locked(void* arg, grpc_error* error) {
if (grpc_lb_round_robin_trace.enabled()) {
const unsigned long num_subchannels =
p->subchannel_list != nullptr
- ? static_cast<unsigned long>(p->subchannel_list->num_subchannels)
+ ? static_cast<unsigned long>(
+ p->subchannel_list->num_subchannels)
: 0;
gpr_log(GPR_DEBUG,
"[RR %p] phasing out subchannel list %p (size %lu) in favor "
@@ -467,7 +470,8 @@ static void rr_connectivity_changed_locked(void* arg, grpc_error* error) {
"[RR %p] Fulfilling pending pick. Target <-- subchannel %p "
"(subchannel_list %p, index %lu)",
(void*)p, (void*)selected->subchannel,
- (void*)p->subchannel_list, static_cast<unsigned long>(next_ready_index));
+ (void*)p->subchannel_list,
+ static_cast<unsigned long>(next_ready_index));
}
GRPC_CLOSURE_SCHED(pick->on_complete, GRPC_ERROR_NONE);
}
@@ -537,7 +541,8 @@ static void rr_update_locked(grpc_lb_policy* policy,
}
return;
}
- grpc_lb_addresses* addresses = static_cast<grpc_lb_addresses*>(arg->value.pointer.p);
+ grpc_lb_addresses* addresses =
+ static_cast<grpc_lb_addresses*>(arg->value.pointer.p);
if (grpc_lb_round_robin_trace.enabled()) {
gpr_log(GPR_DEBUG, "[RR %p] received update with %" PRIuPTR " addresses", p,
addresses->num_addresses);
@@ -643,7 +648,8 @@ static void round_robin_factory_unref(grpc_lb_policy_factory* factory) {}
static grpc_lb_policy* round_robin_create(grpc_lb_policy_factory* factory,
grpc_lb_policy_args* args) {
GPR_ASSERT(args->client_channel_factory != nullptr);
- round_robin_lb_policy* p = static_cast<round_robin_lb_policy*>(gpr_zalloc(sizeof(*p)));
+ round_robin_lb_policy* p =
+ static_cast<round_robin_lb_policy*>(gpr_zalloc(sizeof(*p)));
grpc_lb_policy_init(&p->base, &round_robin_lb_policy_vtable, args->combiner);
grpc_subchannel_index_ref();
grpc_connectivity_state_init(&p->state_tracker, GRPC_CHANNEL_IDLE,
diff --git a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc
index b671b2ae39..e35c5e8db3 100644
--- a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc
@@ -60,7 +60,8 @@ void grpc_lb_subchannel_data_start_connectivity_watch(
" (subchannel %p): requesting connectivity change "
"notification (from %s)",
sd->subchannel_list->tracer->name(), sd->subchannel_list->policy,
- sd->subchannel_list, static_cast<size_t>(sd - sd->subchannel_list->subchannels),
+ sd->subchannel_list,
+ static_cast<size_t>(sd - sd->subchannel_list->subchannels),
sd->subchannel_list->num_subchannels, sd->subchannel,
grpc_connectivity_state_name(sd->pending_connectivity_state_unsafe));
}
@@ -91,7 +92,8 @@ grpc_lb_subchannel_list* grpc_lb_subchannel_list_create(
const grpc_lb_addresses* addresses, const grpc_lb_policy_args* args,
grpc_iomgr_cb_func connectivity_changed_cb) {
grpc_lb_subchannel_list* subchannel_list =
- static_cast<grpc_lb_subchannel_list*>(gpr_zalloc(sizeof(*subchannel_list)));
+ static_cast<grpc_lb_subchannel_list*>(
+ gpr_zalloc(sizeof(*subchannel_list)));
if (tracer->enabled()) {
gpr_log(GPR_DEBUG,
"[%s %p] Creating subchannel list %p for %" PRIuPTR " subchannels",
@@ -100,8 +102,8 @@ grpc_lb_subchannel_list* grpc_lb_subchannel_list_create(
subchannel_list->policy = p;
subchannel_list->tracer = tracer;
gpr_ref_init(&subchannel_list->refcount, 1);
- subchannel_list->subchannels = static_cast<grpc_lb_subchannel_data*>(gpr_zalloc(
- sizeof(grpc_lb_subchannel_data) * addresses->num_addresses));
+ subchannel_list->subchannels = static_cast<grpc_lb_subchannel_data*>(
+ gpr_zalloc(sizeof(grpc_lb_subchannel_data) * addresses->num_addresses));
// We need to remove the LB addresses in order to be able to compare the
// subchannel keys of subchannels from a different batch of addresses.
static const char* keys_to_remove[] = {GRPC_ARG_SUBCHANNEL_ADDRESS,
@@ -190,8 +192,8 @@ void grpc_lb_subchannel_list_ref(grpc_lb_subchannel_list* subchannel_list,
const gpr_atm count = gpr_atm_acq_load(&subchannel_list->refcount.count);
gpr_log(GPR_DEBUG, "[%s %p] subchannel_list %p REF %lu->%lu (%s)",
subchannel_list->tracer->name(), subchannel_list->policy,
- subchannel_list, static_cast<unsigned long>(count - 1), static_cast<unsigned long>(count),
- reason);
+ subchannel_list, static_cast<unsigned long>(count - 1),
+ static_cast<unsigned long>(count), reason);
}
}
@@ -202,8 +204,8 @@ void grpc_lb_subchannel_list_unref(grpc_lb_subchannel_list* subchannel_list,
const gpr_atm count = gpr_atm_acq_load(&subchannel_list->refcount.count);
gpr_log(GPR_DEBUG, "[%s %p] subchannel_list %p UNREF %lu->%lu (%s)",
subchannel_list->tracer->name(), subchannel_list->policy,
- subchannel_list, static_cast<unsigned long>(count + 1), static_cast<unsigned long>(count),
- reason);
+ subchannel_list, static_cast<unsigned long>(count + 1),
+ static_cast<unsigned long>(count), reason);
}
if (done) {
subchannel_list_destroy(subchannel_list);
diff --git a/src/core/ext/filters/client_channel/lb_policy_factory.cc b/src/core/ext/filters/client_channel/lb_policy_factory.cc
index b9b9e298a5..f2a800b221 100644
--- a/src/core/ext/filters/client_channel/lb_policy_factory.cc
+++ b/src/core/ext/filters/client_channel/lb_policy_factory.cc
@@ -33,7 +33,8 @@ grpc_lb_addresses* grpc_lb_addresses_create(
addresses->num_addresses = num_addresses;
addresses->user_data_vtable = user_data_vtable;
const size_t addresses_size = sizeof(grpc_lb_address) * num_addresses;
- addresses->addresses = static_cast<grpc_lb_address*>(gpr_zalloc(addresses_size));
+ addresses->addresses =
+ static_cast<grpc_lb_address*>(gpr_zalloc(addresses_size));
return addresses;
}
diff --git a/src/core/ext/filters/client_channel/parse_address.cc b/src/core/ext/filters/client_channel/parse_address.cc
index c95560dd82..473c7542df 100644
--- a/src/core/ext/filters/client_channel/parse_address.cc
+++ b/src/core/ext/filters/client_channel/parse_address.cc
@@ -40,7 +40,8 @@ bool grpc_parse_unix(const grpc_uri* uri,
gpr_log(GPR_ERROR, "Expected 'unix' scheme, got '%s'", uri->scheme);
return false;
}
- struct sockaddr_un* un = reinterpret_cast<struct sockaddr_un*>(resolved_addr->addr);
+ struct sockaddr_un* un =
+ reinterpret_cast<struct sockaddr_un*>(resolved_addr->addr);
const size_t maxlen = sizeof(un->sun_path);
const size_t path_len = strnlen(uri->path, maxlen);
if (path_len == maxlen) return false;
diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
index 9e3a8c891e..0442b1e496 100644
--- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
+++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
@@ -312,7 +312,8 @@ void AresDnsResolver::OnResolvedLocked(void* arg, grpc_error* error) {
if (lb_policy_name != nullptr) {
args_to_remove[num_args_to_remove++] = GRPC_ARG_LB_POLICY_NAME;
new_args[num_args_to_add++] = grpc_channel_arg_string_create(
- (char*)GRPC_ARG_LB_POLICY_NAME, const_cast<char*>(lb_policy_name));
+ (char*)GRPC_ARG_LB_POLICY_NAME,
+ const_cast<char*>(lb_policy_name));
}
}
}
diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc
index 3b23b53e60..10bc8f6074 100644
--- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc
+++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc
@@ -124,7 +124,8 @@ static void fd_node_shutdown(fd_node* fdn) {
grpc_error* grpc_ares_ev_driver_create(grpc_ares_ev_driver** ev_driver,
grpc_pollset_set* pollset_set) {
- *ev_driver = static_cast<grpc_ares_ev_driver*>(gpr_malloc(sizeof(grpc_ares_ev_driver)));
+ *ev_driver = static_cast<grpc_ares_ev_driver*>(
+ gpr_malloc(sizeof(grpc_ares_ev_driver)));
int status = ares_init(&(*ev_driver)->channel);
gpr_log(GPR_DEBUG, "grpc_ares_ev_driver_create");
if (status != ARES_SUCCESS) {
diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
index 93f5f44fa6..82b5545601 100644
--- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
+++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
@@ -110,8 +110,8 @@ static void grpc_ares_request_unref(grpc_ares_request* r) {
static grpc_ares_hostbyname_request* create_hostbyname_request(
grpc_ares_request* parent_request, char* host, uint16_t port,
bool is_balancer) {
- grpc_ares_hostbyname_request* hr = static_cast<grpc_ares_hostbyname_request*>(gpr_zalloc(
- sizeof(grpc_ares_hostbyname_request)));
+ grpc_ares_hostbyname_request* hr = static_cast<grpc_ares_hostbyname_request*>(
+ gpr_zalloc(sizeof(grpc_ares_hostbyname_request)));
hr->parent_request = parent_request;
hr->host = gpr_strdup(host);
hr->port = port;
@@ -128,7 +128,8 @@ static void destroy_hostbyname_request(grpc_ares_hostbyname_request* hr) {
static void on_hostbyname_done_cb(void* arg, int status, int timeouts,
struct hostent* hostent) {
- grpc_ares_hostbyname_request* hr = static_cast<grpc_ares_hostbyname_request*>(arg);
+ grpc_ares_hostbyname_request* hr =
+ static_cast<grpc_ares_hostbyname_request*>(arg);
grpc_ares_request* r = hr->parent_request;
gpr_mu_lock(&r->mu);
if (status == ARES_SUCCESS) {
@@ -144,9 +145,9 @@ static void on_hostbyname_done_cb(void* arg, int status, int timeouts,
for (i = 0; hostent->h_addr_list[i] != nullptr; i++) {
}
(*lb_addresses)->num_addresses += i;
- (*lb_addresses)->addresses = static_cast<grpc_lb_address*>(gpr_realloc(
- (*lb_addresses)->addresses,
- sizeof(grpc_lb_address) * (*lb_addresses)->num_addresses));
+ (*lb_addresses)->addresses = static_cast<grpc_lb_address*>(
+ gpr_realloc((*lb_addresses)->addresses,
+ sizeof(grpc_lb_address) * (*lb_addresses)->num_addresses));
for (i = prev_naddr; i < (*lb_addresses)->num_addresses; i++) {
switch (hostent->h_addrtype) {
case AF_INET6: {
@@ -279,13 +280,15 @@ static void on_txt_done_cb(void* arg, int status, int timeouts,
// Found a service config record.
if (result != nullptr) {
size_t service_config_len = result->length - prefix_len;
- *r->service_config_json_out = static_cast<char*>(gpr_malloc(service_config_len + 1));
+ *r->service_config_json_out =
+ static_cast<char*>(gpr_malloc(service_config_len + 1));
memcpy(*r->service_config_json_out, result->txt + prefix_len,
service_config_len);
for (result = result->next; result != nullptr && !result->record_start;
result = result->next) {
- *r->service_config_json_out = static_cast<char*>(gpr_realloc(
- *r->service_config_json_out, service_config_len + result->length + 1));
+ *r->service_config_json_out = static_cast<char*>(
+ gpr_realloc(*r->service_config_json_out,
+ service_config_len + result->length + 1));
memcpy(*r->service_config_json_out + service_config_len, result->txt,
result->length);
service_config_len += result->length;
@@ -372,7 +375,8 @@ static grpc_ares_request* grpc_dns_lookup_ares_impl(
} else if (grpc_parse_ipv6_hostport(dns_server, &addr,
false /* log_errors */)) {
r->dns_server_addr.family = AF_INET6;
- struct sockaddr_in6* in6 = reinterpret_cast<struct sockaddr_in6*>(addr.addr);
+ struct sockaddr_in6* in6 =
+ reinterpret_cast<struct sockaddr_in6*>(addr.addr);
memcpy(&r->dns_server_addr.addr.addr6, &in6->sin6_addr,
sizeof(struct in6_addr));
r->dns_server_addr.tcp_port = grpc_sockaddr_get_port(&addr);
@@ -492,11 +496,12 @@ static void on_dns_lookup_done_cb(void* arg, grpc_error* error) {
if (r->lb_addrs == nullptr || r->lb_addrs->num_addresses == 0) {
*resolved_addresses = nullptr;
} else {
- *resolved_addresses =
- static_cast<grpc_resolved_addresses*>(gpr_zalloc(sizeof(grpc_resolved_addresses)));
+ *resolved_addresses = static_cast<grpc_resolved_addresses*>(
+ gpr_zalloc(sizeof(grpc_resolved_addresses)));
(*resolved_addresses)->naddrs = r->lb_addrs->num_addresses;
- (*resolved_addresses)->addrs = static_cast<grpc_resolved_address*>(gpr_zalloc(
- sizeof(grpc_resolved_address) * (*resolved_addresses)->naddrs));
+ (*resolved_addresses)->addrs =
+ static_cast<grpc_resolved_address*>(gpr_zalloc(
+ sizeof(grpc_resolved_address) * (*resolved_addresses)->naddrs));
for (size_t i = 0; i < (*resolved_addresses)->naddrs; i++) {
GPR_ASSERT(!r->lb_addrs->addresses[i].is_balancer);
memcpy(&(*resolved_addresses)->addrs[i],
@@ -514,8 +519,8 @@ static void grpc_resolve_address_ares_impl(const char* name,
grpc_closure* on_done,
grpc_resolved_addresses** addrs) {
grpc_resolve_address_ares_request* r =
- static_cast<grpc_resolve_address_ares_request*>(gpr_zalloc(
- sizeof(grpc_resolve_address_ares_request)));
+ static_cast<grpc_resolve_address_ares_request*>(
+ gpr_zalloc(sizeof(grpc_resolve_address_ares_request)));
r->addrs_out = addrs;
r->on_resolve_address_done = on_done;
GRPC_CLOSURE_INIT(&r->on_dns_lookup_done, on_dns_lookup_done_cb, r,
diff --git a/src/core/ext/filters/client_channel/retry_throttle.cc b/src/core/ext/filters/client_channel/retry_throttle.cc
index d1e0820560..dd33b69102 100644
--- a/src/core/ext/filters/client_channel/retry_throttle.cc
+++ b/src/core/ext/filters/client_channel/retry_throttle.cc
@@ -60,7 +60,8 @@ bool grpc_server_retry_throttle_data_record_failure(
get_replacement_throttle_data_if_needed(&throttle_data);
// We decrement milli_tokens by 1000 (1 token) for each failure.
const int new_value = static_cast<int>(gpr_atm_no_barrier_clamped_add(
- &throttle_data->milli_tokens, static_cast<gpr_atm>(-1000), static_cast<gpr_atm>(0),
+ &throttle_data->milli_tokens, static_cast<gpr_atm>(-1000),
+ static_cast<gpr_atm>(0),
static_cast<gpr_atm>(throttle_data->max_milli_tokens)));
// Retries are allowed as long as the new value is above the threshold
// (max_milli_tokens / 2).
@@ -73,8 +74,10 @@ void grpc_server_retry_throttle_data_record_success(
get_replacement_throttle_data_if_needed(&throttle_data);
// We increment milli_tokens by milli_token_ratio for each success.
gpr_atm_no_barrier_clamped_add(
- &throttle_data->milli_tokens, static_cast<gpr_atm>(throttle_data->milli_token_ratio),
- static_cast<gpr_atm>(0), static_cast<gpr_atm>(throttle_data->max_milli_tokens));
+ &throttle_data->milli_tokens,
+ static_cast<gpr_atm>(throttle_data->milli_token_ratio),
+ static_cast<gpr_atm>(0),
+ static_cast<gpr_atm>(throttle_data->max_milli_tokens));
}
grpc_server_retry_throttle_data* grpc_server_retry_throttle_data_ref(
@@ -100,7 +103,8 @@ static grpc_server_retry_throttle_data* grpc_server_retry_throttle_data_create(
int max_milli_tokens, int milli_token_ratio,
grpc_server_retry_throttle_data* old_throttle_data) {
grpc_server_retry_throttle_data* throttle_data =
- static_cast<grpc_server_retry_throttle_data*>(gpr_malloc(sizeof(*throttle_data)));
+ static_cast<grpc_server_retry_throttle_data*>(
+ gpr_malloc(sizeof(*throttle_data)));
memset(throttle_data, 0, sizeof(*throttle_data));
gpr_ref_init(&throttle_data->refs, 1);
throttle_data->max_milli_tokens = max_milli_tokens;
@@ -112,7 +116,7 @@ static grpc_server_retry_throttle_data* grpc_server_retry_throttle_data_create(
// we will start out doing the same thing on the new one.
if (old_throttle_data != nullptr) {
double token_fraction =
- static_cast<int>gpr_atm_acq_load(&old_throttle_data->milli_tokens) /
+ static_cast<int> gpr_atm_acq_load(&old_throttle_data->milli_tokens) /
static_cast<double>(old_throttle_data->max_milli_tokens);
initial_milli_tokens = static_cast<int>(token_fraction * max_milli_tokens);
}
@@ -178,13 +182,14 @@ grpc_server_retry_throttle_data* grpc_retry_throttle_map_get_data_for_server(
const char* server_name, int max_milli_tokens, int milli_token_ratio) {
gpr_mu_lock(&g_mu);
grpc_server_retry_throttle_data* throttle_data =
- static_cast<grpc_server_retry_throttle_data*>(grpc_avl_get(g_avl, const_cast<char*>(server_name),
- nullptr));
+ static_cast<grpc_server_retry_throttle_data*>(
+ grpc_avl_get(g_avl, const_cast<char*>(server_name), nullptr));
if (throttle_data == nullptr) {
// Entry not found. Create a new one.
throttle_data = grpc_server_retry_throttle_data_create(
max_milli_tokens, milli_token_ratio, nullptr);
- g_avl = grpc_avl_add(g_avl, const_cast<char*>(server_name), throttle_data, nullptr);
+ g_avl = grpc_avl_add(g_avl, const_cast<char*>(server_name), throttle_data,
+ nullptr);
} else {
if (throttle_data->max_milli_tokens != max_milli_tokens ||
throttle_data->milli_token_ratio != milli_token_ratio) {
@@ -192,7 +197,8 @@ grpc_server_retry_throttle_data* grpc_retry_throttle_map_get_data_for_server(
// the original one.
throttle_data = grpc_server_retry_throttle_data_create(
max_milli_tokens, milli_token_ratio, throttle_data);
- g_avl = grpc_avl_add(g_avl, const_cast<char*>(server_name), throttle_data, nullptr);
+ g_avl = grpc_avl_add(g_avl, const_cast<char*>(server_name), throttle_data,
+ nullptr);
} else {
// Entry found. Increase refcount.
grpc_server_retry_throttle_data_ref(throttle_data);
diff --git a/src/core/ext/filters/client_channel/subchannel.cc b/src/core/ext/filters/client_channel/subchannel.cc
index 55b11b89d9..179e3f27ac 100644
--- a/src/core/ext/filters/client_channel/subchannel.cc
+++ b/src/core/ext/filters/client_channel/subchannel.cc
@@ -241,8 +241,9 @@ static void disconnect(grpc_subchannel* c) {
void grpc_subchannel_unref(grpc_subchannel* c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
gpr_atm old_refs;
// add a weak ref and subtract a strong ref (atomically)
- old_refs = ref_mutate(c, static_cast<gpr_atm>(1) - static_cast<gpr_atm>(1 << INTERNAL_REF_BITS),
- 1 REF_MUTATE_PURPOSE("STRONG_UNREF"));
+ old_refs = ref_mutate(
+ c, static_cast<gpr_atm>(1) - static_cast<gpr_atm>(1 << INTERNAL_REF_BITS),
+ 1 REF_MUTATE_PURPOSE("STRONG_UNREF"));
if ((old_refs & STRONG_REF_MASK) == (1 << INTERNAL_REF_BITS)) {
disconnect(c);
}
@@ -252,7 +253,8 @@ void grpc_subchannel_unref(grpc_subchannel* c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
void grpc_subchannel_weak_unref(
grpc_subchannel* c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
gpr_atm old_refs;
- old_refs = ref_mutate(c, -static_cast<gpr_atm>(1), 1 REF_MUTATE_PURPOSE("WEAK_UNREF"));
+ old_refs = ref_mutate(c, -static_cast<gpr_atm>(1),
+ 1 REF_MUTATE_PURPOSE("WEAK_UNREF"));
if (old_refs == 1) {
GRPC_CLOSURE_SCHED(
GRPC_CLOSURE_CREATE(subchannel_destroy, c, grpc_schedule_on_exec_ctx),
@@ -325,8 +327,8 @@ grpc_subchannel* grpc_subchannel_create(grpc_connector* connector,
grpc_connector_ref(c->connector);
c->num_filters = args->filter_count;
if (c->num_filters > 0) {
- c->filters = static_cast<const grpc_channel_filter**>(gpr_malloc(
- sizeof(grpc_channel_filter*) * c->num_filters));
+ c->filters = static_cast<const grpc_channel_filter**>(
+ gpr_malloc(sizeof(grpc_channel_filter*) * c->num_filters));
memcpy((void*)c->filters, args->filters,
sizeof(grpc_channel_filter*) * c->num_filters);
} else {
@@ -570,7 +572,8 @@ static bool publish_transport_locked(grpc_subchannel* c) {
}
grpc_channel_stack* stk;
grpc_error* error = grpc_channel_stack_builder_finish(
- builder, 0, 1, connection_destroy, nullptr, reinterpret_cast<void**>(&stk));
+ builder, 0, 1, connection_destroy, nullptr,
+ reinterpret_cast<void**>(&stk));
if (error != GRPC_ERROR_NONE) {
grpc_transport_destroy(c->connecting_result.transport);
gpr_log(GPR_ERROR, "error initializing subchannel stack: %s",
@@ -581,8 +584,8 @@ static bool publish_transport_locked(grpc_subchannel* c) {
memset(&c->connecting_result, 0, sizeof(c->connecting_result));
/* initialize state watcher */
- state_watcher* connected_subchannel_watcher =
- static_cast<state_watcher*>(gpr_zalloc(sizeof(*connected_subchannel_watcher)));
+ state_watcher* connected_subchannel_watcher = static_cast<state_watcher*>(
+ gpr_zalloc(sizeof(*connected_subchannel_watcher)));
connected_subchannel_watcher->subchannel = c;
connected_subchannel_watcher->connectivity_state = GRPC_CHANNEL_READY;
GRPC_CLOSURE_INIT(&connected_subchannel_watcher->closure,
diff --git a/src/core/ext/filters/client_channel/subchannel_index.cc b/src/core/ext/filters/client_channel/subchannel_index.cc
index 2deafb380b..d1dc5ee970 100644
--- a/src/core/ext/filters/client_channel/subchannel_index.cc
+++ b/src/core/ext/filters/client_channel/subchannel_index.cc
@@ -45,13 +45,14 @@ static bool g_force_creation = false;
static grpc_subchannel_key* create_key(
const grpc_subchannel_args* args,
grpc_channel_args* (*copy_channel_args)(const grpc_channel_args* args)) {
- grpc_subchannel_key* k = static_cast<grpc_subchannel_key*>(gpr_malloc(sizeof(*k)));
+ grpc_subchannel_key* k =
+ static_cast<grpc_subchannel_key*>(gpr_malloc(sizeof(*k)));
k->args.filter_count = args->filter_count;
if (k->args.filter_count > 0) {
- k->args.filters = static_cast<const grpc_channel_filter**>(gpr_malloc(
- sizeof(*k->args.filters) * k->args.filter_count));
- memcpy(reinterpret_cast<grpc_channel_filter*>(k->args.filters), args->filters,
- sizeof(*k->args.filters) * k->args.filter_count);
+ k->args.filters = static_cast<const grpc_channel_filter**>(
+ gpr_malloc(sizeof(*k->args.filters) * k->args.filter_count));
+ memcpy(reinterpret_cast<grpc_channel_filter*>(k->args.filters),
+ args->filters, sizeof(*k->args.filters) * k->args.filter_count);
} else {
k->args.filters = nullptr;
}
@@ -170,7 +171,8 @@ grpc_subchannel* grpc_subchannel_index_register(grpc_subchannel_key* key,
gpr_mu_unlock(&g_mu);
// - Check to see if a subchannel already exists
- c = static_cast<grpc_subchannel*>(grpc_avl_get(index, key, grpc_core::ExecCtx::Get()));
+ c = static_cast<grpc_subchannel*>(
+ grpc_avl_get(index, key, grpc_core::ExecCtx::Get()));
if (c != nullptr) {
c = GRPC_SUBCHANNEL_REF_FROM_WEAK_REF(c, "index_register");
}
@@ -220,8 +222,8 @@ void grpc_subchannel_index_unregister(grpc_subchannel_key* key,
// Check to see if this key still refers to the previously
// registered subchannel
- grpc_subchannel* c =
- static_cast<grpc_subchannel*>(grpc_avl_get(index, key, grpc_core::ExecCtx::Get()));
+ grpc_subchannel* c = static_cast<grpc_subchannel*>(
+ grpc_avl_get(index, key, grpc_core::ExecCtx::Get()));
if (c != constructed) {
grpc_avl_unref(index, grpc_core::ExecCtx::Get());
break;
diff --git a/src/core/ext/filters/deadline/deadline_filter.cc b/src/core/ext/filters/deadline/deadline_filter.cc
index a936d17e8d..76c1204090 100644
--- a/src/core/ext/filters/deadline/deadline_filter.cc
+++ b/src/core/ext/filters/deadline/deadline_filter.cc
@@ -47,7 +47,8 @@ static void yield_call_combiner(void* arg, grpc_error* ignored) {
// synchronized.
static void send_cancel_op_in_call_combiner(void* arg, grpc_error* error) {
grpc_call_element* elem = static_cast<grpc_call_element*>(arg);
- grpc_deadline_state* deadline_state = static_cast<grpc_deadline_state*>(elem->call_data);
+ grpc_deadline_state* deadline_state =
+ static_cast<grpc_deadline_state*>(elem->call_data);
grpc_transport_stream_op_batch* batch = grpc_make_transport_stream_op(
GRPC_CLOSURE_INIT(&deadline_state->timer_callback, yield_call_combiner,
deadline_state, grpc_schedule_on_exec_ctx));
@@ -59,7 +60,8 @@ static void send_cancel_op_in_call_combiner(void* arg, grpc_error* error) {
// Timer callback.
static void timer_callback(void* arg, grpc_error* error) {
grpc_call_element* elem = static_cast<grpc_call_element*>(arg);
- grpc_deadline_state* deadline_state = static_cast<grpc_deadline_state*>(elem->call_data);
+ grpc_deadline_state* deadline_state =
+ static_cast<grpc_deadline_state*>(elem->call_data);
if (error != GRPC_ERROR_CANCELLED) {
error = grpc_error_set_int(
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Deadline Exceeded"),
@@ -85,7 +87,8 @@ static void start_timer_if_needed(grpc_call_element* elem,
if (deadline == GRPC_MILLIS_INF_FUTURE) {
return;
}
- grpc_deadline_state* deadline_state = static_cast<grpc_deadline_state*>(elem->call_data);
+ grpc_deadline_state* deadline_state =
+ static_cast<grpc_deadline_state*>(elem->call_data);
grpc_closure* closure = nullptr;
switch (deadline_state->timer_state) {
case GRPC_DEADLINE_STATE_PENDING:
@@ -173,7 +176,8 @@ void grpc_deadline_state_init(grpc_call_element* elem,
grpc_call_stack* call_stack,
grpc_call_combiner* call_combiner,
grpc_millis deadline) {
- grpc_deadline_state* deadline_state = static_cast<grpc_deadline_state*>(elem->call_data);
+ grpc_deadline_state* deadline_state =
+ static_cast<grpc_deadline_state*>(elem->call_data);
deadline_state->call_stack = call_stack;
deadline_state->call_combiner = call_combiner;
// Deadline will always be infinite on servers, so the timer will only be
@@ -187,7 +191,8 @@ void grpc_deadline_state_init(grpc_call_element* elem,
// create a closure to start the timer, and we schedule that closure
// to be run after call stack initialization is done.
struct start_timer_after_init_state* state =
- static_cast<struct start_timer_after_init_state*>(gpr_zalloc(sizeof(*state)));
+ static_cast<struct start_timer_after_init_state*>(
+ gpr_zalloc(sizeof(*state)));
state->elem = elem;
state->deadline = deadline;
GRPC_CLOSURE_INIT(&state->closure, start_timer_after_init, state,
@@ -197,20 +202,23 @@ void grpc_deadline_state_init(grpc_call_element* elem,
}
void grpc_deadline_state_destroy(grpc_call_element* elem) {
- grpc_deadline_state* deadline_state = static_cast<grpc_deadline_state*>(elem->call_data);
+ grpc_deadline_state* deadline_state =
+ static_cast<grpc_deadline_state*>(elem->call_data);
cancel_timer_if_needed(deadline_state);
}
void grpc_deadline_state_reset(grpc_call_element* elem,
grpc_millis new_deadline) {
- grpc_deadline_state* deadline_state = static_cast<grpc_deadline_state*>(elem->call_data);
+ grpc_deadline_state* deadline_state =
+ static_cast<grpc_deadline_state*>(elem->call_data);
cancel_timer_if_needed(deadline_state);
start_timer_if_needed(elem, new_deadline);
}
void grpc_deadline_state_client_start_transport_stream_op_batch(
grpc_call_element* elem, grpc_transport_stream_op_batch* op) {
- grpc_deadline_state* deadline_state = static_cast<grpc_deadline_state*>(elem->call_data);
+ grpc_deadline_state* deadline_state =
+ static_cast<grpc_deadline_state*>(elem->call_data);
if (op->cancel_stream) {
cancel_timer_if_needed(deadline_state);
} else {
@@ -360,7 +368,8 @@ static bool maybe_add_deadline_filter(grpc_channel_stack_builder* builder,
return grpc_deadline_checking_enabled(
grpc_channel_stack_builder_get_channel_arguments(builder))
? grpc_channel_stack_builder_prepend_filter(
- builder, static_cast<const grpc_channel_filter*>(arg), nullptr, nullptr)
+ builder, static_cast<const grpc_channel_filter*>(arg),
+ nullptr, nullptr)
: true;
}
diff --git a/src/core/ext/filters/http/client/http_client_filter.cc b/src/core/ext/filters/http/client/http_client_filter.cc
index aabc405bec..80643f8584 100644
--- a/src/core/ext/filters/http/client/http_client_filter.cc
+++ b/src/core/ext/filters/http/client/http_client_filter.cc
@@ -189,7 +189,8 @@ static grpc_error* pull_slice_from_send_message(call_data* calld) {
// and on_send_message_next_done() will be invoked when it is complete.
static grpc_error* read_all_available_send_message_data(call_data* calld) {
while (grpc_byte_stream_next(&calld->send_message_caching_stream.base,
- ~static_cast<size_t>(0), &calld->on_send_message_next_done)) {
+ ~static_cast<size_t>(0),
+ &calld->on_send_message_next_done)) {
grpc_error* error = pull_slice_from_send_message(calld);
if (error != GRPC_ERROR_NONE) return error;
if (calld->send_message_bytes_read ==
@@ -224,7 +225,8 @@ static void on_send_message_next_done(void* arg, grpc_error* error) {
}
static char* slice_buffer_to_string(grpc_slice_buffer* slice_buffer) {
- char* payload_bytes = static_cast<char*>(gpr_malloc(slice_buffer->length + 1));
+ char* payload_bytes =
+ static_cast<char*>(gpr_malloc(slice_buffer->length + 1));
size_t offset = 0;
for (size_t i = 0; i < slice_buffer->count; ++i) {
memcpy(payload_bytes + offset,
@@ -253,8 +255,10 @@ static grpc_error* update_path_for_get(grpc_call_element* elem,
false /* multi_line */);
grpc_slice path_with_query_slice = GRPC_SLICE_MALLOC(estimated_len);
/* memcopy individual pieces into this slice */
- char* write_ptr = reinterpret_cast<char*>GRPC_SLICE_START_PTR(path_with_query_slice);
- char* original_path = reinterpret_cast<char*>GRPC_SLICE_START_PTR(path_slice);
+ char* write_ptr =
+ reinterpret_cast<char*> GRPC_SLICE_START_PTR(path_with_query_slice);
+ char* original_path =
+ reinterpret_cast<char*> GRPC_SLICE_START_PTR(path_slice);
memcpy(write_ptr, original_path, GRPC_SLICE_LENGTH(path_slice));
write_ptr += GRPC_SLICE_LENGTH(path_slice);
*write_ptr++ = '?';
@@ -265,7 +269,7 @@ static grpc_error* update_path_for_get(grpc_call_element* elem,
true /* url_safe */, false /* multi_line */);
gpr_free(payload_bytes);
/* remove trailing unused memory and add trailing 0 to terminate string */
- char* t = reinterpret_cast<char*>GRPC_SLICE_START_PTR(path_with_query_slice);
+ char* t = reinterpret_cast<char*> GRPC_SLICE_START_PTR(path_with_query_slice);
/* safe to use strlen since base64_encode will always add '\0' */
path_with_query_slice =
grpc_slice_sub_no_ref(path_with_query_slice, 0, strlen(t));
diff --git a/src/core/ext/filters/http/http_filters_plugin.cc b/src/core/ext/filters/http/http_filters_plugin.cc
index b89cb028ea..56fe1e5c24 100644
--- a/src/core/ext/filters/http/http_filters_plugin.cc
+++ b/src/core/ext/filters/http/http_filters_plugin.cc
@@ -58,7 +58,8 @@ static bool maybe_add_required_filter(grpc_channel_stack_builder* builder,
void* arg) {
return is_building_http_like_transport(builder)
? grpc_channel_stack_builder_prepend_filter(
- builder, static_cast<const grpc_channel_filter*>(arg), nullptr, nullptr)
+ builder, static_cast<const grpc_channel_filter*>(arg),
+ nullptr, nullptr)
: true;
}
diff --git a/src/core/ext/filters/http/message_compress/message_compress_filter.cc b/src/core/ext/filters/http/message_compress/message_compress_filter.cc
index 223548d3bf..73220a0ea1 100644
--- a/src/core/ext/filters/http/message_compress/message_compress_filter.cc
+++ b/src/core/ext/filters/http/message_compress/message_compress_filter.cc
@@ -226,7 +226,8 @@ static void finish_send_message(grpc_call_element* elem) {
const char* algo_name;
const size_t before_size = calld->slices.length;
const size_t after_size = tmp.length;
- const float savings_ratio = 1.0f - static_cast<float>(after_size) / static_cast<float>(before_size);
+ const float savings_ratio = 1.0f - static_cast<float>(after_size) /
+ static_cast<float>(before_size);
GPR_ASSERT(grpc_message_compression_algorithm_name(
calld->message_compression_algorithm, &algo_name));
gpr_log(GPR_DEBUG,
@@ -291,8 +292,8 @@ static grpc_error* pull_slice_from_send_message(call_data* calld) {
static void continue_reading_send_message(grpc_call_element* elem) {
call_data* calld = static_cast<call_data*>(elem->call_data);
while (grpc_byte_stream_next(
- calld->send_message_batch->payload->send_message.send_message, ~static_cast<size_t>(0),
- &calld->on_send_message_next_done)) {
+ calld->send_message_batch->payload->send_message.send_message,
+ ~static_cast<size_t>(0), &calld->on_send_message_next_done)) {
grpc_error* error = pull_slice_from_send_message(calld);
if (error != GRPC_ERROR_NONE) {
// Closure callback; does not take ownership of error.
diff --git a/src/core/ext/filters/http/server/http_server_filter.cc b/src/core/ext/filters/http/server/http_server_filter.cc
index 560b5795e3..63bc2bd59f 100644
--- a/src/core/ext/filters/http/server/http_server_filter.cc
+++ b/src/core/ext/filters/http/server/http_server_filter.cc
@@ -224,10 +224,11 @@ static grpc_error* server_filter_incoming_metadata(grpc_call_element* elem,
/* decode payload from query and add to the slice buffer to be returned */
const int k_url_safe = 1;
- grpc_slice_buffer_add(&calld->read_slice_buffer,
- grpc_base64_decode_with_len(
- reinterpret_cast<const char*>GRPC_SLICE_START_PTR(query_slice),
- GRPC_SLICE_LENGTH(query_slice), k_url_safe));
+ grpc_slice_buffer_add(
+ &calld->read_slice_buffer,
+ grpc_base64_decode_with_len(
+ reinterpret_cast<const char*> GRPC_SLICE_START_PTR(query_slice),
+ GRPC_SLICE_LENGTH(query_slice), k_url_safe));
grpc_slice_buffer_stream_init(&calld->read_stream,
&calld->read_slice_buffer, 0);
calld->seen_path_with_query = true;
@@ -277,9 +278,10 @@ static void hs_on_complete(void* user_data, grpc_error* err) {
call_data* calld = static_cast<call_data*>(elem->call_data);
/* Call recv_message_ready if we got the payload via the path field */
if (calld->seen_path_with_query && calld->recv_message_ready != nullptr) {
- *calld->pp_recv_message = calld->payload_bin_delivered
- ? nullptr
- : reinterpret_cast<grpc_byte_stream*>(&calld->read_stream);
+ *calld->pp_recv_message =
+ calld->payload_bin_delivered
+ ? nullptr
+ : reinterpret_cast<grpc_byte_stream*>(&calld->read_stream);
// Re-enter call combiner for recv_message_ready, since the surface
// code will release the call combiner for each callback it receives.
GRPC_CALL_COMBINER_START(calld->call_combiner, calld->recv_message_ready,
diff --git a/src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc b/src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc
index 4255a77ea0..667c0c56ef 100644
--- a/src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc
+++ b/src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc
@@ -41,7 +41,8 @@ static bool maybe_add_server_load_reporting_filter(
grpc_channel_stack_builder* builder, void* arg) {
const grpc_channel_args* args =
grpc_channel_stack_builder_get_channel_arguments(builder);
- const grpc_channel_filter* filter = static_cast<const grpc_channel_filter*>(arg);
+ const grpc_channel_filter* filter =
+ static_cast<const grpc_channel_filter*>(arg);
grpc_channel_stack_builder_iterator* it =
grpc_channel_stack_builder_iterator_find(builder, filter->name);
const bool already_has_load_reporting_filter =
diff --git a/src/core/ext/filters/max_age/max_age_filter.cc b/src/core/ext/filters/max_age/max_age_filter.cc
index ba41e4674b..415a90959d 100644
--- a/src/core/ext/filters/max_age/max_age_filter.cc
+++ b/src/core/ext/filters/max_age/max_age_filter.cc
@@ -285,7 +285,7 @@ static void max_idle_timer_cb(void* arg, grpc_error* error) {
GRPC_CHANNEL_STACK_REF(chand->channel_stack,
"max_age max_idle_timer");
grpc_timer_init(&chand->max_idle_timer,
- static_cast<grpc_millis>gpr_atm_no_barrier_load(
+ static_cast<grpc_millis> gpr_atm_no_barrier_load(
&chand->last_enter_idle_time_millis) +
chand->max_connection_idle,
&chand->max_idle_timer_cb);
@@ -384,7 +384,7 @@ add_random_max_connection_age_jitter_and_convert_to_grpc_millis(int value) {
double result = multiplier * value;
/* INT_MAX - 0.5 converts the value to float, so that result will not be
cast to int implicitly before the comparison. */
- return result > (static_cast<double>GRPC_MILLIS_INF_FUTURE) - 0.5
+ return result > (static_cast<double> GRPC_MILLIS_INF_FUTURE) - 0.5
? GRPC_MILLIS_INF_FUTURE
: static_cast<grpc_millis>(result);
}
diff --git a/src/core/ext/filters/message_size/message_size_filter.cc b/src/core/ext/filters/message_size/message_size_filter.cc
index a2406a24dd..49d9ae60ae 100644
--- a/src/core/ext/filters/message_size/message_size_filter.cc
+++ b/src/core/ext/filters/message_size/message_size_filter.cc
@@ -78,8 +78,8 @@ static void* refcounted_message_size_limits_create_from_json(
}
}
refcounted_message_size_limits* value =
- static_cast<refcounted_message_size_limits*>(gpr_malloc(
- sizeof(refcounted_message_size_limits)));
+ static_cast<refcounted_message_size_limits*>(
+ gpr_malloc(sizeof(refcounted_message_size_limits)));
gpr_ref_init(&value->refs, 1);
value->limits.max_send_size = max_request_message_bytes;
value->limits.max_recv_size = max_response_message_bytes;
@@ -113,7 +113,8 @@ static void recv_message_ready(void* user_data, grpc_error* error) {
grpc_call_element* elem = static_cast<grpc_call_element*>(user_data);
call_data* calld = static_cast<call_data*>(elem->call_data);
if (*calld->recv_message != nullptr && calld->limits.max_recv_size >= 0 &&
- (*calld->recv_message)->length > static_cast<size_t>(calld->limits.max_recv_size)) {
+ (*calld->recv_message)->length >
+ static_cast<size_t>(calld->limits.max_recv_size)) {
char* message_string;
gpr_asprintf(&message_string,
"Received message larger than max (%u vs. %d)",
@@ -183,8 +184,9 @@ static grpc_error* init_call_elem(grpc_call_element* elem,
calld->limits = chand->limits;
if (chand->method_limit_table != nullptr) {
refcounted_message_size_limits* limits =
- static_cast<refcounted_message_size_limits*>(grpc_method_config_table_get(
- chand->method_limit_table, args->path));
+ static_cast<refcounted_message_size_limits*>(
+ grpc_method_config_table_get(chand->method_limit_table,
+ args->path));
if (limits != nullptr) {
if (limits->limits.max_send_size >= 0 &&
(limits->limits.max_send_size < calld->limits.max_send_size ||
diff --git a/src/core/ext/filters/workarounds/workaround_utils.cc b/src/core/ext/filters/workarounds/workaround_utils.cc
index b94c7536d0..850ed75ec9 100644
--- a/src/core/ext/filters/workarounds/workaround_utils.cc
+++ b/src/core/ext/filters/workarounds/workaround_utils.cc
@@ -27,14 +27,14 @@ static void destroy_user_agent_md(void* user_agent_md) {
grpc_workaround_user_agent_md* grpc_parse_user_agent(grpc_mdelem md) {
grpc_workaround_user_agent_md* user_agent_md =
- static_cast<grpc_workaround_user_agent_md*>(grpc_mdelem_get_user_data(
- md, destroy_user_agent_md));
+ static_cast<grpc_workaround_user_agent_md*>(
+ grpc_mdelem_get_user_data(md, destroy_user_agent_md));
if (nullptr != user_agent_md) {
return user_agent_md;
}
- user_agent_md = static_cast<grpc_workaround_user_agent_md*>(gpr_malloc(
- sizeof(grpc_workaround_user_agent_md)));
+ user_agent_md = static_cast<grpc_workaround_user_agent_md*>(
+ gpr_malloc(sizeof(grpc_workaround_user_agent_md)));
for (int i = 0; i < GRPC_MAX_WORKAROUND_ID; i++) {
if (ua_parser[i]) {
user_agent_md->workaround_active[i] = ua_parser[i](md);
diff --git a/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc b/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc
index 322fcb23e1..8c4025ed13 100644
--- a/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc
+++ b/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc
@@ -86,8 +86,8 @@ static grpc_subchannel_args* get_secure_naming_subchannel_args(
if (target_uri->path[0] != '\0') { // "path" may be empty
const grpc_slice key = grpc_slice_from_static_string(
target_uri->path[0] == '/' ? target_uri->path + 1 : target_uri->path);
- const char* value =
- static_cast<const char*>(grpc_slice_hash_table_get(targets_info, key));
+ const char* value = static_cast<const char*>(
+ grpc_slice_hash_table_get(targets_info, key));
if (value != nullptr) target_name_to_check = gpr_strdup(value);
grpc_slice_unref_internal(key);
}
@@ -148,7 +148,8 @@ static grpc_subchannel* client_channel_factory_create_subchannel(
grpc_connector* connector = grpc_chttp2_connector_create();
grpc_subchannel* s = grpc_subchannel_create(connector, subchannel_args);
grpc_connector_unref(connector);
- grpc_channel_args_destroy(const_cast<grpc_channel_args*>(subchannel_args->args));
+ grpc_channel_args_destroy(
+ const_cast<grpc_channel_args*>(subchannel_args->args));
gpr_free(subchannel_args);
return s;
}
diff --git a/src/core/ext/transport/chttp2/server/chttp2_server.cc b/src/core/ext/transport/chttp2/server/chttp2_server.cc
index c1e7946f5f..90b2ee1af9 100644
--- a/src/core/ext/transport/chttp2/server/chttp2_server.cc
+++ b/src/core/ext/transport/chttp2/server/chttp2_server.cc
@@ -79,7 +79,8 @@ static void server_connection_state_unref(
}
static void on_timeout(void* arg, grpc_error* error) {
- server_connection_state* connection_state = static_cast<server_connection_state*>(arg);
+ server_connection_state* connection_state =
+ static_cast<server_connection_state*>(arg);
// Note that we may be called with GRPC_ERROR_NONE when the timer fires
// or with an error indicating that the timer system is being shut down.
if (error != GRPC_ERROR_CANCELLED) {
@@ -92,7 +93,8 @@ static void on_timeout(void* arg, grpc_error* error) {
}
static void on_receive_settings(void* arg, grpc_error* error) {
- server_connection_state* connection_state = static_cast<server_connection_state*>(arg);
+ server_connection_state* connection_state =
+ static_cast<server_connection_state*>(arg);
if (error == GRPC_ERROR_NONE) {
grpc_timer_cancel(&connection_state->timer);
}
@@ -132,7 +134,8 @@ static void on_handshake_done(void* arg, grpc_error* error) {
connection_state->accepting_pollset, args->args);
// Use notify_on_receive_settings callback to enforce the
// handshake deadline.
- connection_state->transport = reinterpret_cast<grpc_chttp2_transport*>(transport);
+ connection_state->transport =
+ reinterpret_cast<grpc_chttp2_transport*>(transport);
gpr_ref(&connection_state->refs);
GRPC_CLOSURE_INIT(&connection_state->on_receive_settings,
on_receive_settings, connection_state,
@@ -177,7 +180,8 @@ static void on_accept(void* arg, grpc_endpoint* tcp,
gpr_mu_unlock(&state->mu);
grpc_tcp_server_ref(state->tcp_server);
server_connection_state* connection_state =
- static_cast<server_connection_state*>(gpr_zalloc(sizeof(*connection_state)));
+ static_cast<server_connection_state*>(
+ gpr_zalloc(sizeof(*connection_state)));
gpr_ref_init(&connection_state->refs, 1);
connection_state->svr_state = state;
connection_state->accepting_pollset = accepting_pollset;
diff --git a/src/core/ext/transport/chttp2/transport/bin_decoder.cc b/src/core/ext/transport/chttp2/transport/bin_decoder.cc
index 0e5e4d0535..91980e6974 100644
--- a/src/core/ext/transport/chttp2/transport/bin_decoder.cc
+++ b/src/core/ext/transport/chttp2/transport/bin_decoder.cc
@@ -192,11 +192,12 @@ grpc_slice grpc_chttp2_base64_decode_with_length(grpc_slice input,
}
if (output_length > input_length / 4 * 3 + tail_xtra[input_length % 4]) {
- gpr_log(GPR_ERROR,
- "Base64 decoding failed, output_length %d is longer "
- "than the max possible output length %d.\n",
- static_cast<int>(output_length),
- static_cast<int>(input_length / 4 * 3 + tail_xtra[input_length % 4]));
+ gpr_log(
+ GPR_ERROR,
+ "Base64 decoding failed, output_length %d is longer "
+ "than the max possible output length %d.\n",
+ static_cast<int>(output_length),
+ static_cast<int>(input_length / 4 * 3 + tail_xtra[input_length % 4]));
grpc_slice_unref_internal(output);
return grpc_empty_slice();
}
diff --git a/src/core/ext/transport/chttp2/transport/bin_encoder.cc b/src/core/ext/transport/chttp2/transport/bin_encoder.cc
index d9c095ede7..e3b8adbe73 100644
--- a/src/core/ext/transport/chttp2/transport/bin_encoder.cc
+++ b/src/core/ext/transport/chttp2/transport/bin_encoder.cc
@@ -53,7 +53,7 @@ grpc_slice grpc_chttp2_base64_encode(grpc_slice input) {
size_t output_length = input_triplets * 4 + tail_xtra[tail_case];
grpc_slice output = GRPC_SLICE_MALLOC(output_length);
uint8_t* in = GRPC_SLICE_START_PTR(input);
- char* out = reinterpret_cast<char*>GRPC_SLICE_START_PTR(output);
+ char* out = reinterpret_cast<char*> GRPC_SLICE_START_PTR(output);
size_t i;
/* encode full triplets */
@@ -124,8 +124,9 @@ grpc_slice grpc_chttp2_huffman_compress(grpc_slice input) {
* expanded form due to the "integral promotion" performed (see section
* 3.2.1.1 of the C89 draft standard). A cast to the smaller container type
* is then required to avoid the compiler warning */
- *out++ = static_cast<uint8_t>(static_cast<uint8_t>(temp << (8u - temp_length)) |
- static_cast<uint8_t>(0xffu >> temp_length));
+ *out++ =
+ static_cast<uint8_t>(static_cast<uint8_t>(temp << (8u - temp_length)) |
+ static_cast<uint8_t>(0xffu >> temp_length));
}
GPR_ASSERT(out == GRPC_SLICE_END_PTR(output));
@@ -151,7 +152,8 @@ static void enc_add2(huff_out* out, uint8_t a, uint8_t b) {
b64_huff_sym sb = huff_alphabet[b];
out->temp = (out->temp << (sa.length + sb.length)) |
(static_cast<uint32_t>(sa.bits) << sb.length) | sb.bits;
- out->temp_length += static_cast<uint32_t>(sa.length) + static_cast<uint32_t>(sb.length);
+ out->temp_length +=
+ static_cast<uint32_t>(sa.length) + static_cast<uint32_t>(sb.length);
enc_flush_some(out);
}
@@ -214,8 +216,9 @@ grpc_slice grpc_chttp2_base64_encode_and_huffman_compress(grpc_slice input) {
* expanded form due to the "integral promotion" performed (see section
* 3.2.1.1 of the C89 draft standard). A cast to the smaller container type
* is then required to avoid the compiler warning */
- *out.out++ = static_cast<uint8_t>(static_cast<uint8_t>(out.temp << (8u - out.temp_length)) |
- static_cast<uint8_t>(0xffu >> out.temp_length));
+ *out.out++ = static_cast<uint8_t>(
+ static_cast<uint8_t>(out.temp << (8u - out.temp_length)) |
+ static_cast<uint8_t>(0xffu >> out.temp_length));
}
GPR_ASSERT(out.out <= GRPC_SLICE_END_PTR(output));
diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
index ec5431bb00..ad8da94cb3 100644
--- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
+++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
@@ -387,8 +387,8 @@ static void init_transport(grpc_chttp2_transport* t,
const int value =
grpc_channel_arg_get_integer(&channel_args->args[i], options);
if (value >= 0) {
- grpc_chttp2_hpack_compressor_set_max_usable_size(&t->hpack_compressor,
- static_cast<uint32_t>(value));
+ grpc_chttp2_hpack_compressor_set_max_usable_size(
+ &t->hpack_compressor, static_cast<uint32_t>(value));
}
} else if (0 == strcmp(channel_args->args[i].key,
GRPC_ARG_HTTP2_MAX_PINGS_WITHOUT_DATA)) {
@@ -421,8 +421,9 @@ static void init_transport(grpc_chttp2_transport* t,
INT_MAX});
} else if (0 == strcmp(channel_args->args[i].key,
GRPC_ARG_HTTP2_WRITE_BUFFER_SIZE)) {
- t->write_buffer_size = static_cast<uint32_t>(grpc_channel_arg_get_integer(
- &channel_args->args[i], {0, 0, MAX_WRITE_BUFFER_SIZE}));
+ t->write_buffer_size =
+ static_cast<uint32_t>(grpc_channel_arg_get_integer(
+ &channel_args->args[i], {0, 0, MAX_WRITE_BUFFER_SIZE}));
} else if (0 ==
strcmp(channel_args->args[i].key, GRPC_ARG_HTTP2_BDP_PROBE)) {
enable_bdp = grpc_channel_arg_get_bool(&channel_args->args[i], true);
@@ -447,9 +448,8 @@ static void init_transport(grpc_chttp2_transport* t,
value == INT_MAX ? GRPC_MILLIS_INF_FUTURE : value;
} else if (0 == strcmp(channel_args->args[i].key,
GRPC_ARG_KEEPALIVE_PERMIT_WITHOUT_CALLS)) {
- t->keepalive_permit_without_calls =
- static_cast<uint32_t>(grpc_channel_arg_get_integer(&channel_args->args[i],
- {0, 0, 1}));
+ t->keepalive_permit_without_calls = static_cast<uint32_t>(
+ grpc_channel_arg_get_integer(&channel_args->args[i], {0, 0, 1}));
} else if (0 == strcmp(channel_args->args[i].key,
GRPC_ARG_OPTIMIZATION_TARGET)) {
if (channel_args->args[i].type != GRPC_ARG_STRING) {
@@ -498,7 +498,7 @@ static void init_transport(grpc_chttp2_transport* t,
GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE,
{-1, 5, INT32_MAX},
{true, true}}};
- for (j = 0; j < static_cast<int>GPR_ARRAY_SIZE(settings_map); j++) {
+ for (j = 0; j < static_cast<int> GPR_ARRAY_SIZE(settings_map); j++) {
if (0 == strcmp(channel_args->args[i].key,
settings_map[j].channel_arg_name)) {
if (!settings_map[j].availability[is_client]) {
@@ -774,7 +774,8 @@ static void destroy_stream(grpc_transport* gt, grpc_stream* gs,
grpc_chttp2_stream* grpc_chttp2_parsing_lookup_stream(grpc_chttp2_transport* t,
uint32_t id) {
- return static_cast<grpc_chttp2_stream*>(grpc_chttp2_stream_map_find(&t->stream_map, id));
+ return static_cast<grpc_chttp2_stream*>(
+ grpc_chttp2_stream_map_find(&t->stream_map, id));
}
grpc_chttp2_stream* grpc_chttp2_parsing_accept_stream(grpc_chttp2_transport* t,
@@ -786,7 +787,8 @@ grpc_chttp2_stream* grpc_chttp2_parsing_accept_stream(grpc_chttp2_transport* t,
GPR_ASSERT(t->accepting_stream == nullptr);
t->accepting_stream = &accepting;
t->channel_callback.accept_stream(t->channel_callback.accept_stream_user_data,
- &t->base, (void*)static_cast<uintptr_t>(id));
+ &t->base,
+ (void*)static_cast<uintptr_t>(id));
t->accepting_stream = nullptr;
return accepting;
}
@@ -1100,7 +1102,7 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
current_keepalive_time_ms > INT_MAX / KEEPALIVE_TIME_BACKOFF_MULTIPLIER
? GRPC_MILLIS_INF_FUTURE
: static_cast<grpc_millis>(current_keepalive_time_ms *
- KEEPALIVE_TIME_BACKOFF_MULTIPLIER);
+ KEEPALIVE_TIME_BACKOFF_MULTIPLIER);
}
/* lie: use transient failure from the transport to indicate goaway has been
@@ -1189,9 +1191,11 @@ void grpc_chttp2_complete_closure_step(grpc_chttp2_transport* t,
"complete_closure_step: t=%p %p refs=%d flags=0x%04x desc=%s err=%s "
"write_state=%s",
t, closure,
- static_cast<int>(closure->next_data.scratch / CLOSURE_BARRIER_FIRST_REF_BIT),
- static_cast<int>(closure->next_data.scratch % CLOSURE_BARRIER_FIRST_REF_BIT), desc,
- errstr, write_state_name(t->write_state));
+ static_cast<int>(closure->next_data.scratch /
+ CLOSURE_BARRIER_FIRST_REF_BIT),
+ static_cast<int>(closure->next_data.scratch %
+ CLOSURE_BARRIER_FIRST_REF_BIT),
+ desc, errstr, write_state_name(t->write_state));
}
if (error != GRPC_ERROR_NONE) {
if (closure->error_data.error == GRPC_ERROR_NONE) {
@@ -1239,7 +1243,7 @@ static void maybe_become_writable_due_to_send_msg(grpc_chttp2_transport* t,
static void add_fetched_slice_locked(grpc_chttp2_transport* t,
grpc_chttp2_stream* s) {
s->fetched_send_message_length +=
- static_cast<uint32_t>GRPC_SLICE_LENGTH(s->fetching_slice);
+ static_cast<uint32_t> GRPC_SLICE_LENGTH(s->fetching_slice);
grpc_slice_buffer_add(&s->flow_controlled_buffer, s->fetching_slice);
maybe_become_writable_due_to_send_msg(t, s);
}
@@ -1329,7 +1333,8 @@ static void perform_stream_op_locked(void* stream_op,
grpc_transport_stream_op_batch* op =
static_cast<grpc_transport_stream_op_batch*>(stream_op);
- grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(op->handler_private.extra_arg);
+ grpc_chttp2_stream* s =
+ static_cast<grpc_chttp2_stream*>(op->handler_private.extra_arg);
grpc_transport_stream_op_batch_payload* op_payload = op->payload;
grpc_chttp2_transport* t = s->t;
@@ -1409,7 +1414,8 @@ static void perform_stream_op_locked(void* stream_op,
"exceeds peer limit"),
GRPC_ERROR_INT_SIZE,
static_cast<intptr_t>(metadata_size)),
- GRPC_ERROR_INT_LIMIT, static_cast<intptr_t>(metadata_peer_limit)),
+ GRPC_ERROR_INT_LIMIT,
+ static_cast<intptr_t>(metadata_peer_limit)),
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_RESOURCE_EXHAUSTED));
} else {
if (contains_non_ok_status(s->send_initial_metadata)) {
@@ -1488,9 +1494,10 @@ static void perform_stream_op_locked(void* stream_op,
frame_hdr[4] = static_cast<uint8_t>(len);
s->fetching_send_message = op_payload->send_message.send_message;
s->fetched_send_message_length = 0;
- s->next_message_end_offset = s->flow_controlled_bytes_written +
- static_cast<int64_t>(s->flow_controlled_buffer.length) +
- static_cast<int64_t>(len);
+ s->next_message_end_offset =
+ s->flow_controlled_bytes_written +
+ static_cast<int64_t>(s->flow_controlled_buffer.length) +
+ static_cast<int64_t>(len);
if (flags & GRPC_WRITE_BUFFER_HINT) {
s->next_message_end_offset -= t->write_buffer_size;
s->write_buffering = true;
@@ -1525,7 +1532,8 @@ static void perform_stream_op_locked(void* stream_op,
"exceeds peer limit"),
GRPC_ERROR_INT_SIZE,
static_cast<intptr_t>(metadata_size)),
- GRPC_ERROR_INT_LIMIT, static_cast<intptr_t>(metadata_peer_limit)),
+ GRPC_ERROR_INT_LIMIT,
+ static_cast<intptr_t>(metadata_peer_limit)),
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_RESOURCE_EXHAUSTED));
} else {
if (contains_non_ok_status(s->send_trailing_metadata)) {
@@ -1690,7 +1698,8 @@ static void send_goaway(grpc_chttp2_transport* t, grpc_error* error) {
grpc_slice slice;
grpc_error_get_status(error, GRPC_MILLIS_INF_FUTURE, nullptr, &slice,
&http_error, nullptr);
- grpc_chttp2_goaway_append(t->last_new_stream_id, static_cast<uint32_t>(http_error),
+ grpc_chttp2_goaway_append(t->last_new_stream_id,
+ static_cast<uint32_t>(http_error),
grpc_slice_ref_internal(slice), &t->qbuf);
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_GOAWAY_SENT);
GRPC_ERROR_UNREF(error);
@@ -1925,8 +1934,8 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_chttp2_transport* t,
static void remove_stream(grpc_chttp2_transport* t, uint32_t id,
grpc_error* error) {
- grpc_chttp2_stream* s =
- static_cast<grpc_chttp2_stream*>(grpc_chttp2_stream_map_delete(&t->stream_map, id));
+ grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(
+ grpc_chttp2_stream_map_delete(&t->stream_map, id));
GPR_ASSERT(s);
if (t->incoming_stream == s) {
t->incoming_stream = nullptr;
@@ -1978,8 +1987,9 @@ void grpc_chttp2_cancel_stream(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
grpc_error_get_status(due_to_error, s->deadline, nullptr, nullptr,
&http_error, nullptr);
grpc_slice_buffer_add(
- &t->qbuf, grpc_chttp2_rst_stream_create(s->id, static_cast<uint32_t>(http_error),
- &s->stats.outgoing));
+ &t->qbuf,
+ grpc_chttp2_rst_stream_create(
+ s->id, static_cast<uint32_t>(http_error), &s->stats.outgoing));
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_RST_STREAM);
}
}
@@ -2180,7 +2190,7 @@ static void close_from_api(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
*p++ = '0';
*p++ = '0';
GPR_ASSERT(p == GRPC_SLICE_END_PTR(http_status_hdr));
- len += static_cast<uint32_t>GRPC_SLICE_LENGTH(http_status_hdr);
+ len += static_cast<uint32_t> GRPC_SLICE_LENGTH(http_status_hdr);
content_type_hdr = GRPC_SLICE_MALLOC(31);
p = GRPC_SLICE_START_PTR(content_type_hdr);
@@ -2216,7 +2226,7 @@ static void close_from_api(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
*p++ = 'p';
*p++ = 'c';
GPR_ASSERT(p == GRPC_SLICE_END_PTR(content_type_hdr));
- len += static_cast<uint32_t>GRPC_SLICE_LENGTH(content_type_hdr);
+ len += static_cast<uint32_t> GRPC_SLICE_LENGTH(content_type_hdr);
}
status_hdr = GRPC_SLICE_MALLOC(15 + (grpc_status >= 10));
@@ -2243,7 +2253,7 @@ static void close_from_api(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
*p++ = static_cast<uint8_t>('0' + (grpc_status % 10));
}
GPR_ASSERT(p == GRPC_SLICE_END_PTR(status_hdr));
- len += static_cast<uint32_t>GRPC_SLICE_LENGTH(status_hdr);
+ len += static_cast<uint32_t> GRPC_SLICE_LENGTH(status_hdr);
size_t msg_len = GRPC_SLICE_LENGTH(slice);
GPR_ASSERT(msg_len <= UINT32_MAX);
@@ -2267,7 +2277,7 @@ static void close_from_api(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
GRPC_CHTTP2_WRITE_VARINT((uint32_t)msg_len, 1, 0, p, (uint32_t)msg_len_len);
p += msg_len_len;
GPR_ASSERT(p == GRPC_SLICE_END_PTR(message_pfx));
- len += static_cast<uint32_t>GRPC_SLICE_LENGTH(message_pfx);
+ len += static_cast<uint32_t> GRPC_SLICE_LENGTH(message_pfx);
len += static_cast<uint32_t>(msg_len);
hdr = GRPC_SLICE_MALLOC(9);
@@ -2411,7 +2421,7 @@ static void read_action_locked(void* tp, grpc_error* error) {
grpc_core::BdpEstimator* bdp_est = t->flow_control->bdp_estimator();
if (bdp_est) {
bdp_est->AddIncomingBytes(
- static_cast<int64_t>GRPC_SLICE_LENGTH(t->read_buffer.slices[i]));
+ static_cast<int64_t> GRPC_SLICE_LENGTH(t->read_buffer.slices[i]));
}
errors[1] = grpc_chttp2_perform_read(t, t->read_buffer.slices[i]);
}
@@ -2876,7 +2886,7 @@ grpc_error* grpc_chttp2_incoming_byte_stream_push(
grpc_slice_unref_internal(slice);
return error;
} else {
- bs->remaining_bytes -= static_cast<uint32_t>GRPC_SLICE_LENGTH(slice);
+ bs->remaining_bytes -= static_cast<uint32_t> GRPC_SLICE_LENGTH(slice);
if (slice_out != nullptr) {
*slice_out = slice;
}
@@ -2931,8 +2941,8 @@ grpc_chttp2_incoming_byte_stream* grpc_chttp2_incoming_byte_stream_create(
grpc_chttp2_transport* t, grpc_chttp2_stream* s, uint32_t frame_size,
uint32_t flags) {
grpc_chttp2_incoming_byte_stream* incoming_byte_stream =
- static_cast<grpc_chttp2_incoming_byte_stream*>(gpr_malloc(
- sizeof(*incoming_byte_stream)));
+ static_cast<grpc_chttp2_incoming_byte_stream*>(
+ gpr_malloc(sizeof(*incoming_byte_stream)));
incoming_byte_stream->base.length = frame_size;
incoming_byte_stream->remaining_bytes = frame_size;
incoming_byte_stream->base.flags = flags;
@@ -3000,8 +3010,8 @@ static void destructive_reclaimer_locked(void* arg, grpc_error* error) {
size_t n = grpc_chttp2_stream_map_size(&t->stream_map);
t->destructive_reclaimer_registered = false;
if (error == GRPC_ERROR_NONE && n > 0) {
- grpc_chttp2_stream* s =
- static_cast<grpc_chttp2_stream*>(grpc_chttp2_stream_map_rand(&t->stream_map));
+ grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(
+ grpc_chttp2_stream_map_rand(&t->stream_map));
if (grpc_resource_quota_trace.enabled()) {
gpr_log(GPR_DEBUG, "HTTP2: %s - abandon stream id %d", t->peer_string,
s->id);
@@ -3096,8 +3106,8 @@ static const grpc_transport_vtable* get_vtable(void) { return &vtable; }
grpc_transport* grpc_create_chttp2_transport(
const grpc_channel_args* channel_args, grpc_endpoint* ep, bool is_client) {
- grpc_chttp2_transport* t =
- static_cast<grpc_chttp2_transport*>(gpr_zalloc(sizeof(grpc_chttp2_transport)));
+ grpc_chttp2_transport* t = static_cast<grpc_chttp2_transport*>(
+ gpr_zalloc(sizeof(grpc_chttp2_transport)));
init_transport(t, channel_args, ep, is_client);
return &t->base;
}
@@ -3105,7 +3115,8 @@ grpc_transport* grpc_create_chttp2_transport(
void grpc_chttp2_transport_start_reading(
grpc_transport* transport, grpc_slice_buffer* read_buffer,
grpc_closure* notify_on_receive_settings) {
- grpc_chttp2_transport* t = reinterpret_cast<grpc_chttp2_transport*>(transport);
+ grpc_chttp2_transport* t =
+ reinterpret_cast<grpc_chttp2_transport*>(transport);
GRPC_CHTTP2_REF_TRANSPORT(
t, "reading_action"); /* matches unref inside reading_action */
if (read_buffer != nullptr) {
diff --git a/src/core/ext/transport/chttp2/transport/flow_control.cc b/src/core/ext/transport/chttp2/transport/flow_control.cc
index e9014d8234..45b6f97b05 100644
--- a/src/core/ext/transport/chttp2/transport/flow_control.cc
+++ b/src/core/ext/transport/chttp2/transport/flow_control.cc
@@ -184,10 +184,11 @@ TransportFlowControl::TransportFlowControl(const grpc_chttp2_transport* t,
uint32_t TransportFlowControl::MaybeSendUpdate(bool writing_anyway) {
FlowControlTrace trace("t updt sent", this, nullptr);
- const uint32_t target_announced_window = static_cast<const uint32_t>(target_window());
+ const uint32_t target_announced_window =
+ static_cast<const uint32_t>(target_window());
if ((writing_anyway || announced_window_ <= target_announced_window / 2) &&
announced_window_ != target_announced_window) {
- const uint32_t announce = static_cast<uint32_t>GPR_CLAMP(
+ const uint32_t announce = static_cast<uint32_t> GPR_CLAMP(
target_announced_window - announced_window_, 0, UINT32_MAX);
announced_window_ += announce;
return announce;
@@ -261,7 +262,7 @@ grpc_error* StreamFlowControl::RecvData(int64_t incoming_frame_size) {
uint32_t StreamFlowControl::MaybeSendUpdate() {
FlowControlTrace trace("s updt sent", tfc_, this);
if (local_window_delta_ > announced_window_delta_) {
- uint32_t announce = static_cast<uint32_t>GPR_CLAMP(
+ uint32_t announce = static_cast<uint32_t> GPR_CLAMP(
local_window_delta_ - announced_window_delta_, 0, UINT32_MAX);
UpdateAnnouncedWindowDelta(tfc_, announce);
return announce;
@@ -337,8 +338,8 @@ double TransportFlowControl::SmoothLogBdp(double value) {
FlowControlAction::Urgency TransportFlowControl::DeltaUrgency(
int64_t value, grpc_chttp2_setting_id setting_id) {
- int64_t delta =
- value - static_cast<int64_t>(t_->settings[GRPC_LOCAL_SETTINGS][setting_id]);
+ int64_t delta = value - static_cast<int64_t>(
+ t_->settings[GRPC_LOCAL_SETTINGS][setting_id]);
// TODO(ncteisen): tune this
if (delta != 0 && (delta <= -value / 5 || delta >= value / 5)) {
return FlowControlAction::Urgency::QUEUE_UPDATE;
@@ -357,7 +358,8 @@ FlowControlAction TransportFlowControl::PeriodicUpdate() {
const double target = pow(2, SmoothLogBdp(TargetLogBdp()));
// Though initial window 'could' drop to 0, we keep the floor at 128
- target_initial_window_size_ = static_cast<int32_t>GPR_CLAMP(target, 128, INT32_MAX);
+ target_initial_window_size_ =
+ static_cast<int32_t> GPR_CLAMP(target, 128, INT32_MAX);
action.set_send_initial_window_update(
DeltaUrgency(target_initial_window_size_,
@@ -367,12 +369,13 @@ FlowControlAction TransportFlowControl::PeriodicUpdate() {
// get bandwidth estimate and update max_frame accordingly.
double bw_dbl = bdp_estimator_.EstimateBandwidth();
// we target the max of BDP or bandwidth in microseconds.
- int32_t frame_size = static_cast<int32_t>GPR_CLAMP(
+ int32_t frame_size = static_cast<int32_t> GPR_CLAMP(
GPR_MAX((int32_t)GPR_CLAMP(bw_dbl, 0, INT_MAX) / 1000,
target_initial_window_size_),
16384, 16777215);
action.set_send_max_frame_size_update(
- DeltaUrgency(static_cast<int64_t>(frame_size), GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE),
+ DeltaUrgency(static_cast<int64_t>(frame_size),
+ GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE),
frame_size);
}
return UpdateAction(action);
diff --git a/src/core/ext/transport/chttp2/transport/flow_control.h b/src/core/ext/transport/chttp2/transport/flow_control.h
index 7800a55d40..b58027790d 100644
--- a/src/core/ext/transport/chttp2/transport/flow_control.h
+++ b/src/core/ext/transport/chttp2/transport/flow_control.h
@@ -271,9 +271,10 @@ class TransportFlowControl final : public TransportFlowControlBase {
// See comment above announced_stream_total_over_incoming_window_ for the
// logic behind this decision.
int64_t target_window() const override {
- return static_cast<uint32_t>GPR_MIN((int64_t)((1u << 31) - 1),
- announced_stream_total_over_incoming_window_ +
- target_initial_window_size_);
+ return static_cast<uint32_t> GPR_MIN(
+ (int64_t)((1u << 31) - 1),
+ announced_stream_total_over_incoming_window_ +
+ target_initial_window_size_);
}
const grpc_chttp2_transport* transport() const { return t_; }
diff --git a/src/core/ext/transport/chttp2/transport/frame_data.cc b/src/core/ext/transport/chttp2/transport/frame_data.cc
index dd4830cc17..721f0a55a1 100644
--- a/src/core/ext/transport/chttp2/transport/frame_data.cc
+++ b/src/core/ext/transport/chttp2/transport/frame_data.cc
@@ -51,9 +51,9 @@ grpc_error* grpc_chttp2_data_parser_begin_frame(grpc_chttp2_data_parser* parser,
if (flags & ~GRPC_CHTTP2_DATA_FLAG_END_STREAM) {
char* msg;
gpr_asprintf(&msg, "unsupported data flags: 0x%02x", flags);
- grpc_error* err =
- grpc_error_set_int(GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg),
- GRPC_ERROR_INT_STREAM_ID, static_cast<intptr_t>(stream_id));
+ grpc_error* err = grpc_error_set_int(
+ GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg), GRPC_ERROR_INT_STREAM_ID,
+ static_cast<intptr_t>(stream_id));
gpr_free(msg);
return err;
}
@@ -208,8 +208,8 @@ grpc_error* grpc_deframe_unprocessed_incoming_frames(
if (cur != end) {
grpc_slice_buffer_undo_take_first(
- slices,
- grpc_slice_sub(slice, static_cast<size_t>(cur - beg), static_cast<size_t>(end - beg)));
+ slices, grpc_slice_sub(slice, static_cast<size_t>(cur - beg),
+ static_cast<size_t>(end - beg)));
}
grpc_slice_unref_internal(slice);
return GRPC_ERROR_NONE;
@@ -223,11 +223,12 @@ grpc_error* grpc_deframe_unprocessed_incoming_frames(
uint32_t remaining = static_cast<uint32_t>(end - cur);
if (remaining == p->frame_size) {
s->stats.incoming.data_bytes += remaining;
- if (GRPC_ERROR_NONE != (error = grpc_chttp2_incoming_byte_stream_push(
- p->parsing_frame,
- grpc_slice_sub(slice, static_cast<size_t>(cur - beg),
- static_cast<size_t>(end - beg)),
- slice_out))) {
+ if (GRPC_ERROR_NONE !=
+ (error = grpc_chttp2_incoming_byte_stream_push(
+ p->parsing_frame,
+ grpc_slice_sub(slice, static_cast<size_t>(cur - beg),
+ static_cast<size_t>(end - beg)),
+ slice_out))) {
grpc_slice_unref_internal(slice);
return error;
}
@@ -243,11 +244,12 @@ grpc_error* grpc_deframe_unprocessed_incoming_frames(
return GRPC_ERROR_NONE;
} else if (remaining < p->frame_size) {
s->stats.incoming.data_bytes += remaining;
- if (GRPC_ERROR_NONE != (error = grpc_chttp2_incoming_byte_stream_push(
- p->parsing_frame,
- grpc_slice_sub(slice, static_cast<size_t>(cur - beg),
- static_cast<size_t>(end - beg)),
- slice_out))) {
+ if (GRPC_ERROR_NONE !=
+ (error = grpc_chttp2_incoming_byte_stream_push(
+ p->parsing_frame,
+ grpc_slice_sub(slice, static_cast<size_t>(cur - beg),
+ static_cast<size_t>(end - beg)),
+ slice_out))) {
return error;
}
p->frame_size -= remaining;
@@ -259,8 +261,9 @@ grpc_error* grpc_deframe_unprocessed_incoming_frames(
if (GRPC_ERROR_NONE !=
(grpc_chttp2_incoming_byte_stream_push(
p->parsing_frame,
- grpc_slice_sub(slice, static_cast<size_t>(cur - beg),
- static_cast<size_t>(cur + p->frame_size - beg)),
+ grpc_slice_sub(
+ slice, static_cast<size_t>(cur - beg),
+ static_cast<size_t>(cur + p->frame_size - beg)),
slice_out))) {
grpc_slice_unref_internal(slice);
return error;
@@ -275,8 +278,8 @@ grpc_error* grpc_deframe_unprocessed_incoming_frames(
p->state = GRPC_CHTTP2_DATA_FH_0;
cur += p->frame_size;
grpc_slice_buffer_undo_take_first(
- slices,
- grpc_slice_sub(slice, static_cast<size_t>(cur - beg), static_cast<size_t>(end - beg)));
+ slices, grpc_slice_sub(slice, static_cast<size_t>(cur - beg),
+ static_cast<size_t>(end - beg)));
grpc_slice_unref_internal(slice);
return GRPC_ERROR_NONE;
}
diff --git a/src/core/ext/transport/chttp2/transport/frame_goaway.cc b/src/core/ext/transport/chttp2/transport/frame_goaway.cc
index d712bc657e..70931ed22d 100644
--- a/src/core/ext/transport/chttp2/transport/frame_goaway.cc
+++ b/src/core/ext/transport/chttp2/transport/frame_goaway.cc
@@ -59,7 +59,8 @@ grpc_error* grpc_chttp2_goaway_parser_parse(void* parser,
uint8_t* const beg = GRPC_SLICE_START_PTR(slice);
uint8_t* const end = GRPC_SLICE_END_PTR(slice);
uint8_t* cur = beg;
- grpc_chttp2_goaway_parser* p = static_cast<grpc_chttp2_goaway_parser*>(parser);
+ grpc_chttp2_goaway_parser* p =
+ static_cast<grpc_chttp2_goaway_parser*>(parser);
switch (p->state) {
case GRPC_CHTTP2_GOAWAY_LSI0:
@@ -128,7 +129,8 @@ grpc_error* grpc_chttp2_goaway_parser_parse(void* parser,
/* fallthrough */
case GRPC_CHTTP2_GOAWAY_DEBUG:
if (end != cur)
- memcpy(p->debug_data + p->debug_pos, cur, static_cast<size_t>(end - cur));
+ memcpy(p->debug_data + p->debug_pos, cur,
+ static_cast<size_t>(end - cur));
GPR_ASSERT((size_t)(end - cur) < UINT32_MAX - p->debug_pos);
p->debug_pos += static_cast<uint32_t>(end - cur);
p->state = GRPC_CHTTP2_GOAWAY_DEBUG;
@@ -151,7 +153,7 @@ void grpc_chttp2_goaway_append(uint32_t last_stream_id, uint32_t error_code,
uint8_t* p = GRPC_SLICE_START_PTR(header);
uint32_t frame_length;
GPR_ASSERT(GRPC_SLICE_LENGTH(debug_data) < UINT32_MAX - 4 - 4);
- frame_length = 4 + 4 + static_cast<uint32_t>GRPC_SLICE_LENGTH(debug_data);
+ frame_length = 4 + 4 + static_cast<uint32_t> GRPC_SLICE_LENGTH(debug_data);
/* frame header: length */
*p++ = static_cast<uint8_t>(frame_length >> 16);
diff --git a/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc b/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc
index 0b2bc4baed..79528762e0 100644
--- a/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc
+++ b/src/core/ext/transport/chttp2/transport/frame_rst_stream.cc
@@ -76,7 +76,8 @@ grpc_error* grpc_chttp2_rst_stream_parser_parse(void* parser,
uint8_t* const beg = GRPC_SLICE_START_PTR(slice);
uint8_t* const end = GRPC_SLICE_END_PTR(slice);
uint8_t* cur = beg;
- grpc_chttp2_rst_stream_parser* p = static_cast<grpc_chttp2_rst_stream_parser*>(parser);
+ grpc_chttp2_rst_stream_parser* p =
+ static_cast<grpc_chttp2_rst_stream_parser*>(parser);
while (p->byte != 4 && cur != end) {
p->reason_bytes[p->byte] = *cur;
diff --git a/src/core/ext/transport/chttp2/transport/frame_settings.cc b/src/core/ext/transport/chttp2/transport/frame_settings.cc
index 2501ad9397..737a9382e0 100644
--- a/src/core/ext/transport/chttp2/transport/frame_settings.cc
+++ b/src/core/ext/transport/chttp2/transport/frame_settings.cc
@@ -110,7 +110,8 @@ grpc_error* grpc_chttp2_settings_parser_begin_frame(
grpc_error* grpc_chttp2_settings_parser_parse(void* p, grpc_chttp2_transport* t,
grpc_chttp2_stream* s,
grpc_slice slice, int is_last) {
- grpc_chttp2_settings_parser* parser = static_cast<grpc_chttp2_settings_parser*>(p);
+ grpc_chttp2_settings_parser* parser =
+ static_cast<grpc_chttp2_settings_parser*>(p);
const uint8_t* cur = GRPC_SLICE_START_PTR(slice);
const uint8_t* end = GRPC_SLICE_END_PTR(slice);
char* msg;
@@ -211,8 +212,8 @@ grpc_error* grpc_chttp2_settings_parser_parse(void* p, grpc_chttp2_transport* t,
}
if (id == GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE &&
parser->incoming_settings[id] != parser->value) {
- t->initial_window_update +=
- static_cast<int64_t>(parser->value) - parser->incoming_settings[id];
+ t->initial_window_update += static_cast<int64_t>(parser->value) -
+ parser->incoming_settings[id];
if (grpc_http_trace.enabled() || grpc_flowctl_trace.enabled()) {
gpr_log(GPR_DEBUG, "%p[%s] adding %d for initial_window change",
t, t->is_client ? "cli" : "svr",
diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc
index dc0e475aa1..4855455130 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc
+++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc
@@ -98,8 +98,9 @@ static void finish_frame(framer_state* st, int is_header_boundary,
fill_header(
GRPC_SLICE_START_PTR(st->output->slices[st->header_idx]), type,
st->stream_id, st->output->length - st->output_length_at_start_of_frame,
- static_cast<uint8_t>((is_last_in_stream ? GRPC_CHTTP2_DATA_FLAG_END_STREAM : 0) |
- (is_header_boundary ? GRPC_CHTTP2_DATA_FLAG_END_HEADERS : 0)));
+ static_cast<uint8_t>(
+ (is_last_in_stream ? GRPC_CHTTP2_DATA_FLAG_END_STREAM : 0) |
+ (is_header_boundary ? GRPC_CHTTP2_DATA_FLAG_END_HEADERS : 0)));
st->stats->framing_bytes += 9;
st->is_first_frame = 0;
}
@@ -169,9 +170,9 @@ static void evict_entry(grpc_chttp2_hpack_compressor* c) {
GPR_ASSERT(c->table_size >=
c->table_elem_size[c->tail_remote_index % c->cap_table_elems]);
GPR_ASSERT(c->table_elems > 0);
- c->table_size =
- static_cast<uint16_t>(c->table_size -
- c->table_elem_size[c->tail_remote_index % c->cap_table_elems]);
+ c->table_size = static_cast<uint16_t>(
+ c->table_size -
+ c->table_elem_size[c->tail_remote_index % c->cap_table_elems]);
c->table_elems--;
}
@@ -197,7 +198,8 @@ static uint32_t prepare_space_for_new_elem(grpc_chttp2_hpack_compressor* c,
evict_entry(c);
}
GPR_ASSERT(c->table_elems < c->max_table_size);
- c->table_elem_size[new_index % c->cap_table_elems] = static_cast<uint16_t>(elem_size);
+ c->table_elem_size[new_index % c->cap_table_elems] =
+ static_cast<uint16_t>(elem_size);
c->table_size = static_cast<uint16_t>(c->table_size + elem_size);
c->table_elems++;
@@ -394,7 +396,7 @@ static void emit_lithdr_incidx_v(grpc_chttp2_hpack_compressor* c,
GPR_ASSERT(unused_index == 0);
GRPC_STATS_INC_HPACK_SEND_LITHDR_INCIDX_V();
GRPC_STATS_INC_HPACK_SEND_UNCOMPRESSED();
- uint32_t len_key = static_cast<uint32_t>GRPC_SLICE_LENGTH(GRPC_MDKEY(elem));
+ uint32_t len_key = static_cast<uint32_t> GRPC_SLICE_LENGTH(GRPC_MDKEY(elem));
wire_value value = get_wire_value(elem, st->use_true_binary_metadata);
uint32_t len_val = static_cast<uint32_t>(wire_value_length(value));
uint32_t len_key_len = GRPC_CHTTP2_VARINT_LENGTH(len_key, 1);
@@ -416,7 +418,7 @@ static void emit_lithdr_noidx_v(grpc_chttp2_hpack_compressor* c,
GPR_ASSERT(unused_index == 0);
GRPC_STATS_INC_HPACK_SEND_LITHDR_NOTIDX_V();
GRPC_STATS_INC_HPACK_SEND_UNCOMPRESSED();
- uint32_t len_key = static_cast<uint32_t>GRPC_SLICE_LENGTH(GRPC_MDKEY(elem));
+ uint32_t len_key = static_cast<uint32_t> GRPC_SLICE_LENGTH(GRPC_MDKEY(elem));
wire_value value = get_wire_value(elem, st->use_true_binary_metadata);
uint32_t len_val = static_cast<uint32_t>(wire_value_length(value));
uint32_t len_key_len = GRPC_CHTTP2_VARINT_LENGTH(len_key, 1);
@@ -583,8 +585,8 @@ void grpc_chttp2_hpack_compressor_init(grpc_chttp2_hpack_compressor* c) {
c->cap_table_elems = elems_for_bytes(c->max_table_size);
c->max_table_elems = c->cap_table_elems;
c->max_usable_size = GRPC_CHTTP2_HPACKC_INITIAL_TABLE_SIZE;
- c->table_elem_size =
- static_cast<uint16_t*>(gpr_malloc(sizeof(*c->table_elem_size) * c->cap_table_elems));
+ c->table_elem_size = static_cast<uint16_t*>(
+ gpr_malloc(sizeof(*c->table_elem_size) * c->cap_table_elems));
memset(c->table_elem_size, 0,
sizeof(*c->table_elem_size) * c->cap_table_elems);
for (size_t i = 0; i < GPR_ARRAY_SIZE(c->entries_keys); i++) {
diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.cc b/src/core/ext/transport/chttp2/transport/hpack_parser.cc
index 4b512b6439..26a38e3f87 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_parser.cc
+++ b/src/core/ext/transport/chttp2/transport/hpack_parser.cc
@@ -757,7 +757,8 @@ static grpc_error* finish_indexed_field(grpc_chttp2_hpack_parser* p,
return grpc_error_set_int(
grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"Invalid HPACK index received"),
- GRPC_ERROR_INT_INDEX, static_cast<intptr_t>(p->index)),
+ GRPC_ERROR_INT_INDEX,
+ static_cast<intptr_t>(p->index)),
GRPC_ERROR_INT_SIZE, static_cast<intptr_t>(p->table.num_ents));
}
GRPC_MDELEM_REF(md);
@@ -1227,9 +1228,10 @@ static void append_bytes(grpc_chttp2_hpack_parser_string* str,
if (length == 0) return;
if (length + str->data.copied.length > str->data.copied.capacity) {
GPR_ASSERT(str->data.copied.length + length <= UINT32_MAX);
- str->data.copied.capacity = static_cast<uint32_t>(str->data.copied.length + length);
- str->data.copied.str =
- static_cast<char*>(gpr_realloc(str->data.copied.str, str->data.copied.capacity));
+ str->data.copied.capacity =
+ static_cast<uint32_t>(str->data.copied.length + length);
+ str->data.copied.str = static_cast<char*>(
+ gpr_realloc(str->data.copied.str, str->data.copied.capacity));
}
memcpy(str->data.copied.str + str->data.copied.length, data, length);
GPR_ASSERT(length <= UINT32_MAX - str->data.copied.length);
@@ -1448,7 +1450,8 @@ static grpc_error* begin_parse_string(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end,
uint8_t binary,
grpc_chttp2_hpack_parser_string* str) {
- if (!p->huff && binary == NOT_BINARY && (end - cur) >= static_cast<intptr_t>(p->strlen) &&
+ if (!p->huff && binary == NOT_BINARY &&
+ (end - cur) >= static_cast<intptr_t>(p->strlen) &&
p->current_slice_refcount != nullptr) {
GRPC_STATS_INC_HPACK_RECV_UNCOMPRESSED();
str->copied = false;
@@ -1503,7 +1506,8 @@ static grpc_error* is_binary_indexed_header(grpc_chttp2_hpack_parser* p,
return grpc_error_set_int(
grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"Invalid HPACK index received"),
- GRPC_ERROR_INT_INDEX, static_cast<intptr_t>(p->index)),
+ GRPC_ERROR_INT_INDEX,
+ static_cast<intptr_t>(p->index)),
GRPC_ERROR_INT_SIZE, static_cast<intptr_t>(p->table.num_ents));
}
*is = grpc_is_binary_header(GRPC_MDKEY(elem));
@@ -1618,7 +1622,8 @@ grpc_error* grpc_chttp2_header_parser_parse(void* hpack_parser,
grpc_chttp2_stream* s,
grpc_slice slice, int is_last) {
GPR_TIMER_SCOPE("grpc_chttp2_hpack_parser_parse", 0);
- grpc_chttp2_hpack_parser* parser = static_cast<grpc_chttp2_hpack_parser*>(hpack_parser);
+ grpc_chttp2_hpack_parser* parser =
+ static_cast<grpc_chttp2_hpack_parser*>(hpack_parser);
if (s != nullptr) {
s->stats.incoming.header_bytes += GRPC_SLICE_LENGTH(slice);
}
diff --git a/src/core/ext/transport/chttp2/transport/hpack_table.cc b/src/core/ext/transport/chttp2/transport/hpack_table.cc
index e8c44e35ab..d7cabbde04 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_table.cc
+++ b/src/core/ext/transport/chttp2/transport/hpack_table.cc
@@ -173,7 +173,8 @@ void grpc_chttp2_hptbl_init(grpc_chttp2_hptbl* tbl) {
GRPC_CHTTP2_INITIAL_HPACK_TABLE_SIZE;
tbl->max_entries = tbl->cap_entries =
entries_for_bytes(tbl->current_table_bytes);
- tbl->ents = static_cast<grpc_mdelem*>(gpr_malloc(sizeof(*tbl->ents) * tbl->cap_entries));
+ tbl->ents = static_cast<grpc_mdelem*>(
+ gpr_malloc(sizeof(*tbl->ents) * tbl->cap_entries));
memset(tbl->ents, 0, sizeof(*tbl->ents) * tbl->cap_entries);
for (i = 1; i <= GRPC_CHTTP2_LAST_STATIC_ENTRY; i++) {
tbl->static_ents[i - 1] = grpc_mdelem_from_slices(
@@ -225,7 +226,8 @@ static void evict1(grpc_chttp2_hptbl* tbl) {
}
static void rebuild_ents(grpc_chttp2_hptbl* tbl, uint32_t new_cap) {
- grpc_mdelem* ents = static_cast<grpc_mdelem*>(gpr_malloc(sizeof(*ents) * new_cap));
+ grpc_mdelem* ents =
+ static_cast<grpc_mdelem*>(gpr_malloc(sizeof(*ents) * new_cap));
uint32_t i;
for (i = 0; i < tbl->num_ents; i++) {
@@ -320,7 +322,8 @@ grpc_error* grpc_chttp2_hptbl_add(grpc_chttp2_hptbl* tbl, grpc_mdelem md) {
}
/* evict entries to ensure no overflow */
- while (elem_bytes > static_cast<size_t>(tbl->current_table_bytes) - tbl->mem_used) {
+ while (elem_bytes >
+ static_cast<size_t>(tbl->current_table_bytes) - tbl->mem_used) {
evict1(tbl);
}
@@ -350,8 +353,8 @@ grpc_chttp2_hptbl_find_result grpc_chttp2_hptbl_find(
/* Scan the dynamic table */
for (i = 0; i < tbl->num_ents; i++) {
- uint32_t idx =
- static_cast<uint32_t>(tbl->num_ents - i + GRPC_CHTTP2_LAST_STATIC_ENTRY);
+ uint32_t idx = static_cast<uint32_t>(tbl->num_ents - i +
+ GRPC_CHTTP2_LAST_STATIC_ENTRY);
grpc_mdelem ent = tbl->ents[(tbl->first_ent + i) % tbl->cap_entries];
if (!grpc_slice_eq(GRPC_MDKEY(md), GRPC_MDKEY(ent))) continue;
r.index = idx;
diff --git a/src/core/ext/transport/chttp2/transport/incoming_metadata.cc b/src/core/ext/transport/chttp2/transport/incoming_metadata.cc
index 2d06bb5038..18d89f06d8 100644
--- a/src/core/ext/transport/chttp2/transport/incoming_metadata.cc
+++ b/src/core/ext/transport/chttp2/transport/incoming_metadata.cc
@@ -42,8 +42,8 @@ grpc_error* grpc_chttp2_incoming_metadata_buffer_add(
buffer->size += GRPC_MDELEM_LENGTH(elem);
return grpc_metadata_batch_add_tail(
&buffer->batch,
- static_cast<grpc_linked_mdelem*>(gpr_arena_alloc(buffer->arena,
- sizeof(grpc_linked_mdelem))),
+ static_cast<grpc_linked_mdelem*>(
+ gpr_arena_alloc(buffer->arena, sizeof(grpc_linked_mdelem))),
elem);
}
diff --git a/src/core/ext/transport/chttp2/transport/parsing.cc b/src/core/ext/transport/chttp2/transport/parsing.cc
index d720397de5..9357fedb5c 100644
--- a/src/core/ext/transport/chttp2/transport/parsing.cc
+++ b/src/core/ext/transport/chttp2/transport/parsing.cc
@@ -88,15 +88,16 @@ grpc_error* grpc_chttp2_perform_read(grpc_chttp2_transport* t,
"Connect string mismatch: expected '%c' (%d) got '%c' (%d) "
"at byte %d",
GRPC_CHTTP2_CLIENT_CONNECT_STRING[t->deframe_state],
- static_cast<int>(static_cast<uint8_t>(GRPC_CHTTP2_CLIENT_CONNECT_STRING[t->deframe_state])),
+ static_cast<int>(static_cast<uint8_t>(
+ GRPC_CHTTP2_CLIENT_CONNECT_STRING[t->deframe_state])),
*cur, static_cast<int>(*cur), t->deframe_state);
err = GRPC_ERROR_CREATE_FROM_COPIED_STRING(msg);
gpr_free(msg);
return err;
}
++cur;
- t->deframe_state =
- static_cast<grpc_chttp2_deframe_transport_state>(1 + static_cast<int>(t->deframe_state));
+ t->deframe_state = static_cast<grpc_chttp2_deframe_transport_state>(
+ 1 + static_cast<int>(t->deframe_state));
}
if (cur == end) {
return GRPC_ERROR_NONE;
@@ -206,11 +207,11 @@ grpc_error* grpc_chttp2_perform_read(grpc_chttp2_transport* t,
case GRPC_DTS_FRAME:
GPR_ASSERT(cur < end);
if (static_cast<uint32_t>(end - cur) == t->incoming_frame_size) {
- err =
- parse_frame_slice(t,
- grpc_slice_sub_no_ref(slice, static_cast<size_t>(cur - beg),
- static_cast<size_t>(end - beg)),
- 1);
+ err = parse_frame_slice(
+ t,
+ grpc_slice_sub_no_ref(slice, static_cast<size_t>(cur - beg),
+ static_cast<size_t>(end - beg)),
+ 1);
if (err != GRPC_ERROR_NONE) {
return err;
}
@@ -231,11 +232,11 @@ grpc_error* grpc_chttp2_perform_read(grpc_chttp2_transport* t,
t->incoming_stream = nullptr;
goto dts_fh_0; /* loop */
} else {
- err =
- parse_frame_slice(t,
- grpc_slice_sub_no_ref(slice, static_cast<size_t>(cur - beg),
- static_cast<size_t>(end - beg)),
- 0);
+ err = parse_frame_slice(
+ t,
+ grpc_slice_sub_no_ref(slice, static_cast<size_t>(cur - beg),
+ static_cast<size_t>(end - beg)),
+ 0);
if (err != GRPC_ERROR_NONE) {
return err;
}
@@ -429,7 +430,8 @@ static void on_initial_header(void* tp, grpc_mdelem md) {
}
if (GRPC_MDELEM_IS_INTERNED(md)) {
/* store the result */
- cached_timeout = static_cast<grpc_millis*>(gpr_malloc(sizeof(grpc_millis)));
+ cached_timeout =
+ static_cast<grpc_millis*>(gpr_malloc(sizeof(grpc_millis)));
*cached_timeout = timeout;
grpc_mdelem_set_user_data(md, free_timeout, cached_timeout);
}
diff --git a/src/core/ext/transport/chttp2/transport/stream_map.cc b/src/core/ext/transport/chttp2/transport/stream_map.cc
index 045f868430..a40eaffd5f 100644
--- a/src/core/ext/transport/chttp2/transport/stream_map.cc
+++ b/src/core/ext/transport/chttp2/transport/stream_map.cc
@@ -26,8 +26,10 @@
void grpc_chttp2_stream_map_init(grpc_chttp2_stream_map* map,
size_t initial_capacity) {
GPR_ASSERT(initial_capacity > 1);
- map->keys = static_cast<uint32_t*>(gpr_malloc(sizeof(uint32_t) * initial_capacity));
- map->values = static_cast<void**>(gpr_malloc(sizeof(void*) * initial_capacity));
+ map->keys =
+ static_cast<uint32_t*>(gpr_malloc(sizeof(uint32_t) * initial_capacity));
+ map->values =
+ static_cast<void**>(gpr_malloc(sizeof(void*) * initial_capacity));
map->count = 0;
map->free = 0;
map->capacity = initial_capacity;
@@ -71,8 +73,8 @@ void grpc_chttp2_stream_map_add(grpc_chttp2_stream_map* map, uint32_t key,
/* resize when less than 25% of the table is free, because compaction
won't help much */
map->capacity = capacity = 3 * capacity / 2;
- map->keys = keys =
- static_cast<uint32_t*>(gpr_realloc(keys, capacity * sizeof(uint32_t)));
+ map->keys = keys = static_cast<uint32_t*>(
+ gpr_realloc(keys, capacity * sizeof(uint32_t)));
map->values = values =
static_cast<void**>(gpr_realloc(values, capacity * sizeof(void*)));
}
diff --git a/src/core/ext/transport/chttp2/transport/writing.cc b/src/core/ext/transport/chttp2/transport/writing.cc
index b5970fd646..42cba9ae60 100644
--- a/src/core/ext/transport/chttp2/transport/writing.cc
+++ b/src/core/ext/transport/chttp2/transport/writing.cc
@@ -147,7 +147,7 @@ static void report_stall(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
t->settings[GRPC_ACKED_SETTINGS]
[GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE],
t->flow_control->remote_window(),
- static_cast<uint32_t>GPR_MAX(
+ static_cast<uint32_t> GPR_MAX(
0,
s->flow_control->remote_window_delta() +
(int64_t)t->settings[GRPC_PEER_SETTINGS]
@@ -310,14 +310,14 @@ class DataSendContext {
sending_bytes_before_(s_->sending_bytes) {}
uint32_t stream_remote_window() const {
- return static_cast<uint32_t>GPR_MAX(
+ return static_cast<uint32_t> GPR_MAX(
0, s_->flow_control->remote_window_delta() +
(int64_t)t_->settings[GRPC_PEER_SETTINGS]
[GRPC_CHTTP2_SETTINGS_INITIAL_WINDOW_SIZE]);
}
uint32_t max_outgoing() const {
- return static_cast<uint32_t>GPR_MIN(
+ return static_cast<uint32_t> GPR_MIN(
t_->settings[GRPC_PEER_SETTINGS][GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE],
GPR_MIN(stream_remote_window(), t_->flow_control->remote_window()));
}
@@ -325,8 +325,8 @@ class DataSendContext {
bool AnyOutgoing() const { return max_outgoing() > 0; }
void FlushCompressedBytes() {
- uint32_t send_bytes =
- static_cast<uint32_t>GPR_MIN(max_outgoing(), s_->compressed_data_buffer.length);
+ uint32_t send_bytes = static_cast<uint32_t> GPR_MIN(
+ max_outgoing(), s_->compressed_data_buffer.length);
bool is_last_data_frame =
(send_bytes == s_->compressed_data_buffer.length &&
s_->flow_controlled_buffer.length == 0 &&
@@ -375,10 +375,11 @@ class DataSendContext {
bool is_last_frame() const { return is_last_frame_; }
void CallCallbacks() {
- if (update_list(t_, s_,
- static_cast<int64_t>(s_->sending_bytes - sending_bytes_before_),
- &s_->on_flow_controlled_cbs,
- &s_->flow_controlled_bytes_flowed, GRPC_ERROR_NONE)) {
+ if (update_list(
+ t_, s_,
+ static_cast<int64_t>(s_->sending_bytes - sending_bytes_before_),
+ &s_->on_flow_controlled_cbs, &s_->flow_controlled_bytes_flowed,
+ GRPC_ERROR_NONE)) {
write_context_->NoteScheduledResults();
}
}
@@ -624,8 +625,9 @@ void grpc_chttp2_end_write(grpc_chttp2_transport* t, grpc_error* error) {
while (grpc_chttp2_list_pop_writing_stream(t, &s)) {
if (s->sending_bytes != 0) {
- update_list(t, s, static_cast<int64_t>(s->sending_bytes), &s->on_write_finished_cbs,
- &s->flow_controlled_bytes_written, GRPC_ERROR_REF(error));
+ update_list(t, s, static_cast<int64_t>(s->sending_bytes),
+ &s->on_write_finished_cbs, &s->flow_controlled_bytes_written,
+ GRPC_ERROR_REF(error));
s->sending_bytes = 0;
}
GRPC_CHTTP2_STREAM_UNREF(s, "chttp2_writing:end");
diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.cc b/src/core/ext/transport/cronet/transport/cronet_transport.cc
index 3111b6db43..8904c122a7 100644
--- a/src/core/ext/transport/cronet/transport/cronet_transport.cc
+++ b/src/core/ext/transport/cronet/transport/cronet_transport.cc
@@ -284,7 +284,8 @@ static void maybe_flush_read(stream_obj* s) {
CRONET_LOG(GPR_DEBUG, "%p: Flush read", s);
s->state.flush_read = true;
null_and_maybe_free_read_buffer(s);
- s->state.rs.read_buffer = static_cast<char*>(gpr_malloc(GRPC_FLUSH_READ_SIZE));
+ s->state.rs.read_buffer =
+ static_cast<char*>(gpr_malloc(GRPC_FLUSH_READ_SIZE));
if (!s->state.pending_read_from_cronet) {
CRONET_LOG(GPR_DEBUG, "bidirectional_stream_read(%p)", s->cbs);
bidirectional_stream_read(s->cbs, s->state.rs.read_buffer,
@@ -309,8 +310,8 @@ static void add_to_storage(struct stream_obj* s,
struct op_storage* storage = &s->storage;
/* add new op at the beginning of the linked list. The memory is freed
in remove_from_storage */
- struct op_and_state* new_op =
- static_cast<struct op_and_state*>(gpr_malloc(sizeof(struct op_and_state)));
+ struct op_and_state* new_op = static_cast<struct op_and_state*>(
+ gpr_malloc(sizeof(struct op_and_state)));
memcpy(&new_op->op, op, sizeof(grpc_transport_stream_op_batch));
memset(&new_op->state, 0, sizeof(new_op->state));
new_op->s = s;
@@ -671,7 +672,8 @@ static void create_grpc_frame(grpc_slice_buffer* write_slice_buffer,
size_t length = GRPC_SLICE_LENGTH(slice);
*p_write_buffer_size = length + GRPC_HEADER_SIZE_IN_BYTES;
/* This is freed in the on_write_completed callback */
- char* write_buffer = static_cast<char*>(gpr_malloc(length + GRPC_HEADER_SIZE_IN_BYTES));
+ char* write_buffer =
+ static_cast<char*>(gpr_malloc(length + GRPC_HEADER_SIZE_IN_BYTES));
*pp_write_buffer = write_buffer;
uint8_t* p = reinterpret_cast<uint8_t*>(write_buffer);
/* Append 5 byte header */
@@ -1151,14 +1153,14 @@ static enum e_op_result execute_stream_op(struct op_and_state* oas) {
stream_state->rs.remaining_bytes == 0) {
/* Start a read operation for data */
stream_state->rs.length_field_received = true;
- parse_grpc_header(reinterpret_cast<const uint8_t*>(stream_state->rs.read_buffer),
- &stream_state->rs.length_field,
- &stream_state->rs.compressed);
+ parse_grpc_header(
+ reinterpret_cast<const uint8_t*>(stream_state->rs.read_buffer),
+ &stream_state->rs.length_field, &stream_state->rs.compressed);
CRONET_LOG(GPR_DEBUG, "length field = %d",
stream_state->rs.length_field);
if (stream_state->rs.length_field > 0) {
- stream_state->rs.read_buffer =
- static_cast<char*>(gpr_malloc(static_cast<size_t>(stream_state->rs.length_field)));
+ stream_state->rs.read_buffer = static_cast<char*>(
+ gpr_malloc(static_cast<size_t>(stream_state->rs.length_field)));
GPR_ASSERT(stream_state->rs.read_buffer);
stream_state->rs.remaining_bytes = stream_state->rs.length_field;
stream_state->rs.received_bytes = 0;
@@ -1181,7 +1183,8 @@ static enum e_op_result execute_stream_op(struct op_and_state* oas) {
if (stream_state->rs.compressed) {
stream_state->rs.sbs.base.flags |= GRPC_WRITE_INTERNAL_COMPRESS;
}
- *(reinterpret_cast<grpc_byte_buffer**>(stream_op->payload->recv_message.recv_message)) =
+ *(reinterpret_cast<grpc_byte_buffer**>(
+ stream_op->payload->recv_message.recv_message)) =
reinterpret_cast<grpc_byte_buffer*>(&stream_state->rs.sbs);
GRPC_CLOSURE_SCHED(
stream_op->payload->recv_message.recv_message_ready,
@@ -1237,7 +1240,8 @@ static enum e_op_result execute_stream_op(struct op_and_state* oas) {
if (stream_state->rs.compressed) {
stream_state->rs.sbs.base.flags = GRPC_WRITE_INTERNAL_COMPRESS;
}
- *(reinterpret_cast<grpc_byte_buffer**>(stream_op->payload->recv_message.recv_message)) =
+ *(reinterpret_cast<grpc_byte_buffer**>(
+ stream_op->payload->recv_message.recv_message)) =
reinterpret_cast<grpc_byte_buffer*>(&stream_state->rs.sbs);
GRPC_CLOSURE_SCHED(stream_op->payload->recv_message.recv_message_ready,
GRPC_ERROR_NONE);
@@ -1417,8 +1421,8 @@ static const grpc_transport_vtable grpc_cronet_vtable = {
grpc_transport* grpc_create_cronet_transport(void* engine, const char* target,
const grpc_channel_args* args,
void* reserved) {
- grpc_cronet_transport* ct =
- static_cast<grpc_cronet_transport*>(gpr_malloc(sizeof(grpc_cronet_transport)));
+ grpc_cronet_transport* ct = static_cast<grpc_cronet_transport*>(
+ gpr_malloc(sizeof(grpc_cronet_transport)));
if (!ct) {
goto error;
}
diff --git a/src/core/ext/transport/inproc/inproc_transport.cc b/src/core/ext/transport/inproc/inproc_transport.cc
index 97d908fa5d..2022eaffe5 100644
--- a/src/core/ext/transport/inproc/inproc_transport.cc
+++ b/src/core/ext/transport/inproc/inproc_transport.cc
@@ -208,8 +208,8 @@ static grpc_error* fill_in_metadata(inproc_stream* s,
grpc_error* error = GRPC_ERROR_NONE;
for (grpc_linked_mdelem* elem = metadata->list.head;
(elem != nullptr) && (error == GRPC_ERROR_NONE); elem = elem->next) {
- grpc_linked_mdelem* nelem =
- static_cast<grpc_linked_mdelem*>(gpr_arena_alloc(s->arena, sizeof(*nelem)));
+ grpc_linked_mdelem* nelem = static_cast<grpc_linked_mdelem*>(
+ gpr_arena_alloc(s->arena, sizeof(*nelem)));
nelem->md =
grpc_mdelem_from_slices(grpc_slice_intern(GRPC_MDKEY(elem->md)),
grpc_slice_intern(GRPC_MDVALUE(elem->md)));
@@ -425,13 +425,13 @@ static void fail_helper_locked(inproc_stream* s, grpc_error* error) {
// since it expects that as well as no error yet
grpc_metadata_batch fake_md;
grpc_metadata_batch_init(&fake_md);
- grpc_linked_mdelem* path_md =
- static_cast<grpc_linked_mdelem*>(gpr_arena_alloc(s->arena, sizeof(*path_md)));
+ grpc_linked_mdelem* path_md = static_cast<grpc_linked_mdelem*>(
+ gpr_arena_alloc(s->arena, sizeof(*path_md)));
path_md->md = grpc_mdelem_from_slices(g_fake_path_key, g_fake_path_value);
GPR_ASSERT(grpc_metadata_batch_link_tail(&fake_md, path_md) ==
GRPC_ERROR_NONE);
- grpc_linked_mdelem* auth_md =
- static_cast<grpc_linked_mdelem*>(gpr_arena_alloc(s->arena, sizeof(*auth_md)));
+ grpc_linked_mdelem* auth_md = static_cast<grpc_linked_mdelem*>(
+ gpr_arena_alloc(s->arena, sizeof(*auth_md)));
auth_md->md = grpc_mdelem_from_slices(g_fake_auth_key, g_fake_auth_value);
GPR_ASSERT(grpc_metadata_batch_link_tail(&fake_md, auth_md) ==
GRPC_ERROR_NONE);
@@ -1151,8 +1151,10 @@ static void inproc_transports_create(grpc_transport** server_transport,
grpc_transport** client_transport,
const grpc_channel_args* client_args) {
INPROC_LOG(GPR_DEBUG, "inproc_transports_create");
- inproc_transport* st = static_cast<inproc_transport*>(gpr_zalloc(sizeof(*st)));
- inproc_transport* ct = static_cast<inproc_transport*>(gpr_zalloc(sizeof(*ct)));
+ inproc_transport* st =
+ static_cast<inproc_transport*>(gpr_zalloc(sizeof(*st)));
+ inproc_transport* ct =
+ static_cast<inproc_transport*>(gpr_zalloc(sizeof(*ct)));
// Share one lock between both sides since both sides get affected
st->mu = ct->mu = static_cast<shared_mu*>(gpr_malloc(sizeof(*st->mu)));
gpr_mu_init(&st->mu->mu);
diff --git a/src/core/lib/backoff/backoff.cc b/src/core/lib/backoff/backoff.cc
index 81ea429a6a..4b74afc244 100644
--- a/src/core/lib/backoff/backoff.cc
+++ b/src/core/lib/backoff/backoff.cc
@@ -55,13 +55,14 @@ grpc_millis BackOff::NextAttemptTime() {
initial_ = false;
return current_backoff_ + grpc_core::ExecCtx::Get()->Now();
}
- current_backoff_ =
- static_cast<grpc_millis>(std::min(current_backoff_ * options_.multiplier(),
- static_cast<double>(options_.max_backoff())));
+ current_backoff_ = static_cast<grpc_millis>(
+ std::min(current_backoff_ * options_.multiplier(),
+ static_cast<double>(options_.max_backoff())));
const double jitter = generate_uniform_random_number_between(
&rng_state_, -options_.jitter() * current_backoff_,
options_.jitter() * current_backoff_);
- const grpc_millis next_timeout = static_cast<grpc_millis>(current_backoff_ + jitter);
+ const grpc_millis next_timeout =
+ static_cast<grpc_millis>(current_backoff_ + jitter);
return next_timeout + grpc_core::ExecCtx::Get()->Now();
}
diff --git a/src/core/lib/channel/channel_args.cc b/src/core/lib/channel/channel_args.cc
index 8f448bfd91..98fdfa6b9a 100644
--- a/src/core/lib/channel/channel_args.cc
+++ b/src/core/lib/channel/channel_args.cc
@@ -93,7 +93,8 @@ grpc_channel_args* grpc_channel_args_copy_and_add_and_remove(
dst->args = nullptr;
return dst;
}
- dst->args = static_cast<grpc_arg*>(gpr_malloc(sizeof(grpc_arg) * dst->num_args));
+ dst->args =
+ static_cast<grpc_arg*>(gpr_malloc(sizeof(grpc_arg) * dst->num_args));
// Copy args from src that are not being removed.
size_t dst_idx = 0;
if (src != nullptr) {
@@ -118,7 +119,8 @@ grpc_channel_args* grpc_channel_args_copy(const grpc_channel_args* src) {
grpc_channel_args* grpc_channel_args_union(const grpc_channel_args* a,
const grpc_channel_args* b) {
const size_t max_out = (a->num_args + b->num_args);
- grpc_arg* uniques = static_cast<grpc_arg*>(gpr_malloc(sizeof(*uniques) * max_out));
+ grpc_arg* uniques =
+ static_cast<grpc_arg*>(gpr_malloc(sizeof(*uniques) * max_out));
for (size_t i = 0; i < a->num_args; ++i) uniques[i] = a->args[i];
size_t uniques_idx = a->num_args;
@@ -169,7 +171,8 @@ static int cmp_key_stable(const void* ap, const void* bp) {
}
grpc_channel_args* grpc_channel_args_normalize(const grpc_channel_args* a) {
- grpc_arg** args = static_cast<grpc_arg**>(gpr_malloc(sizeof(grpc_arg*) * a->num_args));
+ grpc_arg** args =
+ static_cast<grpc_arg**>(gpr_malloc(sizeof(grpc_arg*) * a->num_args));
for (size_t i = 0; i < a->num_args; i++) {
args[i] = &a->args[i];
}
diff --git a/src/core/lib/channel/channel_stack.cc b/src/core/lib/channel/channel_stack.cc
index c311c73b85..737d828e4b 100644
--- a/src/core/lib/channel/channel_stack.cc
+++ b/src/core/lib/channel/channel_stack.cc
@@ -104,8 +104,9 @@ grpc_error* grpc_channel_stack_init(
GRPC_STREAM_REF_INIT(&stack->refcount, initial_refs, destroy, destroy_arg,
name);
elems = CHANNEL_ELEMS_FROM_STACK(stack);
- user_data = (reinterpret_cast<char*>(elems)) + ROUND_UP_TO_ALIGNMENT_SIZE(
- filter_count * sizeof(grpc_channel_element));
+ user_data =
+ (reinterpret_cast<char*>(elems)) +
+ ROUND_UP_TO_ALIGNMENT_SIZE(filter_count * sizeof(grpc_channel_element));
/* init per-filter data */
grpc_error* first_error = GRPC_ERROR_NONE;
@@ -243,11 +244,13 @@ void grpc_channel_next_op(grpc_channel_element* elem, grpc_transport_op* op) {
grpc_channel_stack* grpc_channel_stack_from_top_element(
grpc_channel_element* elem) {
- return reinterpret_cast<grpc_channel_stack*>(reinterpret_cast<char*>(elem)-ROUND_UP_TO_ALIGNMENT_SIZE(
- sizeof(grpc_channel_stack)));
+ return reinterpret_cast<grpc_channel_stack*>(
+ reinterpret_cast<char*>(elem) -
+ ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(grpc_channel_stack)));
}
grpc_call_stack* grpc_call_stack_from_top_element(grpc_call_element* elem) {
- return reinterpret_cast<grpc_call_stack*>(reinterpret_cast<char*>(elem)-ROUND_UP_TO_ALIGNMENT_SIZE(
- sizeof(grpc_call_stack)));
+ return reinterpret_cast<grpc_call_stack*>(
+ reinterpret_cast<char*>(elem) -
+ ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(grpc_call_stack)));
}
diff --git a/src/core/lib/channel/channel_stack_builder.cc b/src/core/lib/channel/channel_stack_builder.cc
index c04f4c603a..cae862ec0e 100644
--- a/src/core/lib/channel/channel_stack_builder.cc
+++ b/src/core/lib/channel/channel_stack_builder.cc
@@ -78,7 +78,8 @@ const char* grpc_channel_stack_builder_get_target(
static grpc_channel_stack_builder_iterator* create_iterator_at_filter_node(
grpc_channel_stack_builder* builder, filter_node* node) {
grpc_channel_stack_builder_iterator* it =
- static_cast<grpc_channel_stack_builder_iterator*>(gpr_malloc(sizeof(*it)));
+ static_cast<grpc_channel_stack_builder_iterator*>(
+ gpr_malloc(sizeof(*it)));
it->builder = builder;
it->node = node;
return it;
@@ -213,7 +214,8 @@ bool grpc_channel_stack_builder_prepend_filter(
static void add_after(filter_node* before, const grpc_channel_filter* filter,
grpc_post_filter_create_init_func post_init_func,
void* user_data) {
- filter_node* new_node = static_cast<filter_node*>(gpr_malloc(sizeof(*new_node)));
+ filter_node* new_node =
+ static_cast<filter_node*>(gpr_malloc(sizeof(*new_node)));
new_node->next = before->next;
new_node->prev = before;
new_node->next->prev = new_node->prev->next = new_node;
@@ -265,7 +267,8 @@ grpc_error* grpc_channel_stack_builder_finish(
// create an array of filters
const grpc_channel_filter** filters =
- static_cast<const grpc_channel_filter**>(gpr_malloc(sizeof(*filters) * num_filters));
+ static_cast<const grpc_channel_filter**>(
+ gpr_malloc(sizeof(*filters) * num_filters));
size_t i = 0;
for (filter_node* p = builder->begin.next; p != &builder->end; p = p->next) {
filters[i++] = p->filter;
@@ -277,8 +280,8 @@ grpc_error* grpc_channel_stack_builder_finish(
// allocate memory, with prefix_bytes followed by channel_stack_size
*result = gpr_zalloc(prefix_bytes + channel_stack_size);
// fetch a pointer to the channel stack
- grpc_channel_stack* channel_stack =
- reinterpret_cast<grpc_channel_stack*>(static_cast<char*>(*result) + prefix_bytes);
+ grpc_channel_stack* channel_stack = reinterpret_cast<grpc_channel_stack*>(
+ static_cast<char*>(*result) + prefix_bytes);
// and initialize it
grpc_error* error = grpc_channel_stack_init(
initial_refs, destroy, destroy_arg == nullptr ? *result : destroy_arg,
diff --git a/src/core/lib/channel/connected_channel.cc b/src/core/lib/channel/connected_channel.cc
index 516d49e4d3..a16e89ce00 100644
--- a/src/core/lib/channel/connected_channel.cc
+++ b/src/core/lib/channel/connected_channel.cc
@@ -115,7 +115,8 @@ static void con_start_transport_stream_op_batch(
// calld->on_complete like we can for the other ops. However,
// cancellation isn't in the fast path, so we just allocate a new
// closure for each one.
- callback_state* state = static_cast<callback_state*>(gpr_malloc(sizeof(*state)));
+ callback_state* state =
+ static_cast<callback_state*>(gpr_malloc(sizeof(*state)));
intercept_callback(calld, state, true, "on_complete (cancel_stream)",
&batch->on_complete);
} else {
diff --git a/src/core/lib/channel/handshaker.cc b/src/core/lib/channel/handshaker.cc
index daacbdebd3..518e880c15 100644
--- a/src/core/lib/channel/handshaker.cc
+++ b/src/core/lib/channel/handshaker.cc
@@ -81,8 +81,8 @@ struct grpc_handshake_manager {
};
grpc_handshake_manager* grpc_handshake_manager_create() {
- grpc_handshake_manager* mgr =
- static_cast<grpc_handshake_manager*>(gpr_zalloc(sizeof(grpc_handshake_manager)));
+ grpc_handshake_manager* mgr = static_cast<grpc_handshake_manager*>(
+ gpr_zalloc(sizeof(grpc_handshake_manager)));
gpr_mu_init(&mgr->mu);
gpr_ref_init(&mgr->refs, 1);
return mgr;
@@ -233,8 +233,8 @@ void grpc_handshake_manager_do_handshake(
mgr->args.endpoint = endpoint;
mgr->args.args = grpc_channel_args_copy(channel_args);
mgr->args.user_data = user_data;
- mgr->args.read_buffer =
- static_cast<grpc_slice_buffer*>(gpr_malloc(sizeof(*mgr->args.read_buffer)));
+ mgr->args.read_buffer = static_cast<grpc_slice_buffer*>(
+ gpr_malloc(sizeof(*mgr->args.read_buffer)));
grpc_slice_buffer_init(mgr->args.read_buffer);
// Initialize state needed for calling handshakers.
mgr->acceptor = acceptor;
diff --git a/src/core/lib/channel/handshaker_registry.cc b/src/core/lib/channel/handshaker_registry.cc
index f23f009275..5464cc42f4 100644
--- a/src/core/lib/channel/handshaker_registry.cc
+++ b/src/core/lib/channel/handshaker_registry.cc
@@ -35,7 +35,8 @@ static void grpc_handshaker_factory_list_register(
grpc_handshaker_factory_list* list, bool at_start,
grpc_handshaker_factory* factory) {
list->list = static_cast<grpc_handshaker_factory**>(gpr_realloc(
- list->list, (list->num_factories + 1) * sizeof(grpc_handshaker_factory*)));
+ list->list,
+ (list->num_factories + 1) * sizeof(grpc_handshaker_factory*)));
if (at_start) {
memmove(list->list + 1, list->list,
sizeof(grpc_handshaker_factory*) * list->num_factories);
diff --git a/src/core/lib/compression/compression_internal.cc b/src/core/lib/compression/compression_internal.cc
index e49c67f784..36829c8adf 100644
--- a/src/core/lib/compression/compression_internal.cc
+++ b/src/core/lib/compression/compression_internal.cc
@@ -190,7 +190,8 @@ grpc_message_compression_algorithm grpc_message_compression_algorithm_for_level(
GRPC_API_TRACE("grpc_message_compression_algorithm_for_level(level=%d)", 1,
((int)level));
if (level > GRPC_COMPRESS_LEVEL_HIGH) {
- gpr_log(GPR_ERROR, "Unknown message compression level %d.", static_cast<int>(level));
+ gpr_log(GPR_ERROR, "Unknown message compression level %d.",
+ static_cast<int>(level));
abort();
}
diff --git a/src/core/lib/compression/message_compress.cc b/src/core/lib/compression/message_compress.cc
index 238eff780c..2e44551935 100644
--- a/src/core/lib/compression/message_compress.cc
+++ b/src/core/lib/compression/message_compress.cc
@@ -39,20 +39,20 @@ static int zlib_body(z_stream* zs, grpc_slice_buffer* input,
const uInt uint_max = ~static_cast<uInt>(0);
GPR_ASSERT(GRPC_SLICE_LENGTH(outbuf) <= uint_max);
- zs->avail_out = static_cast<uInt>GRPC_SLICE_LENGTH(outbuf);
+ zs->avail_out = static_cast<uInt> GRPC_SLICE_LENGTH(outbuf);
zs->next_out = GRPC_SLICE_START_PTR(outbuf);
flush = Z_NO_FLUSH;
for (i = 0; i < input->count; i++) {
if (i == input->count - 1) flush = Z_FINISH;
GPR_ASSERT(GRPC_SLICE_LENGTH(input->slices[i]) <= uint_max);
- zs->avail_in = static_cast<uInt>GRPC_SLICE_LENGTH(input->slices[i]);
+ zs->avail_in = static_cast<uInt> GRPC_SLICE_LENGTH(input->slices[i]);
zs->next_in = GRPC_SLICE_START_PTR(input->slices[i]);
do {
if (zs->avail_out == 0) {
grpc_slice_buffer_add_indexed(output, outbuf);
outbuf = GRPC_SLICE_MALLOC(OUTPUT_BLOCK_SIZE);
GPR_ASSERT(GRPC_SLICE_LENGTH(outbuf) <= uint_max);
- zs->avail_out = static_cast<uInt>GRPC_SLICE_LENGTH(outbuf);
+ zs->avail_out = static_cast<uInt> GRPC_SLICE_LENGTH(outbuf);
zs->next_out = GRPC_SLICE_START_PTR(outbuf);
}
r = flate(zs, flush);
diff --git a/src/core/lib/compression/stream_compression_gzip.cc b/src/core/lib/compression/stream_compression_gzip.cc
index c48fe9305d..48fe99b69f 100644
--- a/src/core/lib/compression/stream_compression_gzip.cc
+++ b/src/core/lib/compression/stream_compression_gzip.cc
@@ -52,7 +52,7 @@ static bool gzip_flate(grpc_stream_compression_context_gzip* ctx,
ctx->zs.next_out = GRPC_SLICE_START_PTR(slice_out);
while (ctx->zs.avail_out > 0 && in->length > 0 && !eoc) {
grpc_slice slice = grpc_slice_buffer_take_first(in);
- ctx->zs.avail_in = static_cast<uInt>GRPC_SLICE_LENGTH(slice);
+ ctx->zs.avail_in = static_cast<uInt> GRPC_SLICE_LENGTH(slice);
ctx->zs.next_in = GRPC_SLICE_START_PTR(slice);
r = ctx->flate(&ctx->zs, Z_NO_FLUSH);
if (r < 0 && r != Z_BUF_ERROR) {
@@ -184,8 +184,8 @@ grpc_stream_compression_context_create_gzip(
GPR_ASSERT(method == GRPC_STREAM_COMPRESSION_GZIP_COMPRESS ||
method == GRPC_STREAM_COMPRESSION_GZIP_DECOMPRESS);
grpc_stream_compression_context_gzip* gzip_ctx =
- static_cast<grpc_stream_compression_context_gzip*>(gpr_zalloc(
- sizeof(grpc_stream_compression_context_gzip)));
+ static_cast<grpc_stream_compression_context_gzip*>(
+ gpr_zalloc(sizeof(grpc_stream_compression_context_gzip)));
int r;
if (gzip_ctx == nullptr) {
return nullptr;
diff --git a/src/core/lib/debug/stats.cc b/src/core/lib/debug/stats.cc
index f4de6a82a9..09a86287e4 100644
--- a/src/core/lib/debug/stats.cc
+++ b/src/core/lib/debug/stats.cc
@@ -32,8 +32,8 @@ static size_t g_num_cores;
void grpc_stats_init(void) {
g_num_cores = GPR_MAX(1, gpr_cpu_num_cores());
- grpc_stats_per_cpu_storage =
- static_cast<grpc_stats_data*>(gpr_zalloc(sizeof(grpc_stats_data) * g_num_cores));
+ grpc_stats_per_cpu_storage = static_cast<grpc_stats_data*>(
+ gpr_zalloc(sizeof(grpc_stats_data) * g_num_cores));
}
void grpc_stats_shutdown(void) { gpr_free(grpc_stats_per_cpu_storage); }
@@ -83,7 +83,8 @@ size_t grpc_stats_histo_count(const grpc_stats_data* stats,
grpc_stats_histograms histogram) {
size_t sum = 0;
for (int i = 0; i < grpc_stats_histo_buckets[histogram]; i++) {
- sum += static_cast<size_t>(stats->histograms[grpc_stats_histo_start[histogram] + i]);
+ sum += static_cast<size_t>(
+ stats->histograms[grpc_stats_histo_start[histogram] + i]);
}
return sum;
}
@@ -133,7 +134,8 @@ double grpc_stats_histo_percentile(const grpc_stats_data* stats,
return threshold_for_count_below(
stats->histograms + grpc_stats_histo_start[histogram],
grpc_stats_histo_bucket_boundaries[histogram],
- grpc_stats_histo_buckets[histogram], static_cast<double>(count) * percentile / 100.0);
+ grpc_stats_histo_buckets[histogram],
+ static_cast<double>(count) * percentile / 100.0);
}
char* grpc_stats_data_as_json(const grpc_stats_data* data) {
diff --git a/src/core/lib/gpr/arena.cc b/src/core/lib/gpr/arena.cc
index a1eefa56bc..5bc575f711 100644
--- a/src/core/lib/gpr/arena.cc
+++ b/src/core/lib/gpr/arena.cc
@@ -71,18 +71,20 @@ size_t gpr_arena_destroy(gpr_arena* arena) {
void* gpr_arena_alloc(gpr_arena* arena, size_t size) {
size = ROUND_UP_TO_ALIGNMENT_SIZE(size);
- size_t start =
- static_cast<size_t>(gpr_atm_no_barrier_fetch_add(&arena->size_so_far, size));
+ size_t start = static_cast<size_t>(
+ gpr_atm_no_barrier_fetch_add(&arena->size_so_far, size));
zone* z = &arena->initial_zone;
while (start > z->size_end) {
zone* next_z = (zone*)gpr_atm_acq_load(&z->next_atm);
if (next_z == nullptr) {
- size_t next_z_size = static_cast<size_t>gpr_atm_no_barrier_load(&arena->size_so_far);
- next_z = static_cast<zone*>(zalloc_aligned(ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(zone)) +
- next_z_size));
+ size_t next_z_size =
+ static_cast<size_t> gpr_atm_no_barrier_load(&arena->size_so_far);
+ next_z = static_cast<zone*>(zalloc_aligned(
+ ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(zone)) + next_z_size));
next_z->size_begin = z->size_end;
next_z->size_end = z->size_end + next_z_size;
- if (!gpr_atm_rel_cas(&z->next_atm, static_cast<gpr_atm>(NULL), (gpr_atm)next_z)) {
+ if (!gpr_atm_rel_cas(&z->next_atm, static_cast<gpr_atm>(NULL),
+ (gpr_atm)next_z)) {
gpr_free_aligned(next_z);
next_z = (zone*)gpr_atm_acq_load(&z->next_atm);
}
@@ -95,7 +97,9 @@ void* gpr_arena_alloc(gpr_arena* arena, size_t size) {
GPR_ASSERT(start >= z->size_begin);
GPR_ASSERT(start + size <= z->size_end);
char* ptr = (z == &arena->initial_zone)
- ? reinterpret_cast<char*>(arena) + ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(gpr_arena))
- : reinterpret_cast<char*>(z) + ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(zone));
+ ? reinterpret_cast<char*>(arena) +
+ ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(gpr_arena))
+ : reinterpret_cast<char*>(z) +
+ ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(zone));
return ptr + start - z->size_begin;
}
diff --git a/src/core/lib/gpr/log.cc b/src/core/lib/gpr/log.cc
index 9211a00a69..410096c0f7 100644
--- a/src/core/lib/gpr/log.cc
+++ b/src/core/lib/gpr/log.cc
@@ -45,7 +45,8 @@ const char* gpr_log_severity_string(gpr_log_severity severity) {
void gpr_log_message(const char* file, int line, gpr_log_severity severity,
const char* message) {
- if (static_cast<gpr_atm>(severity) < gpr_atm_no_barrier_load(&g_min_severity_to_print)) {
+ if (static_cast<gpr_atm>(severity) <
+ gpr_atm_no_barrier_load(&g_min_severity_to_print)) {
return;
}
diff --git a/src/core/lib/gpr/string.cc b/src/core/lib/gpr/string.cc
index 9c07f43cae..5a16377e49 100644
--- a/src/core/lib/gpr/string.cc
+++ b/src/core/lib/gpr/string.cc
@@ -243,7 +243,8 @@ void gpr_strvec_destroy(gpr_strvec* sv) {
void gpr_strvec_add(gpr_strvec* sv, char* str) {
if (sv->count == sv->capacity) {
sv->capacity = GPR_MAX(sv->capacity + 8, sv->capacity * 2);
- sv->strs = static_cast<char**>(gpr_realloc(sv->strs, sizeof(char*) * sv->capacity));
+ sv->strs = static_cast<char**>(
+ gpr_realloc(sv->strs, sizeof(char*) * sv->capacity));
}
sv->strs[sv->count++] = str;
}
@@ -265,7 +266,8 @@ int gpr_stricmp(const char* a, const char* b) {
static void add_string_to_split(const char* beg, const char* end, char*** strs,
size_t* nstrs, size_t* capstrs) {
- char* out = static_cast<char*>(gpr_malloc(static_cast<size_t>(end - beg) + 1));
+ char* out =
+ static_cast<char*>(gpr_malloc(static_cast<size_t>(end - beg) + 1));
memcpy(out, beg, static_cast<size_t>(end - beg));
out[end - beg] = 0;
if (*nstrs == *capstrs) {
diff --git a/src/core/lib/gpr/thd_posix.cc b/src/core/lib/gpr/thd_posix.cc
index e8e61ca396..ce268e1fbc 100644
--- a/src/core/lib/gpr/thd_posix.cc
+++ b/src/core/lib/gpr/thd_posix.cc
@@ -103,9 +103,13 @@ int gpr_thd_new(gpr_thd_id* t, const char* thd_name,
return thread_started;
}
-gpr_thd_id gpr_thd_currentid(void) { return static_cast<gpr_thd_id>(pthread_self()); }
+gpr_thd_id gpr_thd_currentid(void) {
+ return static_cast<gpr_thd_id>(pthread_self());
+}
-void gpr_thd_join(gpr_thd_id t) { pthread_join(static_cast<pthread_t>(t), nullptr); }
+void gpr_thd_join(gpr_thd_id t) {
+ pthread_join(static_cast<pthread_t>(t), nullptr);
+}
/*****************************************
* Only used when fork support is enabled
diff --git a/src/core/lib/gpr/time.cc b/src/core/lib/gpr/time.cc
index 9ebfaa7525..39ebeb4339 100644
--- a/src/core/lib/gpr/time.cc
+++ b/src/core/lib/gpr/time.cc
@@ -81,8 +81,9 @@ static gpr_timespec to_seconds_from_sub_second_time(int64_t time_in_units,
units_per_sec) -
1;
}
- out.tv_nsec = static_cast<int32_t>((time_in_units - out.tv_sec * units_per_sec) *
- GPR_NS_PER_SEC / units_per_sec);
+ out.tv_nsec =
+ static_cast<int32_t>((time_in_units - out.tv_sec * units_per_sec) *
+ GPR_NS_PER_SEC / units_per_sec);
out.clock_type = type;
}
return out;
@@ -216,7 +217,8 @@ int32_t gpr_time_to_millis(gpr_timespec t) {
care?) */
return -2147483647;
} else {
- return static_cast<int32_t>(t.tv_sec * GPR_MS_PER_SEC + t.tv_nsec / GPR_NS_PER_MS);
+ return static_cast<int32_t>(t.tv_sec * GPR_MS_PER_SEC +
+ t.tv_nsec / GPR_NS_PER_MS);
}
}
diff --git a/src/core/lib/http/format_request.cc b/src/core/lib/http/format_request.cc
index ff273ffc1a..6581bef7cd 100644
--- a/src/core/lib/http/format_request.cc
+++ b/src/core/lib/http/format_request.cc
@@ -89,7 +89,8 @@ grpc_slice grpc_httpcli_format_post_request(const grpc_httpcli_request* request,
if (!has_content_type) {
gpr_strvec_add(&out, gpr_strdup("Content-Type: text/plain\r\n"));
}
- gpr_asprintf(&tmp, "Content-Length: %lu\r\n", static_cast<unsigned long>(body_size));
+ gpr_asprintf(&tmp, "Content-Length: %lu\r\n",
+ static_cast<unsigned long>(body_size));
gpr_strvec_add(&out, tmp);
}
gpr_strvec_add(&out, gpr_strdup("\r\n"));
diff --git a/src/core/lib/http/httpcli_security_connector.cc b/src/core/lib/http/httpcli_security_connector.cc
index ab684f6093..d754558060 100644
--- a/src/core/lib/http/httpcli_security_connector.cc
+++ b/src/core/lib/http/httpcli_security_connector.cc
@@ -111,8 +111,8 @@ static grpc_security_status httpcli_ssl_channel_security_connector_create(
return GRPC_SECURITY_ERROR;
}
- c = static_cast<grpc_httpcli_ssl_channel_security_connector*>(gpr_zalloc(
- sizeof(grpc_httpcli_ssl_channel_security_connector)));
+ c = static_cast<grpc_httpcli_ssl_channel_security_connector*>(
+ gpr_zalloc(sizeof(grpc_httpcli_ssl_channel_security_connector)));
gpr_ref_init(&c->base.base.refcount, 1);
c->base.base.vtable = &httpcli_ssl_vtable;
diff --git a/src/core/lib/http/parser.cc b/src/core/lib/http/parser.cc
index 74689a6671..724b6d1885 100644
--- a/src/core/lib/http/parser.cc
+++ b/src/core/lib/http/parser.cc
@@ -88,7 +88,8 @@ static grpc_error* handle_request_line(grpc_http_parser* parser) {
if (cur == end)
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"No method on HTTP request line");
- parser->http.request->method = buf2str(beg, static_cast<size_t>(cur - beg - 1));
+ parser->http.request->method =
+ buf2str(beg, static_cast<size_t>(cur - beg - 1));
beg = cur;
while (cur != end && *cur++ != ' ')
@@ -182,7 +183,8 @@ static grpc_error* add_header(grpc_http_parser* parser) {
cur++;
}
GPR_ASSERT((size_t)(end - cur) >= parser->cur_line_end_length);
- hdr.value = buf2str(cur, static_cast<size_t>(end - cur) - parser->cur_line_end_length);
+ hdr.value = buf2str(
+ cur, static_cast<size_t>(end - cur) - parser->cur_line_end_length);
switch (parser->type) {
case GRPC_HTTP_RESPONSE:
@@ -198,8 +200,8 @@ static grpc_error* add_header(grpc_http_parser* parser) {
if (*hdr_count == parser->hdr_capacity) {
parser->hdr_capacity =
GPR_MAX(parser->hdr_capacity + 1, parser->hdr_capacity * 3 / 2);
- *hdrs = static_cast<grpc_http_header*>(gpr_realloc(
- *hdrs, parser->hdr_capacity * sizeof(**hdrs)));
+ *hdrs = static_cast<grpc_http_header*>(
+ gpr_realloc(*hdrs, parser->hdr_capacity * sizeof(**hdrs)));
}
(*hdrs)[(*hdr_count)++] = hdr;
@@ -257,7 +259,8 @@ static grpc_error* addbyte_body(grpc_http_parser* parser, uint8_t byte) {
if (*body_length == parser->body_capacity) {
parser->body_capacity = GPR_MAX(8, parser->body_capacity * 3 / 2);
- *body = static_cast<char*>(gpr_realloc((void*)*body, parser->body_capacity));
+ *body =
+ static_cast<char*>(gpr_realloc((void*)*body, parser->body_capacity));
}
(*body)[*body_length] = static_cast<char>(byte);
(*body_length)++;
diff --git a/src/core/lib/iomgr/call_combiner.cc b/src/core/lib/iomgr/call_combiner.cc
index f180594545..3b11e0266d 100644
--- a/src/core/lib/iomgr/call_combiner.cc
+++ b/src/core/lib/iomgr/call_combiner.cc
@@ -68,8 +68,8 @@ void grpc_call_combiner_start(grpc_call_combiner* call_combiner,
call_combiner, closure DEBUG_FMT_ARGS, reason,
grpc_error_string(error));
}
- size_t prev_size =
- static_cast<size_t>(gpr_atm_full_fetch_add(&call_combiner->size, (gpr_atm)1));
+ size_t prev_size = static_cast<size_t>(
+ gpr_atm_full_fetch_add(&call_combiner->size, (gpr_atm)1));
if (grpc_call_combiner_trace.enabled()) {
gpr_log(GPR_DEBUG, " size: %" PRIdPTR " -> %" PRIdPTR, prev_size,
prev_size + 1);
@@ -90,7 +90,8 @@ void grpc_call_combiner_start(grpc_call_combiner* call_combiner,
}
// Queue was not empty, so add closure to queue.
closure->error_data.error = error;
- gpr_mpscq_push(&call_combiner->queue, reinterpret_cast<gpr_mpscq_node*>(closure));
+ gpr_mpscq_push(&call_combiner->queue,
+ reinterpret_cast<gpr_mpscq_node*>(closure));
}
}
@@ -102,8 +103,8 @@ void grpc_call_combiner_stop(grpc_call_combiner* call_combiner DEBUG_ARGS,
"==> grpc_call_combiner_stop() [%p] [" DEBUG_FMT_STR "%s]",
call_combiner DEBUG_FMT_ARGS, reason);
}
- size_t prev_size =
- static_cast<size_t>(gpr_atm_full_fetch_add(&call_combiner->size, (gpr_atm)-1));
+ size_t prev_size = static_cast<size_t>(
+ gpr_atm_full_fetch_add(&call_combiner->size, (gpr_atm)-1));
if (grpc_call_combiner_trace.enabled()) {
gpr_log(GPR_DEBUG, " size: %" PRIdPTR " -> %" PRIdPTR, prev_size,
prev_size - 1);
@@ -115,8 +116,8 @@ void grpc_call_combiner_stop(grpc_call_combiner* call_combiner DEBUG_ARGS,
gpr_log(GPR_DEBUG, " checking queue");
}
bool empty;
- grpc_closure* closure = reinterpret_cast<grpc_closure*>(gpr_mpscq_pop_and_check_end(
- &call_combiner->queue, &empty));
+ grpc_closure* closure = reinterpret_cast<grpc_closure*>(
+ gpr_mpscq_pop_and_check_end(&call_combiner->queue, &empty));
if (closure == nullptr) {
// This can happen either due to a race condition within the mpscq
// code or because of a race with grpc_call_combiner_start().
diff --git a/src/core/lib/iomgr/combiner.cc b/src/core/lib/iomgr/combiner.cc
index 6ff6fccf03..a7edf17e9b 100644
--- a/src/core/lib/iomgr/combiner.cc
+++ b/src/core/lib/iomgr/combiner.cc
@@ -342,7 +342,8 @@ static void combiner_finally_exec(grpc_closure* closure, grpc_error* error) {
}
static void enqueue_finally(void* closure, grpc_error* error) {
- combiner_finally_exec(static_cast<grpc_closure*>(closure), GRPC_ERROR_REF(error));
+ combiner_finally_exec(static_cast<grpc_closure*>(closure),
+ GRPC_ERROR_REF(error));
}
grpc_closure_scheduler* grpc_combiner_scheduler(grpc_combiner* combiner) {
diff --git a/src/core/lib/iomgr/error.cc b/src/core/lib/iomgr/error.cc
index 0ba0617f75..4088cf612e 100644
--- a/src/core/lib/iomgr/error.cc
+++ b/src/core/lib/iomgr/error.cc
@@ -148,7 +148,8 @@ grpc_error* grpc_error_ref(grpc_error* err) {
static void unref_errs(grpc_error* err) {
uint8_t slot = err->first_err;
while (slot != UINT8_MAX) {
- grpc_linked_error* lerr = reinterpret_cast<grpc_linked_error*>(err->arena + slot);
+ grpc_linked_error* lerr =
+ reinterpret_cast<grpc_linked_error*>(err->arena + slot);
GRPC_ERROR_UNREF(lerr->err);
GPR_ASSERT(err->last_err == slot ? lerr->next == UINT8_MAX
: lerr->next != UINT8_MAX);
@@ -200,8 +201,8 @@ static uint8_t get_placement(grpc_error** err, size_t size) {
GPR_ASSERT(*err);
uint8_t slots = static_cast<uint8_t>(size / sizeof(intptr_t));
if ((*err)->arena_size + slots > (*err)->arena_capacity) {
- (*err)->arena_capacity =
- static_cast<uint8_t>GPR_MIN(UINT8_MAX - 1, (3 * (*err)->arena_capacity / 2));
+ (*err)->arena_capacity = static_cast<uint8_t> GPR_MIN(
+ UINT8_MAX - 1, (3 * (*err)->arena_capacity / 2));
if ((*err)->arena_size + slots > (*err)->arena_capacity) {
return UINT8_MAX;
}
@@ -317,9 +318,10 @@ grpc_error* grpc_error_create(const char* file, int line, grpc_slice desc,
GPR_TIMER_SCOPE("grpc_error_create", 0);
uint8_t initial_arena_capacity = static_cast<uint8_t>(
DEFAULT_ERROR_CAPACITY +
- static_cast<uint8_t>(num_referencing * SLOTS_PER_LINKED_ERROR) + SURPLUS_CAPACITY);
- grpc_error* err = static_cast<grpc_error*>(gpr_malloc(
- sizeof(*err) + initial_arena_capacity * sizeof(intptr_t)));
+ static_cast<uint8_t>(num_referencing * SLOTS_PER_LINKED_ERROR) +
+ SURPLUS_CAPACITY);
+ grpc_error* err = static_cast<grpc_error*>(
+ gpr_malloc(sizeof(*err) + initial_arena_capacity * sizeof(intptr_t)));
if (err == nullptr) { // TODO(ctiller): make gpr_malloc return NULL
return GRPC_ERROR_OOM;
}
@@ -362,7 +364,8 @@ static void ref_strs(grpc_error* err) {
for (size_t i = 0; i < GRPC_ERROR_STR_MAX; ++i) {
uint8_t slot = err->strs[i];
if (slot != UINT8_MAX) {
- grpc_slice_ref_internal(*reinterpret_cast<grpc_slice*>(err->arena + slot));
+ grpc_slice_ref_internal(
+ *reinterpret_cast<grpc_slice*>(err->arena + slot));
}
}
}
@@ -370,7 +373,8 @@ static void ref_strs(grpc_error* err) {
static void ref_errs(grpc_error* err) {
uint8_t slot = err->first_err;
while (slot != UINT8_MAX) {
- grpc_linked_error* lerr = reinterpret_cast<grpc_linked_error*>(err->arena + slot);
+ grpc_linked_error* lerr =
+ reinterpret_cast<grpc_linked_error*>(err->arena + slot);
GRPC_ERROR_REF(lerr->err);
slot = lerr->next;
}
@@ -399,11 +403,12 @@ static grpc_error* copy_error_and_unref(grpc_error* in) {
uint8_t new_arena_capacity = in->arena_capacity;
// the returned err will be added to, so we ensure this is room to avoid
// unneeded allocations.
- if (in->arena_capacity - in->arena_size < static_cast<uint8_t>SLOTS_PER_STR) {
+ if (in->arena_capacity - in->arena_size <
+ static_cast<uint8_t> SLOTS_PER_STR) {
new_arena_capacity = static_cast<uint8_t>(3 * new_arena_capacity / 2);
}
- out = static_cast<grpc_error*>(gpr_malloc(sizeof(*in) +
- new_arena_capacity * sizeof(intptr_t)));
+ out = static_cast<grpc_error*>(
+ gpr_malloc(sizeof(*in) + new_arena_capacity * sizeof(intptr_t)));
#ifndef NDEBUG
if (grpc_trace_error_refcount.enabled()) {
gpr_log(GPR_DEBUG, "%p create copying %p", out, in);
@@ -571,8 +576,8 @@ static void append_esc_str(const uint8_t* str, size_t len, char** s, size_t* sz,
static void append_kv(kv_pairs* kvs, char* key, char* value) {
if (kvs->num_kvs == kvs->cap_kvs) {
kvs->cap_kvs = GPR_MAX(3 * kvs->cap_kvs / 2, 4);
- kvs->kvs =
- static_cast<kv_pair*>(gpr_realloc(kvs->kvs, sizeof(*kvs->kvs) * kvs->cap_kvs));
+ kvs->kvs = static_cast<kv_pair*>(
+ gpr_realloc(kvs->kvs, sizeof(*kvs->kvs) * kvs->cap_kvs));
}
kvs->kvs[kvs->num_kvs].key = key;
kvs->kvs[kvs->num_kvs].value = value;
@@ -662,7 +667,8 @@ static void add_errs(grpc_error* err, char** s, size_t* sz, size_t* cap) {
uint8_t slot = err->first_err;
bool first = true;
while (slot != UINT8_MAX) {
- grpc_linked_error* lerr = reinterpret_cast<grpc_linked_error*>(err->arena + slot);
+ grpc_linked_error* lerr =
+ reinterpret_cast<grpc_linked_error*>(err->arena + slot);
if (!first) append_chr(',', s, sz, cap);
first = false;
const char* e = grpc_error_string(lerr->err);
@@ -698,8 +704,8 @@ static char* finish_kvs(kv_pairs* kvs) {
append_chr('{', &s, &sz, &cap);
for (size_t i = 0; i < kvs->num_kvs; i++) {
if (i != 0) append_chr(',', &s, &sz, &cap);
- append_esc_str(reinterpret_cast<const uint8_t*>(kvs->kvs[i].key), strlen(kvs->kvs[i].key), &s,
- &sz, &cap);
+ append_esc_str(reinterpret_cast<const uint8_t*>(kvs->kvs[i].key),
+ strlen(kvs->kvs[i].key), &s, &sz, &cap);
gpr_free(kvs->kvs[i].key);
append_chr(':', &s, &sz, &cap);
append_str(kvs->kvs[i].value, &s, &sz, &cap);
diff --git a/src/core/lib/iomgr/ev_epoll1_linux.cc b/src/core/lib/iomgr/ev_epoll1_linux.cc
index ad013c01b6..f84f3f8205 100644
--- a/src/core/lib/iomgr/ev_epoll1_linux.cc
+++ b/src/core/lib/iomgr/ev_epoll1_linux.cc
@@ -458,8 +458,8 @@ static grpc_error* pollset_global_init(void) {
return GRPC_OS_ERROR(errno, "epoll_ctl");
}
g_num_neighborhoods = GPR_CLAMP(gpr_cpu_num_cores(), 1, MAX_NEIGHBORHOODS);
- g_neighborhoods = static_cast<pollset_neighborhood*>(gpr_zalloc(sizeof(*g_neighborhoods) *
- g_num_neighborhoods));
+ g_neighborhoods = static_cast<pollset_neighborhood*>(
+ gpr_zalloc(sizeof(*g_neighborhoods) * g_num_neighborhoods));
for (size_t i = 0; i < g_num_neighborhoods; i++) {
gpr_mu_init(&g_neighborhoods[i].mu);
}
diff --git a/src/core/lib/iomgr/ev_epollex_linux.cc b/src/core/lib/iomgr/ev_epollex_linux.cc
index e201845cd2..8bce34b2fd 100644
--- a/src/core/lib/iomgr/ev_epollex_linux.cc
+++ b/src/core/lib/iomgr/ev_epollex_linux.cc
@@ -479,7 +479,7 @@ static pollable* pollable_ref(pollable* p) {
#else
static pollable* pollable_ref(pollable* p, int line, const char* reason) {
if (grpc_trace_pollable_refcount.enabled()) {
- int r = static_cast<int>gpr_atm_no_barrier_load(&p->refs.count);
+ int r = static_cast<int> gpr_atm_no_barrier_load(&p->refs.count);
gpr_log(__FILE__, line, GPR_LOG_SEVERITY_DEBUG,
"POLLABLE:%p ref %d->%d %s", p, r, r + 1, reason);
}
@@ -494,7 +494,7 @@ static void pollable_unref(pollable* p) {
static void pollable_unref(pollable* p, int line, const char* reason) {
if (p == nullptr) return;
if (grpc_trace_pollable_refcount.enabled()) {
- int r = static_cast<int>gpr_atm_no_barrier_load(&p->refs.count);
+ int r = static_cast<int> gpr_atm_no_barrier_load(&p->refs.count);
gpr_log(__FILE__, line, GPR_LOG_SEVERITY_DEBUG,
"POLLABLE:%p unref %d->%d %s", p, r, r - 1, reason);
}
@@ -516,7 +516,8 @@ static grpc_error* pollable_add_fd(pollable* p, grpc_fd* fd) {
}
struct epoll_event ev_fd;
- ev_fd.events = static_cast<uint32_t>(EPOLLET | EPOLLIN | EPOLLOUT | EPOLLEXCLUSIVE);
+ ev_fd.events =
+ static_cast<uint32_t>(EPOLLET | EPOLLIN | EPOLLOUT | EPOLLEXCLUSIVE);
ev_fd.data.ptr = fd;
if (epoll_ctl(epfd, EPOLL_CTL_ADD, fd->fd, &ev_fd) != 0) {
switch (errno) {
@@ -768,7 +769,8 @@ static grpc_error* pollable_process_events(grpc_pollset* pollset,
}
append_error(&error,
grpc_wakeup_fd_consume_wakeup(
- (grpc_wakeup_fd*)((~static_cast<intptr_t>(1)) & (intptr_t)data_ptr)),
+ (grpc_wakeup_fd*)((~static_cast<intptr_t>(1)) &
+ (intptr_t)data_ptr)),
err_desc);
} else {
grpc_fd* fd = static_cast<grpc_fd*>(data_ptr);
@@ -1170,7 +1172,8 @@ static grpc_pollset_set* pss_lock_adam(grpc_pollset_set* pss) {
}
static grpc_pollset_set* pollset_set_create(void) {
- grpc_pollset_set* pss = static_cast<grpc_pollset_set*>(gpr_zalloc(sizeof(*pss)));
+ grpc_pollset_set* pss =
+ static_cast<grpc_pollset_set*>(gpr_zalloc(sizeof(*pss)));
gpr_mu_init(&pss->mu);
gpr_ref_init(&pss->refs, 1);
return pss;
@@ -1210,8 +1213,8 @@ static void pollset_set_add_fd(grpc_pollset_set* pss, grpc_fd* fd) {
}
if (pss->fd_count == pss->fd_capacity) {
pss->fd_capacity = GPR_MAX(pss->fd_capacity * 2, 8);
- pss->fds =
- static_cast<grpc_fd**>(gpr_realloc(pss->fds, pss->fd_capacity * sizeof(*pss->fds)));
+ pss->fds = static_cast<grpc_fd**>(
+ gpr_realloc(pss->fds, pss->fd_capacity * sizeof(*pss->fds)));
}
REF_BY(fd, 2, "pollset_set");
pss->fds[pss->fd_count++] = fd;
@@ -1373,7 +1376,8 @@ static void pollset_set_add_pollset_set(grpc_pollset_set* a,
b->parent = a;
if (a->fd_capacity < a->fd_count + b->fd_count) {
a->fd_capacity = GPR_MAX(2 * a->fd_capacity, a->fd_count + b->fd_count);
- a->fds = static_cast<grpc_fd**>(gpr_realloc(a->fds, a->fd_capacity * sizeof(*a->fds)));
+ a->fds = static_cast<grpc_fd**>(
+ gpr_realloc(a->fds, a->fd_capacity * sizeof(*a->fds)));
}
size_t initial_a_fd_count = a->fd_count;
a->fd_count = 0;
@@ -1390,8 +1394,8 @@ static void pollset_set_add_pollset_set(grpc_pollset_set* a,
if (a->pollset_capacity < a->pollset_count + b->pollset_count) {
a->pollset_capacity =
GPR_MAX(2 * a->pollset_capacity, a->pollset_count + b->pollset_count);
- a->pollsets = static_cast<grpc_pollset**>(gpr_realloc(
- a->pollsets, a->pollset_capacity * sizeof(*a->pollsets)));
+ a->pollsets = static_cast<grpc_pollset**>(
+ gpr_realloc(a->pollsets, a->pollset_capacity * sizeof(*a->pollsets)));
}
if (b->pollset_count > 0) {
memcpy(a->pollsets + a->pollset_count, b->pollsets,
diff --git a/src/core/lib/iomgr/ev_epollsig_linux.cc b/src/core/lib/iomgr/ev_epollsig_linux.cc
index 438b4c8c09..5c99c72aa5 100644
--- a/src/core/lib/iomgr/ev_epollsig_linux.cc
+++ b/src/core/lib/iomgr/ev_epollsig_linux.cc
@@ -368,8 +368,8 @@ static void polling_island_add_fds_locked(polling_island* pi, grpc_fd** fds,
if (pi->fd_cnt == pi->fd_capacity) {
pi->fd_capacity = GPR_MAX(pi->fd_capacity + 8, pi->fd_cnt * 3 / 2);
- pi->fds =
- static_cast<grpc_fd**>(gpr_realloc(pi->fds, sizeof(grpc_fd*) * pi->fd_capacity));
+ pi->fds = static_cast<grpc_fd**>(
+ gpr_realloc(pi->fds, sizeof(grpc_fd*) * pi->fd_capacity));
}
pi->fds[pi->fd_cnt++] = fds[i];
@@ -976,7 +976,8 @@ static grpc_error* pollset_worker_kick(grpc_pollset_worker* worker) {
grpc_error* err = GRPC_ERROR_NONE;
/* Kick the worker only if it was not already kicked */
- if (gpr_atm_no_barrier_cas(&worker->is_kicked, static_cast<gpr_atm>(0), static_cast<gpr_atm>(1))) {
+ if (gpr_atm_no_barrier_cas(&worker->is_kicked, static_cast<gpr_atm>(0),
+ static_cast<gpr_atm>(1))) {
GRPC_POLLING_TRACE(
"pollset_worker_kick: Kicking worker: %p (thread id: %ld)",
(void*)worker, (long int)worker->pt_id);
@@ -1538,7 +1539,8 @@ static void pollset_add_fd(grpc_pollset* pollset, grpc_fd* fd) {
*/
static grpc_pollset_set* pollset_set_create(void) {
- grpc_pollset_set* pss = static_cast<grpc_pollset_set*>(gpr_malloc(sizeof(*pss)));
+ grpc_pollset_set* pss =
+ static_cast<grpc_pollset_set*>(gpr_malloc(sizeof(*pss)));
gpr_mu_init(&pss->po.mu);
pss->po.pi = nullptr;
#ifndef NDEBUG
diff --git a/src/core/lib/iomgr/ev_poll_posix.cc b/src/core/lib/iomgr/ev_poll_posix.cc
index 769fdbc299..e92163322f 100644
--- a/src/core/lib/iomgr/ev_poll_posix.cc
+++ b/src/core/lib/iomgr/ev_poll_posix.cc
@@ -835,8 +835,8 @@ static void pollset_add_fd(grpc_pollset* pollset, grpc_fd* fd) {
if (pollset->fd_count == pollset->fd_capacity) {
pollset->fd_capacity =
GPR_MAX(pollset->fd_capacity + 8, pollset->fd_count * 3 / 2);
- pollset->fds = static_cast<grpc_fd**>(gpr_realloc(
- pollset->fds, sizeof(grpc_fd*) * pollset->fd_capacity));
+ pollset->fds = static_cast<grpc_fd**>(
+ gpr_realloc(pollset->fds, sizeof(grpc_fd*) * pollset->fd_capacity));
}
pollset->fds[pollset->fd_count++] = fd;
GRPC_FD_REF(fd, "multipoller");
@@ -889,8 +889,8 @@ static grpc_error* pollset_work(grpc_pollset* pollset,
worker.wakeup_fd = pollset->local_wakeup_cache;
pollset->local_wakeup_cache = worker.wakeup_fd->next;
} else {
- worker.wakeup_fd =
- static_cast<grpc_cached_wakeup_fd*>(gpr_malloc(sizeof(*worker.wakeup_fd)));
+ worker.wakeup_fd = static_cast<grpc_cached_wakeup_fd*>(
+ gpr_malloc(sizeof(*worker.wakeup_fd)));
error = grpc_wakeup_fd_init(&worker.wakeup_fd->fd);
if (error != GRPC_ERROR_NONE) {
GRPC_LOG_IF_ERROR("pollset_work", GRPC_ERROR_REF(error));
@@ -946,7 +946,8 @@ static grpc_error* pollset_work(grpc_pollset* pollset,
const size_t watch_size = sizeof(*watchers) * (pollset->fd_count + 2);
void* buf = gpr_malloc(pfd_size + watch_size);
pfds = static_cast<struct pollfd*>(buf);
- watchers = static_cast<grpc_fd_watcher*>((void*)(static_cast<char*>(buf) + pfd_size));
+ watchers = static_cast<grpc_fd_watcher*>(
+ (void*)(static_cast<char*>(buf) + pfd_size));
}
fd_count = 0;
@@ -972,8 +973,8 @@ static grpc_error* pollset_work(grpc_pollset* pollset,
for (i = 1; i < pfd_count; i++) {
grpc_fd* fd = watchers[i].fd;
- pfds[i].events = static_cast<short>(fd_begin_poll(fd, pollset, &worker, POLLIN,
- POLLOUT, &watchers[i]));
+ pfds[i].events = static_cast<short>(
+ fd_begin_poll(fd, pollset, &worker, POLLIN, POLLOUT, &watchers[i]));
GRPC_FD_UNREF(fd, "multipoller_start");
}
@@ -1222,9 +1223,9 @@ static void pollset_set_add_pollset_set(grpc_pollset_set* bag,
gpr_mu_lock(&bag->mu);
if (bag->pollset_set_count == bag->pollset_set_capacity) {
bag->pollset_set_capacity = GPR_MAX(8, 2 * bag->pollset_set_capacity);
- bag->pollset_sets = static_cast<grpc_pollset_set**>(gpr_realloc(
- bag->pollset_sets,
- bag->pollset_set_capacity * sizeof(*bag->pollset_sets)));
+ bag->pollset_sets = static_cast<grpc_pollset_set**>(
+ gpr_realloc(bag->pollset_sets,
+ bag->pollset_set_capacity * sizeof(*bag->pollset_sets)));
}
bag->pollset_sets[bag->pollset_set_count++] = item;
for (i = 0, j = 0; i < bag->fd_count; i++) {
@@ -1259,8 +1260,9 @@ static void pollset_set_add_fd(grpc_pollset_set* pollset_set, grpc_fd* fd) {
gpr_mu_lock(&pollset_set->mu);
if (pollset_set->fd_count == pollset_set->fd_capacity) {
pollset_set->fd_capacity = GPR_MAX(8, 2 * pollset_set->fd_capacity);
- pollset_set->fds = static_cast<grpc_fd**>(gpr_realloc(
- pollset_set->fds, pollset_set->fd_capacity * sizeof(*pollset_set->fds)));
+ pollset_set->fds = static_cast<grpc_fd**>(
+ gpr_realloc(pollset_set->fds,
+ pollset_set->fd_capacity * sizeof(*pollset_set->fds)));
}
GRPC_FD_REF(fd, "pollset_set");
pollset_set->fds[pollset_set->fd_count++] = fd;
@@ -1316,8 +1318,8 @@ static void init_result(poll_args* pargs) {
gpr_ref_init(&pargs->result->refcount, 1);
pargs->result->watchers = nullptr;
pargs->result->watchcount = 0;
- pargs->result->fds =
- static_cast<struct pollfd*>(gpr_malloc(sizeof(struct pollfd) * pargs->nfds));
+ pargs->result->fds = static_cast<struct pollfd*>(
+ gpr_malloc(sizeof(struct pollfd) * pargs->nfds));
memcpy(pargs->result->fds, pargs->fds, sizeof(struct pollfd) * pargs->nfds);
pargs->result->nfds = pargs->nfds;
pargs->result->retval = 0;
@@ -1356,7 +1358,8 @@ static poll_args* get_poller_locked(struct pollfd* fds, nfds_t count) {
return pargs;
}
- poll_args* pargs = static_cast<poll_args*>(gpr_malloc(sizeof(struct poll_args)));
+ poll_args* pargs =
+ static_cast<poll_args*>(gpr_malloc(sizeof(struct poll_args)));
gpr_cv_init(&pargs->trigger);
pargs->fds = fds;
pargs->nfds = count;
@@ -1514,7 +1517,8 @@ static int cvfd_poll(struct pollfd* fds, nfds_t nfds, int timeout) {
gpr_cv pollcv_cv;
gpr_cv_init(&pollcv_cv);
pollcv->cv = &pollcv_cv;
- grpc_cv_node* fd_cvs = static_cast<grpc_cv_node*>(gpr_malloc(nfds * sizeof(grpc_cv_node)));
+ grpc_cv_node* fd_cvs =
+ static_cast<grpc_cv_node*>(gpr_malloc(nfds * sizeof(grpc_cv_node)));
for (i = 0; i < nfds; i++) {
fds[i].revents = 0;
@@ -1546,8 +1550,8 @@ static int cvfd_poll(struct pollfd* fds, nfds_t nfds, int timeout) {
res = 0;
if (!skip_poll && nsockfds > 0) {
- struct pollfd* pollfds =
- static_cast<struct pollfd*>(gpr_malloc(sizeof(struct pollfd) * nsockfds));
+ struct pollfd* pollfds = static_cast<struct pollfd*>(
+ gpr_malloc(sizeof(struct pollfd) * nsockfds));
idx = 0;
for (i = 0; i < nfds; i++) {
if (fds[i].fd >= 0) {
@@ -1610,8 +1614,8 @@ static void global_cv_fd_table_init() {
gpr_cv_init(&g_cvfds.shutdown_cv);
gpr_ref_init(&g_cvfds.pollcount, 1);
g_cvfds.size = CV_DEFAULT_TABLE_SIZE;
- g_cvfds.cvfds =
- static_cast<grpc_fd_node*>(gpr_malloc(sizeof(grpc_fd_node) * CV_DEFAULT_TABLE_SIZE));
+ g_cvfds.cvfds = static_cast<grpc_fd_node*>(
+ gpr_malloc(sizeof(grpc_fd_node) * CV_DEFAULT_TABLE_SIZE));
g_cvfds.free_fds = nullptr;
thread_grace = gpr_time_from_millis(POLLCV_THREAD_GRACE_MS, GPR_TIMESPAN);
for (int i = 0; i < CV_DEFAULT_TABLE_SIZE; i++) {
@@ -1628,7 +1632,8 @@ static void global_cv_fd_table_init() {
poll_cache.size = 32;
poll_cache.count = 0;
poll_cache.free_pollers = nullptr;
- poll_cache.active_pollers = static_cast<poll_args**>(gpr_malloc(sizeof(void*) * 32));
+ poll_cache.active_pollers =
+ static_cast<poll_args**>(gpr_malloc(sizeof(void*) * 32));
for (unsigned int i = 0; i < poll_cache.size; i++) {
poll_cache.active_pollers[i] = nullptr;
}
diff --git a/src/core/lib/iomgr/exec_ctx.cc b/src/core/lib/iomgr/exec_ctx.cc
index 89c6a873e6..5401a94dd3 100644
--- a/src/core/lib/iomgr/exec_ctx.cc
+++ b/src/core/lib/iomgr/exec_ctx.cc
@@ -53,8 +53,8 @@ static gpr_timespec g_start_time;
static gpr_atm timespec_to_atm_round_down(gpr_timespec ts) {
ts = gpr_time_sub(ts, g_start_time);
- double x =
- GPR_MS_PER_SEC * static_cast<double>(ts.tv_sec) + static_cast<double>(ts.tv_nsec) / GPR_NS_PER_MS;
+ double x = GPR_MS_PER_SEC * static_cast<double>(ts.tv_sec) +
+ static_cast<double>(ts.tv_nsec) / GPR_NS_PER_MS;
if (x < 0) return 0;
if (x > GPR_ATM_MAX) return GPR_ATM_MAX;
return static_cast<gpr_atm>(x);
@@ -64,7 +64,8 @@ static gpr_atm timespec_to_atm_round_up(gpr_timespec ts) {
ts = gpr_time_sub(ts, g_start_time);
double x = GPR_MS_PER_SEC * static_cast<double>(ts.tv_sec) +
static_cast<double>(ts.tv_nsec) / GPR_NS_PER_MS +
- static_cast<double>(GPR_NS_PER_SEC - 1) / static_cast<double>(GPR_NS_PER_SEC);
+ static_cast<double>(GPR_NS_PER_SEC - 1) /
+ static_cast<double>(GPR_NS_PER_SEC);
if (x < 0) return 0;
if (x > GPR_ATM_MAX) return GPR_ATM_MAX;
return static_cast<gpr_atm>(x);
diff --git a/src/core/lib/iomgr/executor.cc b/src/core/lib/iomgr/executor.cc
index 901bbdd4df..16782dacc5 100644
--- a/src/core/lib/iomgr/executor.cc
+++ b/src/core/lib/iomgr/executor.cc
@@ -94,8 +94,8 @@ void grpc_executor_set_threading(bool threading) {
g_max_threads = GPR_MAX(1, 2 * gpr_cpu_num_cores());
gpr_atm_no_barrier_store(&g_cur_threads, 1);
gpr_tls_init(&g_this_thread_state);
- g_thread_state =
- static_cast<thread_state*>(gpr_zalloc(sizeof(thread_state) * g_max_threads));
+ g_thread_state = static_cast<thread_state*>(
+ gpr_zalloc(sizeof(thread_state) * g_max_threads));
for (size_t i = 0; i < g_max_threads; i++) {
gpr_mu_init(&g_thread_state[i].mu);
gpr_cv_init(&g_thread_state[i].cv);
@@ -170,7 +170,8 @@ static void executor_thread(void* arg) {
ts->elems = GRPC_CLOSURE_LIST_INIT;
gpr_mu_unlock(&ts->mu);
if (executor_trace.enabled()) {
- gpr_log(GPR_DEBUG, "EXECUTOR[%d]: execute", static_cast<int>(ts - g_thread_state));
+ gpr_log(GPR_DEBUG, "EXECUTOR[%d]: execute",
+ static_cast<int>(ts - g_thread_state));
}
grpc_core::ExecCtx::Get()->InvalidateNow();
@@ -188,7 +189,8 @@ static void executor_push(grpc_closure* closure, grpc_error* error,
}
do {
retry_push = false;
- size_t cur_thread_count = static_cast<size_t>gpr_atm_no_barrier_load(&g_cur_threads);
+ size_t cur_thread_count =
+ static_cast<size_t> gpr_atm_no_barrier_load(&g_cur_threads);
if (cur_thread_count == 0) {
if (executor_trace.enabled()) {
#ifndef NDEBUG
@@ -255,7 +257,8 @@ static void executor_push(grpc_closure* closure, grpc_error* error,
break;
}
if (try_new_thread && gpr_spinlock_trylock(&g_adding_thread_lock)) {
- cur_thread_count = static_cast<size_t>gpr_atm_no_barrier_load(&g_cur_threads);
+ cur_thread_count =
+ static_cast<size_t> gpr_atm_no_barrier_load(&g_cur_threads);
if (cur_thread_count < g_max_threads) {
gpr_atm_no_barrier_store(&g_cur_threads, cur_thread_count + 1);
diff --git a/src/core/lib/iomgr/is_epollexclusive_available.cc b/src/core/lib/iomgr/is_epollexclusive_available.cc
index a58a5775d3..542cc41e8f 100644
--- a/src/core/lib/iomgr/is_epollexclusive_available.cc
+++ b/src/core/lib/iomgr/is_epollexclusive_available.cc
@@ -61,7 +61,8 @@ bool grpc_is_epollexclusive_available(void) {
/* choose events that should cause an error on
EPOLLEXCLUSIVE enabled kernels - specifically the combination of
EPOLLONESHOT and EPOLLEXCLUSIVE */
- ev.events = static_cast<uint32_t>(EPOLLET | EPOLLIN | EPOLLEXCLUSIVE | EPOLLONESHOT);
+ ev.events =
+ static_cast<uint32_t>(EPOLLET | EPOLLIN | EPOLLEXCLUSIVE | EPOLLONESHOT);
ev.data.ptr = nullptr;
if (epoll_ctl(fd, EPOLL_CTL_ADD, evfd, &ev) != 0) {
if (errno != EINVAL) {
diff --git a/src/core/lib/iomgr/load_file.cc b/src/core/lib/iomgr/load_file.cc
index 5e637ff8b5..7f5f642c98 100644
--- a/src/core/lib/iomgr/load_file.cc
+++ b/src/core/lib/iomgr/load_file.cc
@@ -47,8 +47,8 @@ grpc_error* grpc_load_file(const char* filename, int add_null_terminator,
/* Converting to size_t on the assumption that it will not fail */
contents_size = static_cast<size_t>(ftell(file));
fseek(file, 0, SEEK_SET);
- contents =
- static_cast<unsigned char*>(gpr_malloc(contents_size + (add_null_terminator ? 1 : 0)));
+ contents = static_cast<unsigned char*>(
+ gpr_malloc(contents_size + (add_null_terminator ? 1 : 0)));
bytes_read = fread(contents, 1, contents_size, file);
if (bytes_read < contents_size) {
error = GRPC_OS_ERROR(errno, "fread");
diff --git a/src/core/lib/iomgr/resolve_address_posix.cc b/src/core/lib/iomgr/resolve_address_posix.cc
index b49b080c12..dd5363dc0a 100644
--- a/src/core/lib/iomgr/resolve_address_posix.cc
+++ b/src/core/lib/iomgr/resolve_address_posix.cc
@@ -114,14 +114,14 @@ static grpc_error* blocking_resolve_address_impl(
}
/* Success path: set addrs non-NULL, fill it in */
- *addresses =
- static_cast<grpc_resolved_addresses*>(gpr_malloc(sizeof(grpc_resolved_addresses)));
+ *addresses = static_cast<grpc_resolved_addresses*>(
+ gpr_malloc(sizeof(grpc_resolved_addresses)));
(*addresses)->naddrs = 0;
for (resp = result; resp != nullptr; resp = resp->ai_next) {
(*addresses)->naddrs++;
}
- (*addresses)->addrs = static_cast<grpc_resolved_address*>(gpr_malloc(
- sizeof(grpc_resolved_address) * (*addresses)->naddrs));
+ (*addresses)->addrs = static_cast<grpc_resolved_address*>(
+ gpr_malloc(sizeof(grpc_resolved_address) * (*addresses)->naddrs));
i = 0;
for (resp = result; resp != nullptr; resp = resp->ai_next) {
memcpy(&(*addresses)->addrs[i].addr, resp->ai_addr, resp->ai_addrlen);
diff --git a/src/core/lib/iomgr/resource_quota.cc b/src/core/lib/iomgr/resource_quota.cc
index 40dd29b6a4..da310694ef 100644
--- a/src/core/lib/iomgr/resource_quota.cc
+++ b/src/core/lib/iomgr/resource_quota.cc
@@ -419,8 +419,8 @@ static const grpc_slice_refcount_vtable ru_slice_vtable = {
static grpc_slice ru_slice_create(grpc_resource_user* resource_user,
size_t size) {
- ru_slice_refcount* rc =
- static_cast<ru_slice_refcount*>(gpr_malloc(sizeof(ru_slice_refcount) + size));
+ ru_slice_refcount* rc = static_cast<ru_slice_refcount*>(
+ gpr_malloc(sizeof(ru_slice_refcount) + size));
rc->base.vtable = &ru_slice_vtable;
rc->base.sub_refcount = &rc->base;
gpr_ref_init(&rc->refs, 1);
@@ -659,7 +659,8 @@ void grpc_resource_quota_resize(grpc_resource_quota* resource_quota,
}
size_t grpc_resource_quota_peek_size(grpc_resource_quota* resource_quota) {
- return static_cast<size_t>gpr_atm_no_barrier_load(&resource_quota->last_size);
+ return static_cast<size_t> gpr_atm_no_barrier_load(
+ &resource_quota->last_size);
}
/*******************************************************************************
@@ -672,7 +673,8 @@ grpc_resource_quota* grpc_resource_quota_from_channel_args(
if (0 == strcmp(channel_args->args[i].key, GRPC_ARG_RESOURCE_QUOTA)) {
if (channel_args->args[i].type == GRPC_ARG_POINTER) {
return grpc_resource_quota_ref_internal(
- static_cast<grpc_resource_quota*>(channel_args->args[i].value.pointer.p));
+ static_cast<grpc_resource_quota*>(
+ channel_args->args[i].value.pointer.p));
} else {
gpr_log(GPR_DEBUG, GRPC_ARG_RESOURCE_QUOTA " should be a pointer");
}
diff --git a/src/core/lib/iomgr/sockaddr_utils.cc b/src/core/lib/iomgr/sockaddr_utils.cc
index 06f080376a..69be87168e 100644
--- a/src/core/lib/iomgr/sockaddr_utils.cc
+++ b/src/core/lib/iomgr/sockaddr_utils.cc
@@ -39,13 +39,15 @@ static const uint8_t kV4MappedPrefix[] = {0, 0, 0, 0, 0, 0,
int grpc_sockaddr_is_v4mapped(const grpc_resolved_address* resolved_addr,
grpc_resolved_address* resolved_addr4_out) {
GPR_ASSERT(resolved_addr != resolved_addr4_out);
- const struct sockaddr* addr = reinterpret_cast<const struct sockaddr*>(resolved_addr->addr);
+ const struct sockaddr* addr =
+ reinterpret_cast<const struct sockaddr*>(resolved_addr->addr);
struct sockaddr_in* addr4_out =
resolved_addr4_out == nullptr
? nullptr
: reinterpret_cast<struct sockaddr_in*>(resolved_addr4_out->addr);
if (addr->sa_family == AF_INET6) {
- const struct sockaddr_in6* addr6 = reinterpret_cast<const struct sockaddr_in6*>(addr);
+ const struct sockaddr_in6* addr6 =
+ reinterpret_cast<const struct sockaddr_in6*>(addr);
if (memcmp(addr6->sin6_addr.s6_addr, kV4MappedPrefix,
sizeof(kV4MappedPrefix)) == 0) {
if (resolved_addr4_out != nullptr) {
@@ -66,11 +68,13 @@ int grpc_sockaddr_is_v4mapped(const grpc_resolved_address* resolved_addr,
int grpc_sockaddr_to_v4mapped(const grpc_resolved_address* resolved_addr,
grpc_resolved_address* resolved_addr6_out) {
GPR_ASSERT(resolved_addr != resolved_addr6_out);
- const struct sockaddr* addr = reinterpret_cast<const struct sockaddr*>(resolved_addr->addr);
+ const struct sockaddr* addr =
+ reinterpret_cast<const struct sockaddr*>(resolved_addr->addr);
struct sockaddr_in6* addr6_out =
reinterpret_cast<struct sockaddr_in6*>(resolved_addr6_out->addr);
if (addr->sa_family == AF_INET) {
- const struct sockaddr_in* addr4 = reinterpret_cast<const struct sockaddr_in*>(addr);
+ const struct sockaddr_in* addr4 =
+ reinterpret_cast<const struct sockaddr_in*>(addr);
memset(resolved_addr6_out, 0, sizeof(*resolved_addr6_out));
addr6_out->sin6_family = AF_INET6;
memcpy(&addr6_out->sin6_addr.s6_addr[0], kV4MappedPrefix, 12);
@@ -92,7 +96,8 @@ int grpc_sockaddr_is_wildcard(const grpc_resolved_address* resolved_addr,
addr = reinterpret_cast<const struct sockaddr*>(resolved_addr->addr);
if (addr->sa_family == AF_INET) {
/* Check for 0.0.0.0 */
- const struct sockaddr_in* addr4 = reinterpret_cast<const struct sockaddr_in*>(addr);
+ const struct sockaddr_in* addr4 =
+ reinterpret_cast<const struct sockaddr_in*>(addr);
if (addr4->sin_addr.s_addr != 0) {
return 0;
}
@@ -100,7 +105,8 @@ int grpc_sockaddr_is_wildcard(const grpc_resolved_address* resolved_addr,
return 1;
} else if (addr->sa_family == AF_INET6) {
/* Check for :: */
- const struct sockaddr_in6* addr6 = reinterpret_cast<const struct sockaddr_in6*>(addr);
+ const struct sockaddr_in6* addr6 =
+ reinterpret_cast<const struct sockaddr_in6*>(addr);
int i;
for (i = 0; i < 16; i++) {
if (addr6->sin6_addr.s6_addr[i] != 0) {
@@ -122,7 +128,8 @@ void grpc_sockaddr_make_wildcards(int port, grpc_resolved_address* wild4_out,
void grpc_sockaddr_make_wildcard4(int port,
grpc_resolved_address* resolved_wild_out) {
- struct sockaddr_in* wild_out = reinterpret_cast<struct sockaddr_in*>(resolved_wild_out->addr);
+ struct sockaddr_in* wild_out =
+ reinterpret_cast<struct sockaddr_in*>(resolved_wild_out->addr);
GPR_ASSERT(port >= 0 && port < 65536);
memset(resolved_wild_out, 0, sizeof(*resolved_wild_out));
wild_out->sin_family = AF_INET;
@@ -132,7 +139,8 @@ void grpc_sockaddr_make_wildcard4(int port,
void grpc_sockaddr_make_wildcard6(int port,
grpc_resolved_address* resolved_wild_out) {
- struct sockaddr_in6* wild_out = reinterpret_cast<struct sockaddr_in6*>(resolved_wild_out->addr);
+ struct sockaddr_in6* wild_out =
+ reinterpret_cast<struct sockaddr_in6*>(resolved_wild_out->addr);
GPR_ASSERT(port >= 0 && port < 65536);
memset(resolved_wild_out, 0, sizeof(*resolved_wild_out));
wild_out->sin6_family = AF_INET6;
@@ -158,11 +166,13 @@ int grpc_sockaddr_to_string(char** out,
}
addr = reinterpret_cast<const struct sockaddr*>(resolved_addr->addr);
if (addr->sa_family == AF_INET) {
- const struct sockaddr_in* addr4 = reinterpret_cast<const struct sockaddr_in*>(addr);
+ const struct sockaddr_in* addr4 =
+ reinterpret_cast<const struct sockaddr_in*>(addr);
ip = &addr4->sin_addr;
port = ntohs(addr4->sin_port);
} else if (addr->sa_family == AF_INET6) {
- const struct sockaddr_in6* addr6 = reinterpret_cast<const struct sockaddr_in6*>(addr);
+ const struct sockaddr_in6* addr6 =
+ reinterpret_cast<const struct sockaddr_in6*>(addr);
ip = &addr6->sin6_addr;
port = ntohs(addr6->sin6_port);
sin6_scope_id = addr6->sin6_scope_id;
@@ -208,7 +218,8 @@ char* grpc_sockaddr_to_uri(const grpc_resolved_address* resolved_addr) {
const char* grpc_sockaddr_get_uri_scheme(
const grpc_resolved_address* resolved_addr) {
- const struct sockaddr* addr = reinterpret_cast<const struct sockaddr*>(resolved_addr->addr);
+ const struct sockaddr* addr =
+ reinterpret_cast<const struct sockaddr*>(resolved_addr->addr);
switch (addr->sa_family) {
case AF_INET:
return "ipv4";
@@ -221,12 +232,14 @@ const char* grpc_sockaddr_get_uri_scheme(
}
int grpc_sockaddr_get_family(const grpc_resolved_address* resolved_addr) {
- const struct sockaddr* addr = reinterpret_cast<const struct sockaddr*>(resolved_addr->addr);
+ const struct sockaddr* addr =
+ reinterpret_cast<const struct sockaddr*>(resolved_addr->addr);
return addr->sa_family;
}
int grpc_sockaddr_get_port(const grpc_resolved_address* resolved_addr) {
- const struct sockaddr* addr = reinterpret_cast<const struct sockaddr*>(resolved_addr->addr);
+ const struct sockaddr* addr =
+ reinterpret_cast<const struct sockaddr*>(resolved_addr->addr);
switch (addr->sa_family) {
case AF_INET:
return ntohs(((struct sockaddr_in*)addr)->sin_port);
@@ -244,15 +257,18 @@ int grpc_sockaddr_get_port(const grpc_resolved_address* resolved_addr) {
int grpc_sockaddr_set_port(const grpc_resolved_address* resolved_addr,
int port) {
- const struct sockaddr* addr = reinterpret_cast<const struct sockaddr*>(resolved_addr->addr);
+ const struct sockaddr* addr =
+ reinterpret_cast<const struct sockaddr*>(resolved_addr->addr);
switch (addr->sa_family) {
case AF_INET:
GPR_ASSERT(port >= 0 && port < 65536);
- ((struct sockaddr_in*)addr)->sin_port = htons(static_cast<uint16_t>(port));
+ ((struct sockaddr_in*)addr)->sin_port =
+ htons(static_cast<uint16_t>(port));
return 1;
case AF_INET6:
GPR_ASSERT(port >= 0 && port < 65536);
- ((struct sockaddr_in6*)addr)->sin6_port = htons(static_cast<uint16_t>(port));
+ ((struct sockaddr_in6*)addr)->sin6_port =
+ htons(static_cast<uint16_t>(port));
return 1;
default:
gpr_log(GPR_ERROR, "Unknown socket family %d in grpc_sockaddr_set_port",
diff --git a/src/core/lib/iomgr/socket_utils_common_posix.cc b/src/core/lib/iomgr/socket_utils_common_posix.cc
index 2668aa6d10..a0cca6195b 100644
--- a/src/core/lib/iomgr/socket_utils_common_posix.cc
+++ b/src/core/lib/iomgr/socket_utils_common_posix.cc
@@ -218,7 +218,8 @@ static void probe_ipv6_once(void) {
memset(&addr, 0, sizeof(addr));
addr.sin6_family = AF_INET6;
addr.sin6_addr.s6_addr[15] = 1; /* [::1]:0 */
- if (bind(fd, reinterpret_cast<struct sockaddr*>(&addr), sizeof(addr)) == 0) {
+ if (bind(fd, reinterpret_cast<struct sockaddr*>(&addr), sizeof(addr)) ==
+ 0) {
g_ipv6_loopback_available = 1;
} else {
gpr_log(GPR_INFO,
@@ -278,7 +279,8 @@ static int create_socket(grpc_socket_factory* factory, int domain, int type,
grpc_error* grpc_create_dualstack_socket_using_factory(
grpc_socket_factory* factory, const grpc_resolved_address* resolved_addr,
int type, int protocol, grpc_dualstack_mode* dsmode, int* newfd) {
- const struct sockaddr* addr = reinterpret_cast<const struct sockaddr*>(resolved_addr->addr);
+ const struct sockaddr* addr =
+ reinterpret_cast<const struct sockaddr*>(resolved_addr->addr);
int family = addr->sa_family;
if (family == AF_INET6) {
if (grpc_ipv6_loopback_available()) {
diff --git a/src/core/lib/iomgr/socket_utils_linux.cc b/src/core/lib/iomgr/socket_utils_linux.cc
index edb5274e0e..e8bf05c3a8 100644
--- a/src/core/lib/iomgr/socket_utils_linux.cc
+++ b/src/core/lib/iomgr/socket_utils_linux.cc
@@ -35,7 +35,8 @@ int grpc_accept4(int sockfd, grpc_resolved_address* resolved_addr, int nonblock,
GPR_ASSERT(resolved_addr->len <= (socklen_t)-1);
flags |= nonblock ? SOCK_NONBLOCK : 0;
flags |= cloexec ? SOCK_CLOEXEC : 0;
- return accept4(sockfd, reinterpret_cast<struct sockaddr*>(resolved_addr->addr),
+ return accept4(sockfd,
+ reinterpret_cast<struct sockaddr*>(resolved_addr->addr),
reinterpret_cast<socklen_t*>(&resolved_addr->len), flags);
}
diff --git a/src/core/lib/iomgr/tcp_client_posix.cc b/src/core/lib/iomgr/tcp_client_posix.cc
index 8d08127915..33a0b0404d 100644
--- a/src/core/lib/iomgr/tcp_client_posix.cc
+++ b/src/core/lib/iomgr/tcp_client_posix.cc
@@ -79,8 +79,8 @@ static grpc_error* prepare_socket(const grpc_resolved_address* addr, int fd,
for (size_t i = 0; i < channel_args->num_args; i++) {
if (0 == strcmp(channel_args->args[i].key, GRPC_ARG_SOCKET_MUTATOR)) {
GPR_ASSERT(channel_args->args[i].type == GRPC_ARG_POINTER);
- grpc_socket_mutator* mutator =
- static_cast<grpc_socket_mutator*>(channel_args->args[i].value.pointer.p);
+ grpc_socket_mutator* mutator = static_cast<grpc_socket_mutator*>(
+ channel_args->args[i].value.pointer.p);
err = grpc_set_socket_with_mutator(fd, mutator);
if (err != GRPC_ERROR_NONE) goto error;
}
@@ -291,7 +291,8 @@ void grpc_tcp_client_create_from_prepared_fd(
async_connect* ac;
do {
GPR_ASSERT(addr->len < ~(socklen_t)0);
- err = connect(fd, reinterpret_cast<const struct sockaddr*>(addr->addr), static_cast<socklen_t>(addr->len));
+ err = connect(fd, reinterpret_cast<const struct sockaddr*>(addr->addr),
+ static_cast<socklen_t>(addr->len));
} while (err < 0 && errno == EINTR);
if (err >= 0) {
char* addr_str = grpc_sockaddr_to_uri(addr);
diff --git a/src/core/lib/iomgr/tcp_posix.cc b/src/core/lib/iomgr/tcp_posix.cc
index 71819adaba..50efd04382 100644
--- a/src/core/lib/iomgr/tcp_posix.cc
+++ b/src/core/lib/iomgr/tcp_posix.cc
@@ -165,8 +165,8 @@ static void drop_uncovered(grpc_tcp* tcp) {
gpr_atm old_count =
gpr_atm_no_barrier_fetch_add(&g_uncovered_notifications_pending, -1);
if (grpc_tcp_trace.enabled()) {
- gpr_log(GPR_DEBUG, "BACKUP_POLLER:%p uncover cnt %d->%d", p, static_cast<int>(old_count),
- static_cast<int>(old_count) - 1);
+ gpr_log(GPR_DEBUG, "BACKUP_POLLER:%p uncover cnt %d->%d", p,
+ static_cast<int>(old_count), static_cast<int>(old_count) - 1);
}
GPR_ASSERT(old_count != 1);
}
@@ -176,12 +176,13 @@ static void cover_self(grpc_tcp* tcp) {
gpr_atm old_count =
gpr_atm_no_barrier_fetch_add(&g_uncovered_notifications_pending, 2);
if (grpc_tcp_trace.enabled()) {
- gpr_log(GPR_DEBUG, "BACKUP_POLLER: cover cnt %d->%d", static_cast<int>(old_count),
- 2 + static_cast<int>(old_count));
+ gpr_log(GPR_DEBUG, "BACKUP_POLLER: cover cnt %d->%d",
+ static_cast<int>(old_count), 2 + static_cast<int>(old_count));
}
if (old_count == 0) {
GRPC_STATS_INC_TCP_BACKUP_POLLERS_CREATED();
- p = static_cast<backup_poller*>(gpr_zalloc(sizeof(*p) + grpc_pollset_size()));
+ p = static_cast<backup_poller*>(
+ gpr_zalloc(sizeof(*p) + grpc_pollset_size()));
if (grpc_tcp_trace.enabled()) {
gpr_log(GPR_DEBUG, "BACKUP_POLLER:%p create", p);
}
@@ -257,8 +258,8 @@ static size_t get_target_read_size(grpc_tcp* tcp) {
double pressure = grpc_resource_quota_get_memory_pressure(rq);
double target =
tcp->target_length * (pressure > 0.8 ? (1.0 - pressure) / 0.2 : 1.0);
- size_t sz = ((static_cast<size_t>GPR_CLAMP(target, tcp->min_read_chunk_size,
- tcp->max_read_chunk_size)) +
+ size_t sz = ((static_cast<size_t> GPR_CLAMP(target, tcp->min_read_chunk_size,
+ tcp->max_read_chunk_size)) +
255) &
~static_cast<size_t>(255);
/* don't use more than 1/16th of the overall resource quota for a single read
@@ -733,27 +734,25 @@ grpc_endpoint* grpc_tcp_create(grpc_fd* em_fd,
for (size_t i = 0; i < channel_args->num_args; i++) {
if (0 ==
strcmp(channel_args->args[i].key, GRPC_ARG_TCP_READ_CHUNK_SIZE)) {
- grpc_integer_options options = {tcp_read_chunk_size, 1,
- MAX_CHUNK_SIZE};
+ grpc_integer_options options = {tcp_read_chunk_size, 1, MAX_CHUNK_SIZE};
tcp_read_chunk_size =
grpc_channel_arg_get_integer(&channel_args->args[i], options);
} else if (0 == strcmp(channel_args->args[i].key,
GRPC_ARG_TCP_MIN_READ_CHUNK_SIZE)) {
- grpc_integer_options options = {tcp_read_chunk_size, 1,
- MAX_CHUNK_SIZE};
+ grpc_integer_options options = {tcp_read_chunk_size, 1, MAX_CHUNK_SIZE};
tcp_min_read_chunk_size =
grpc_channel_arg_get_integer(&channel_args->args[i], options);
} else if (0 == strcmp(channel_args->args[i].key,
GRPC_ARG_TCP_MAX_READ_CHUNK_SIZE)) {
- grpc_integer_options options = {tcp_read_chunk_size, 1,
- MAX_CHUNK_SIZE};
+ grpc_integer_options options = {tcp_read_chunk_size, 1, MAX_CHUNK_SIZE};
tcp_max_read_chunk_size =
grpc_channel_arg_get_integer(&channel_args->args[i], options);
} else if (0 ==
strcmp(channel_args->args[i].key, GRPC_ARG_RESOURCE_QUOTA)) {
grpc_resource_quota_unref_internal(resource_quota);
- resource_quota = grpc_resource_quota_ref_internal(
- static_cast<grpc_resource_quota*>(channel_args->args[i].value.pointer.p));
+ resource_quota =
+ grpc_resource_quota_ref_internal(static_cast<grpc_resource_quota*>(
+ channel_args->args[i].value.pointer.p));
}
}
}
diff --git a/src/core/lib/iomgr/tcp_server_posix.cc b/src/core/lib/iomgr/tcp_server_posix.cc
index f8f94e3fbb..fe6108e4ac 100644
--- a/src/core/lib/iomgr/tcp_server_posix.cc
+++ b/src/core/lib/iomgr/tcp_server_posix.cc
@@ -72,7 +72,8 @@ grpc_error* grpc_tcp_server_create(grpc_closure* shutdown_complete,
grpc_tcp_server** server) {
gpr_once_init(&check_init, init);
- grpc_tcp_server* s = static_cast<grpc_tcp_server*>(gpr_zalloc(sizeof(grpc_tcp_server)));
+ grpc_tcp_server* s =
+ static_cast<grpc_tcp_server*>(gpr_zalloc(sizeof(grpc_tcp_server)));
s->so_reuseport = has_so_reuseport;
s->expand_wildcard_addrs = false;
for (size_t i = 0; i < (args == nullptr ? 0 : args->num_args); i++) {
@@ -410,8 +411,10 @@ grpc_error* grpc_tcp_server_add_port(grpc_tcp_server* s,
if (requested_port == 0) {
for (sp = s->head; sp; sp = sp->next) {
sockname_temp.len = sizeof(struct sockaddr_storage);
- if (0 == getsockname(sp->fd, reinterpret_cast<struct sockaddr*>(&sockname_temp.addr),
- reinterpret_cast<socklen_t*>(&sockname_temp.len))) {
+ if (0 ==
+ getsockname(sp->fd,
+ reinterpret_cast<struct sockaddr*>(&sockname_temp.addr),
+ reinterpret_cast<socklen_t*>(&sockname_temp.len))) {
int used_port = grpc_sockaddr_get_port(&sockname_temp);
if (used_port > 0) {
memcpy(&sockname_temp, addr, sizeof(grpc_resolved_address));
diff --git a/src/core/lib/iomgr/tcp_server_utils_posix_common.cc b/src/core/lib/iomgr/tcp_server_utils_posix_common.cc
index e98ebb7813..be2a00a9dc 100644
--- a/src/core/lib/iomgr/tcp_server_utils_posix_common.cc
+++ b/src/core/lib/iomgr/tcp_server_utils_posix_common.cc
@@ -169,7 +169,9 @@ grpc_error* grpc_tcp_server_prepare_socket(int fd,
if (err != GRPC_ERROR_NONE) goto error;
GPR_ASSERT(addr->len < ~(socklen_t)0);
- if (bind(fd, reinterpret_cast<struct sockaddr*>(const_cast<char*>(addr->addr)), static_cast<socklen_t>(addr->len)) < 0) {
+ if (bind(fd,
+ reinterpret_cast<struct sockaddr*>(const_cast<char*>(addr->addr)),
+ static_cast<socklen_t>(addr->len)) < 0) {
err = GRPC_OS_ERROR(errno, "bind");
goto error;
}
diff --git a/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc b/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc
index 5470dbcff7..612c2584bc 100644
--- a/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc
+++ b/src/core/lib/iomgr/tcp_server_utils_posix_ifaddrs.cc
@@ -66,13 +66,14 @@ static grpc_error* get_unused_port(int* port) {
if (dsmode == GRPC_DSMODE_IPV4) {
grpc_sockaddr_make_wildcard4(0, &wild);
}
- if (bind(fd, reinterpret_cast<const struct sockaddr*>(wild.addr), static_cast<socklen_t>(wild.len)) != 0) {
+ if (bind(fd, reinterpret_cast<const struct sockaddr*>(wild.addr),
+ static_cast<socklen_t>(wild.len)) != 0) {
err = GRPC_OS_ERROR(errno, "bind");
close(fd);
return err;
}
- if (getsockname(fd, reinterpret_cast<struct sockaddr*>(wild.addr), reinterpret_cast<socklen_t*>(&wild.len)) !=
- 0) {
+ if (getsockname(fd, reinterpret_cast<struct sockaddr*>(wild.addr),
+ reinterpret_cast<socklen_t*>(&wild.len)) != 0) {
err = GRPC_OS_ERROR(errno, "getsockname");
close(fd);
return err;
diff --git a/src/core/lib/iomgr/timer_generic.cc b/src/core/lib/iomgr/timer_generic.cc
index b47c12b689..697162f7a8 100644
--- a/src/core/lib/iomgr/timer_generic.cc
+++ b/src/core/lib/iomgr/timer_generic.cc
@@ -240,9 +240,10 @@ void grpc_timer_list_init() {
uint32_t i;
g_num_shards = GPR_MIN(1, 2 * gpr_cpu_num_cores());
- g_shards = static_cast<timer_shard*>(gpr_zalloc(g_num_shards * sizeof(*g_shards)));
- g_shard_queue =
- static_cast<timer_shard**>(gpr_zalloc(g_num_shards * sizeof(*g_shard_queue)));
+ g_shards =
+ static_cast<timer_shard*>(gpr_zalloc(g_num_shards * sizeof(*g_shards)));
+ g_shard_queue = static_cast<timer_shard**>(
+ gpr_zalloc(g_num_shards * sizeof(*g_shard_queue)));
g_shared_mutables.initialized = true;
g_shared_mutables.checker_mu = GPR_SPINLOCK_INITIALIZER;
@@ -359,8 +360,8 @@ void grpc_timer_init(grpc_timer* timer, grpc_millis deadline,
return;
}
- grpc_time_averaged_stats_add_sample(&shard->stats,
- static_cast<double>(deadline - now) / 1000.0);
+ grpc_time_averaged_stats_add_sample(
+ &shard->stats, static_cast<double>(deadline - now) / 1000.0);
ADD_TO_HASH_TABLE(timer);
diff --git a/src/core/lib/iomgr/timer_heap.cc b/src/core/lib/iomgr/timer_heap.cc
index 9aedfd3755..c26896ee4a 100644
--- a/src/core/lib/iomgr/timer_heap.cc
+++ b/src/core/lib/iomgr/timer_heap.cc
@@ -74,8 +74,8 @@ static void maybe_shrink(grpc_timer_heap* heap) {
if (heap->timer_count >= 8 &&
heap->timer_count <= heap->timer_capacity / SHRINK_FULLNESS_FACTOR / 2) {
heap->timer_capacity = heap->timer_count * SHRINK_FULLNESS_FACTOR;
- heap->timers = static_cast<grpc_timer**>(gpr_realloc(
- heap->timers, heap->timer_capacity * sizeof(grpc_timer*)));
+ heap->timers = static_cast<grpc_timer**>(
+ gpr_realloc(heap->timers, heap->timer_capacity * sizeof(grpc_timer*)));
}
}
@@ -99,8 +99,8 @@ int grpc_timer_heap_add(grpc_timer_heap* heap, grpc_timer* timer) {
if (heap->timer_count == heap->timer_capacity) {
heap->timer_capacity =
GPR_MAX(heap->timer_capacity + 1, heap->timer_capacity * 3 / 2);
- heap->timers = static_cast<grpc_timer**>(gpr_realloc(
- heap->timers, heap->timer_capacity * sizeof(grpc_timer*)));
+ heap->timers = static_cast<grpc_timer**>(
+ gpr_realloc(heap->timers, heap->timer_capacity * sizeof(grpc_timer*)));
}
timer->heap_index = heap->timer_count;
adjust_upwards(heap->timers, heap->timer_count, timer);
diff --git a/src/core/lib/iomgr/timer_manager.cc b/src/core/lib/iomgr/timer_manager.cc
index 4cefb7fc9f..a528c22264 100644
--- a/src/core/lib/iomgr/timer_manager.cc
+++ b/src/core/lib/iomgr/timer_manager.cc
@@ -86,7 +86,8 @@ static void start_timer_thread_and_unlock(void) {
}
gpr_thd_options opt = gpr_thd_options_default();
gpr_thd_options_set_joinable(&opt);
- completed_thread* ct = static_cast<completed_thread*>(gpr_malloc(sizeof(*ct)));
+ completed_thread* ct =
+ static_cast<completed_thread*>(gpr_malloc(sizeof(*ct)));
// The call to gpr_thd_new() has to be under the same lock used by
// gc_completed_threads(), particularly due to ct->t, which is written here
// (internally by gpr_thd_new) and read there. Otherwise it's possible for ct
diff --git a/src/core/lib/iomgr/udp_server.cc b/src/core/lib/iomgr/udp_server.cc
index 9fabb898de..eecb3b09d9 100644
--- a/src/core/lib/iomgr/udp_server.cc
+++ b/src/core/lib/iomgr/udp_server.cc
@@ -139,7 +139,8 @@ static grpc_socket_factory* get_socket_factory(const grpc_channel_args* args) {
}
grpc_udp_server* grpc_udp_server_create(const grpc_channel_args* args) {
- grpc_udp_server* s = static_cast<grpc_udp_server*>(gpr_malloc(sizeof(grpc_udp_server)));
+ grpc_udp_server* s =
+ static_cast<grpc_udp_server*>(gpr_malloc(sizeof(grpc_udp_server)));
gpr_mu_init(&s->mu);
s->socket_factory = get_socket_factory(args);
if (s->socket_factory) {
@@ -156,7 +157,8 @@ grpc_udp_server* grpc_udp_server_create(const grpc_channel_args* args) {
}
static void shutdown_fd(void* args, grpc_error* error) {
- struct shutdown_fd_args* shutdown_args = static_cast<struct shutdown_fd_args*>(args);
+ struct shutdown_fd_args* shutdown_args =
+ static_cast<struct shutdown_fd_args*>(args);
grpc_udp_listener* sp = shutdown_args->sp;
gpr_log(GPR_DEBUG, "shutdown fd %d", sp->fd);
gpr_mu_lock(shutdown_args->server_mu);
@@ -279,7 +281,10 @@ static int bind_socket(grpc_socket_factory* socket_factory, int sockfd,
const grpc_resolved_address* addr) {
return (socket_factory != nullptr)
? grpc_socket_factory_bind(socket_factory, sockfd, addr)
- : bind(sockfd, reinterpret_cast<struct sockaddr*>(const_cast<char*>(addr->addr)), static_cast<socklen_t>(addr->len));
+ : bind(sockfd,
+ reinterpret_cast<struct sockaddr*>(
+ const_cast<char*>(addr->addr)),
+ static_cast<socklen_t>(addr->len));
}
/* Prepare a recently-created socket for listening. */
@@ -287,7 +292,8 @@ static int prepare_socket(grpc_socket_factory* socket_factory, int fd,
const grpc_resolved_address* addr, int rcv_buf_size,
int snd_buf_size) {
grpc_resolved_address sockname_temp;
- struct sockaddr* addr_ptr = reinterpret_cast<struct sockaddr*>(const_cast<char*>(addr->addr));
+ struct sockaddr* addr_ptr =
+ reinterpret_cast<struct sockaddr*>(const_cast<char*>(addr->addr));
if (fd < 0) {
goto error;
@@ -530,12 +536,14 @@ int grpc_udp_server_add_port(grpc_udp_server* s,
if (grpc_sockaddr_get_port(addr) == 0) {
for (sp = s->head; sp; sp = sp->next) {
sockname_temp.len = sizeof(struct sockaddr_storage);
- if (0 == getsockname(sp->fd, reinterpret_cast<struct sockaddr*>(sockname_temp.addr),
- reinterpret_cast<socklen_t*>(&sockname_temp.len))) {
+ if (0 ==
+ getsockname(sp->fd,
+ reinterpret_cast<struct sockaddr*>(sockname_temp.addr),
+ reinterpret_cast<socklen_t*>(&sockname_temp.len))) {
port = grpc_sockaddr_get_port(&sockname_temp);
if (port > 0) {
- allocated_addr =
- static_cast<grpc_resolved_address*>(gpr_malloc(sizeof(grpc_resolved_address)));
+ allocated_addr = static_cast<grpc_resolved_address*>(
+ gpr_malloc(sizeof(grpc_resolved_address)));
memcpy(allocated_addr, addr, sizeof(grpc_resolved_address));
grpc_sockaddr_set_port(allocated_addr, port);
addr = allocated_addr;
diff --git a/src/core/lib/iomgr/unix_sockets_posix.cc b/src/core/lib/iomgr/unix_sockets_posix.cc
index 90ed06b7d5..b603916c47 100644
--- a/src/core/lib/iomgr/unix_sockets_posix.cc
+++ b/src/core/lib/iomgr/unix_sockets_posix.cc
@@ -51,11 +51,11 @@ grpc_error* grpc_resolve_unix_domain_address(const char* name,
gpr_free(err_msg);
return err;
}
- *addrs =
- static_cast<grpc_resolved_addresses*>(gpr_malloc(sizeof(grpc_resolved_addresses)));
+ *addrs = static_cast<grpc_resolved_addresses*>(
+ gpr_malloc(sizeof(grpc_resolved_addresses)));
(*addrs)->naddrs = 1;
- (*addrs)->addrs =
- static_cast<grpc_resolved_address*>(gpr_malloc(sizeof(grpc_resolved_address)));
+ (*addrs)->addrs = static_cast<grpc_resolved_address*>(
+ gpr_malloc(sizeof(grpc_resolved_address)));
un = reinterpret_cast<struct sockaddr_un*>((*addrs)->addrs->addr);
un->sun_family = AF_UNIX;
strncpy(un->sun_path, name, sizeof(un->sun_path));
@@ -64,17 +64,20 @@ grpc_error* grpc_resolve_unix_domain_address(const char* name,
}
int grpc_is_unix_socket(const grpc_resolved_address* resolved_addr) {
- const struct sockaddr* addr = reinterpret_cast<const struct sockaddr*>(resolved_addr->addr);
+ const struct sockaddr* addr =
+ reinterpret_cast<const struct sockaddr*>(resolved_addr->addr);
return addr->sa_family == AF_UNIX;
}
void grpc_unlink_if_unix_domain_socket(
const grpc_resolved_address* resolved_addr) {
- const struct sockaddr* addr = reinterpret_cast<const struct sockaddr*>(resolved_addr->addr);
+ const struct sockaddr* addr =
+ reinterpret_cast<const struct sockaddr*>(resolved_addr->addr);
if (addr->sa_family != AF_UNIX) {
return;
}
- struct sockaddr_un* un = reinterpret_cast<struct sockaddr_un*>(const_cast<char*>(resolved_addr->addr));
+ struct sockaddr_un* un = reinterpret_cast<struct sockaddr_un*>(
+ const_cast<char*>(resolved_addr->addr));
struct stat st;
if (stat(un->sun_path, &st) == 0 && (st.st_mode & S_IFMT) == S_IFSOCK) {
@@ -84,7 +87,8 @@ void grpc_unlink_if_unix_domain_socket(
char* grpc_sockaddr_to_uri_unix_if_possible(
const grpc_resolved_address* resolved_addr) {
- const struct sockaddr* addr = reinterpret_cast<const struct sockaddr*>(resolved_addr->addr);
+ const struct sockaddr* addr =
+ reinterpret_cast<const struct sockaddr*>(resolved_addr->addr);
if (addr->sa_family != AF_UNIX) {
return nullptr;
}
diff --git a/src/core/lib/iomgr/wakeup_fd_cv.cc b/src/core/lib/iomgr/wakeup_fd_cv.cc
index 80f07ccf23..59718243e0 100644
--- a/src/core/lib/iomgr/wakeup_fd_cv.cc
+++ b/src/core/lib/iomgr/wakeup_fd_cv.cc
@@ -43,8 +43,8 @@ static grpc_error* cv_fd_init(grpc_wakeup_fd* fd_info) {
gpr_mu_lock(&g_cvfds.mu);
if (!g_cvfds.free_fds) {
newsize = GPR_MIN(g_cvfds.size * 2, g_cvfds.size + MAX_TABLE_RESIZE);
- g_cvfds.cvfds = static_cast<grpc_fd_node*>(gpr_realloc(g_cvfds.cvfds,
- sizeof(grpc_fd_node) * newsize));
+ g_cvfds.cvfds = static_cast<grpc_fd_node*>(
+ gpr_realloc(g_cvfds.cvfds, sizeof(grpc_fd_node) * newsize));
for (i = g_cvfds.size; i < newsize; i++) {
g_cvfds.cvfds[i].is_set = 0;
g_cvfds.cvfds[i].cvs = nullptr;
diff --git a/src/core/lib/json/json_reader.cc b/src/core/lib/json/json_reader.cc
index 019214a167..6dadea5006 100644
--- a/src/core/lib/json/json_reader.cc
+++ b/src/core/lib/json/json_reader.cc
@@ -417,8 +417,10 @@ grpc_json_reader_status grpc_json_reader_run(grpc_json_reader* reader) {
} else {
return GRPC_JSON_PARSE_ERROR;
}
- reader->unicode_char = static_cast<uint16_t>(reader->unicode_char << 4);
- reader->unicode_char = static_cast<uint16_t>(reader->unicode_char | c);
+ reader->unicode_char =
+ static_cast<uint16_t>(reader->unicode_char << 4);
+ reader->unicode_char =
+ static_cast<uint16_t>(reader->unicode_char | c);
switch (reader->state) {
case GRPC_JSON_STATE_STRING_ESCAPE_U1:
diff --git a/src/core/lib/json/json_string.cc b/src/core/lib/json/json_string.cc
index dcaf11d0c9..8200900956 100644
--- a/src/core/lib/json/json_string.cc
+++ b/src/core/lib/json/json_string.cc
@@ -68,7 +68,8 @@ static void json_writer_output_check(void* userdata, size_t needed) {
needed -= state->free_space;
/* Round up by 256 bytes. */
needed = (needed + 0xff) & ~0xffU;
- state->output = static_cast<char*>(gpr_realloc(state->output, state->allocated + needed));
+ state->output =
+ static_cast<char*>(gpr_realloc(state->output, state->allocated + needed));
state->free_space += needed;
state->allocated += needed;
}
diff --git a/src/core/lib/json/json_writer.cc b/src/core/lib/json/json_writer.cc
index df49cbe4dc..6d442b8716 100644
--- a/src/core/lib/json/json_writer.cc
+++ b/src/core/lib/json/json_writer.cc
@@ -179,8 +179,10 @@ static void json_writer_escape_string(grpc_json_writer* writer,
* That range is exactly 20 bits.
*/
utf32 -= 0x10000;
- json_writer_escape_utf16(writer, static_cast<uint16_t>(0xd800 | (utf32 >> 10)));
- json_writer_escape_utf16(writer, static_cast<uint16_t>(0xdc00 | (utf32 & 0x3ff)));
+ json_writer_escape_utf16(writer,
+ static_cast<uint16_t>(0xd800 | (utf32 >> 10)));
+ json_writer_escape_utf16(
+ writer, static_cast<uint16_t>(0xdc00 | (utf32 & 0x3ff)));
} else {
json_writer_escape_utf16(writer, static_cast<uint16_t>(utf32));
}
diff --git a/src/core/lib/security/context/security_context.cc b/src/core/lib/security/context/security_context.cc
index cd8fabea28..c7e212bb21 100644
--- a/src/core/lib/security/context/security_context.cc
+++ b/src/core/lib/security/context/security_context.cc
@@ -44,8 +44,8 @@ grpc_call_error grpc_call_set_credentials(grpc_call* call,
gpr_log(GPR_ERROR, "Method is client-side only.");
return GRPC_CALL_ERROR_NOT_ON_SERVER;
}
- ctx = static_cast<grpc_client_security_context*>(grpc_call_context_get(
- call, GRPC_CONTEXT_SECURITY));
+ ctx = static_cast<grpc_client_security_context*>(
+ grpc_call_context_get(call, GRPC_CONTEXT_SECURITY));
if (ctx == nullptr) {
ctx = grpc_client_security_context_create();
ctx->creds = grpc_call_credentials_ref(creds);
@@ -80,13 +80,14 @@ void grpc_auth_context_release(grpc_auth_context* context) {
/* --- grpc_client_security_context --- */
grpc_client_security_context* grpc_client_security_context_create(void) {
- return static_cast<grpc_client_security_context*>(gpr_zalloc(
- sizeof(grpc_client_security_context)));
+ return static_cast<grpc_client_security_context*>(
+ gpr_zalloc(sizeof(grpc_client_security_context)));
}
void grpc_client_security_context_destroy(void* ctx) {
grpc_core::ExecCtx exec_ctx;
- grpc_client_security_context* c = static_cast<grpc_client_security_context*>(ctx);
+ grpc_client_security_context* c =
+ static_cast<grpc_client_security_context*>(ctx);
grpc_call_credentials_unref(c->creds);
GRPC_AUTH_CONTEXT_UNREF(c->auth_context, "client_security_context");
if (c->extension.instance != nullptr && c->extension.destroy != nullptr) {
@@ -98,12 +99,13 @@ void grpc_client_security_context_destroy(void* ctx) {
/* --- grpc_server_security_context --- */
grpc_server_security_context* grpc_server_security_context_create(void) {
- return static_cast<grpc_server_security_context*>(gpr_zalloc(
- sizeof(grpc_server_security_context)));
+ return static_cast<grpc_server_security_context*>(
+ gpr_zalloc(sizeof(grpc_server_security_context)));
}
void grpc_server_security_context_destroy(void* ctx) {
- grpc_server_security_context* c = static_cast<grpc_server_security_context*>(ctx);
+ grpc_server_security_context* c =
+ static_cast<grpc_server_security_context*>(ctx);
GRPC_AUTH_CONTEXT_UNREF(c->auth_context, "server_security_context");
if (c->extension.instance != nullptr && c->extension.destroy != nullptr) {
c->extension.destroy(c->extension.instance);
@@ -258,9 +260,9 @@ static void ensure_auth_context_capacity(grpc_auth_context* ctx) {
if (ctx->properties.count == ctx->properties.capacity) {
ctx->properties.capacity =
GPR_MAX(ctx->properties.capacity + 8, ctx->properties.capacity * 2);
- ctx->properties.array = static_cast<grpc_auth_property*>(gpr_realloc(
- ctx->properties.array,
- ctx->properties.capacity * sizeof(grpc_auth_property)));
+ ctx->properties.array = static_cast<grpc_auth_property*>(
+ gpr_realloc(ctx->properties.array,
+ ctx->properties.capacity * sizeof(grpc_auth_property)));
}
}
diff --git a/src/core/lib/security/credentials/composite/composite_credentials.cc b/src/core/lib/security/credentials/composite/composite_credentials.cc
index 248177a178..ea2c4e208f 100644
--- a/src/core/lib/security/credentials/composite/composite_credentials.cc
+++ b/src/core/lib/security/credentials/composite/composite_credentials.cc
@@ -40,7 +40,8 @@ typedef struct {
} grpc_composite_call_credentials_metadata_context;
static void composite_call_destruct(grpc_call_credentials* creds) {
- grpc_composite_call_credentials* c = reinterpret_cast<grpc_composite_call_credentials*>(creds);
+ grpc_composite_call_credentials* c =
+ reinterpret_cast<grpc_composite_call_credentials*>(creds);
for (size_t i = 0; i < c->inner.num_creds; i++) {
grpc_call_credentials_unref(c->inner.creds_array[i]);
}
@@ -75,10 +76,11 @@ static bool composite_call_get_request_metadata(
grpc_auth_metadata_context auth_md_context,
grpc_credentials_mdelem_array* md_array, grpc_closure* on_request_metadata,
grpc_error** error) {
- grpc_composite_call_credentials* c = reinterpret_cast<grpc_composite_call_credentials*>(creds);
+ grpc_composite_call_credentials* c =
+ reinterpret_cast<grpc_composite_call_credentials*>(creds);
grpc_composite_call_credentials_metadata_context* ctx;
- ctx = static_cast<grpc_composite_call_credentials_metadata_context*>(gpr_zalloc(
- sizeof(grpc_composite_call_credentials_metadata_context)));
+ ctx = static_cast<grpc_composite_call_credentials_metadata_context*>(
+ gpr_zalloc(sizeof(grpc_composite_call_credentials_metadata_context)));
ctx->composite_creds = c;
ctx->pollent = pollent;
ctx->auth_md_context = auth_md_context;
@@ -106,7 +108,8 @@ static bool composite_call_get_request_metadata(
static void composite_call_cancel_get_request_metadata(
grpc_call_credentials* creds, grpc_credentials_mdelem_array* md_array,
grpc_error* error) {
- grpc_composite_call_credentials* c = reinterpret_cast<grpc_composite_call_credentials*>(creds);
+ grpc_composite_call_credentials* c =
+ reinterpret_cast<grpc_composite_call_credentials*>(creds);
for (size_t i = 0; i < c->inner.num_creds; ++i) {
grpc_call_credentials_cancel_get_request_metadata(
c->inner.creds_array[i], md_array, GRPC_ERROR_REF(error));
@@ -145,8 +148,8 @@ grpc_call_credentials* grpc_composite_call_credentials_create(
GPR_ASSERT(reserved == nullptr);
GPR_ASSERT(creds1 != nullptr);
GPR_ASSERT(creds2 != nullptr);
- c = static_cast<grpc_composite_call_credentials*>(gpr_zalloc(
- sizeof(grpc_composite_call_credentials)));
+ c = static_cast<grpc_composite_call_credentials*>(
+ gpr_zalloc(sizeof(grpc_composite_call_credentials)));
c->base.type = GRPC_CALL_CREDENTIALS_TYPE_COMPOSITE;
c->base.vtable = &composite_call_credentials_vtable;
gpr_ref_init(&c->base.refcount, 1);
diff --git a/src/core/lib/security/credentials/credentials.cc b/src/core/lib/security/credentials/credentials.cc
index c1ca881292..17f7de58be 100644
--- a/src/core/lib/security/credentials/credentials.cc
+++ b/src/core/lib/security/credentials/credentials.cc
@@ -40,8 +40,8 @@
grpc_credentials_metadata_request* grpc_credentials_metadata_request_create(
grpc_call_credentials* creds) {
grpc_credentials_metadata_request* r =
- static_cast<grpc_credentials_metadata_request*>(gpr_zalloc(
- sizeof(grpc_credentials_metadata_request)));
+ static_cast<grpc_credentials_metadata_request*>(
+ gpr_zalloc(sizeof(grpc_credentials_metadata_request)));
r->creds = grpc_call_credentials_ref(creds);
return r;
}
@@ -149,7 +149,8 @@ static void credentials_pointer_arg_destroy(void* p) {
}
static void* credentials_pointer_arg_copy(void* p) {
- return grpc_channel_credentials_ref(static_cast<grpc_channel_credentials*>(p));
+ return grpc_channel_credentials_ref(
+ static_cast<grpc_channel_credentials*>(p));
}
static int credentials_pointer_cmp(void* a, void* b) { return GPR_ICMP(a, b); }
diff --git a/src/core/lib/security/credentials/credentials_metadata.cc b/src/core/lib/security/credentials/credentials_metadata.cc
index 76e856f48e..250e384155 100644
--- a/src/core/lib/security/credentials/credentials_metadata.cc
+++ b/src/core/lib/security/credentials/credentials_metadata.cc
@@ -33,8 +33,8 @@ static void mdelem_list_ensure_capacity(grpc_credentials_mdelem_array* list,
while (new_size < target_size) {
new_size *= 2;
}
- list->md =
- static_cast<grpc_mdelem*>(gpr_realloc(list->md, sizeof(grpc_mdelem) * new_size));
+ list->md = static_cast<grpc_mdelem*>(
+ gpr_realloc(list->md, sizeof(grpc_mdelem) * new_size));
}
void grpc_credentials_mdelem_array_add(grpc_credentials_mdelem_array* list,
diff --git a/src/core/lib/security/credentials/fake/fake_credentials.cc b/src/core/lib/security/credentials/fake/fake_credentials.cc
index b4f0dfdbdc..3b29db2efa 100644
--- a/src/core/lib/security/credentials/fake/fake_credentials.cc
+++ b/src/core/lib/security/credentials/fake/fake_credentials.cc
@@ -59,8 +59,8 @@ static grpc_server_credentials_vtable
grpc_channel_credentials* grpc_fake_transport_security_credentials_create(
void) {
- grpc_channel_credentials* c =
- static_cast<grpc_channel_credentials*>(gpr_zalloc(sizeof(grpc_channel_credentials)));
+ grpc_channel_credentials* c = static_cast<grpc_channel_credentials*>(
+ gpr_zalloc(sizeof(grpc_channel_credentials)));
c->type = GRPC_CHANNEL_CREDENTIALS_TYPE_FAKE_TRANSPORT_SECURITY;
c->vtable = &fake_transport_security_credentials_vtable;
gpr_ref_init(&c->refcount, 1);
@@ -69,8 +69,8 @@ grpc_channel_credentials* grpc_fake_transport_security_credentials_create(
grpc_server_credentials* grpc_fake_transport_security_server_credentials_create(
void) {
- grpc_server_credentials* c =
- static_cast<grpc_server_credentials*>(gpr_malloc(sizeof(grpc_server_credentials)));
+ grpc_server_credentials* c = static_cast<grpc_server_credentials*>(
+ gpr_malloc(sizeof(grpc_server_credentials)));
memset(c, 0, sizeof(grpc_server_credentials));
c->type = GRPC_CHANNEL_CREDENTIALS_TYPE_FAKE_TRANSPORT_SECURITY;
gpr_ref_init(&c->refcount, 1);
@@ -97,7 +97,8 @@ const char* grpc_fake_transport_get_expected_targets(
/* -- Metadata-only test credentials. -- */
static void md_only_test_destruct(grpc_call_credentials* creds) {
- grpc_md_only_test_credentials* c = reinterpret_cast<grpc_md_only_test_credentials*>(creds);
+ grpc_md_only_test_credentials* c =
+ reinterpret_cast<grpc_md_only_test_credentials*>(creds);
GRPC_MDELEM_UNREF(c->md);
}
@@ -105,7 +106,8 @@ static bool md_only_test_get_request_metadata(
grpc_call_credentials* creds, grpc_polling_entity* pollent,
grpc_auth_metadata_context context, grpc_credentials_mdelem_array* md_array,
grpc_closure* on_request_metadata, grpc_error** error) {
- grpc_md_only_test_credentials* c = reinterpret_cast<grpc_md_only_test_credentials*>(creds);
+ grpc_md_only_test_credentials* c =
+ reinterpret_cast<grpc_md_only_test_credentials*>(creds);
grpc_credentials_mdelem_array_add(md_array, c->md);
if (c->is_async) {
GRPC_CLOSURE_SCHED(on_request_metadata, GRPC_ERROR_NONE);
@@ -126,8 +128,9 @@ static grpc_call_credentials_vtable md_only_test_vtable = {
grpc_call_credentials* grpc_md_only_test_credentials_create(
const char* md_key, const char* md_value, bool is_async) {
- grpc_md_only_test_credentials* c = static_cast<grpc_md_only_test_credentials*>(gpr_zalloc(
- sizeof(grpc_md_only_test_credentials)));
+ grpc_md_only_test_credentials* c =
+ static_cast<grpc_md_only_test_credentials*>(
+ gpr_zalloc(sizeof(grpc_md_only_test_credentials)));
c->base.type = GRPC_CALL_CREDENTIALS_TYPE_OAUTH2;
c->base.vtable = &md_only_test_vtable;
gpr_ref_init(&c->base.refcount, 1);
diff --git a/src/core/lib/security/credentials/google_default/google_default_credentials.cc b/src/core/lib/security/credentials/google_default/google_default_credentials.cc
index dd7d52d750..65455f94b3 100644
--- a/src/core/lib/security/credentials/google_default/google_default_credentials.cc
+++ b/src/core/lib/security/credentials/google_default/google_default_credentials.cc
@@ -60,7 +60,8 @@ typedef struct {
static void on_compute_engine_detection_http_response(void* user_data,
grpc_error* error) {
- compute_engine_detector* detector = static_cast<compute_engine_detector*>(user_data);
+ compute_engine_detector* detector =
+ static_cast<compute_engine_detector*>(user_data);
if (error == GRPC_ERROR_NONE && detector->response.status == 200 &&
detector->response.hdr_count > 0) {
/* Internet providers can return a generic response to all requests, so
@@ -98,7 +99,8 @@ static int is_stack_running_on_compute_engine() {
on compute engine. */
grpc_millis max_detection_delay = GPR_MS_PER_SEC;
- grpc_pollset* pollset = static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
+ grpc_pollset* pollset =
+ static_cast<grpc_pollset*>(gpr_zalloc(grpc_pollset_size()));
grpc_pollset_init(pollset, &g_polling_mu);
detector.pollent = grpc_polling_entity_create_from_pollset(pollset);
detector.is_done = 0;
@@ -171,7 +173,8 @@ static grpc_error* create_default_creds_from_path(
goto end;
}
json = grpc_json_parse_string_with_len(
- reinterpret_cast<char*>GRPC_SLICE_START_PTR(creds_data), GRPC_SLICE_LENGTH(creds_data));
+ reinterpret_cast<char*> GRPC_SLICE_START_PTR(creds_data),
+ GRPC_SLICE_LENGTH(creds_data));
if (json == nullptr) {
error = grpc_error_set_str(
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Failed to parse JSON"),
diff --git a/src/core/lib/security/credentials/iam/iam_credentials.cc b/src/core/lib/security/credentials/iam/iam_credentials.cc
index 20f4ff95f5..7f19fbc785 100644
--- a/src/core/lib/security/credentials/iam/iam_credentials.cc
+++ b/src/core/lib/security/credentials/iam/iam_credentials.cc
@@ -28,7 +28,8 @@
#include <grpc/support/sync.h>
static void iam_destruct(grpc_call_credentials* creds) {
- grpc_google_iam_credentials* c = reinterpret_cast<grpc_google_iam_credentials*>(creds);
+ grpc_google_iam_credentials* c =
+ reinterpret_cast<grpc_google_iam_credentials*>(creds);
grpc_credentials_mdelem_array_destroy(&c->md_array);
}
@@ -38,7 +39,8 @@ static bool iam_get_request_metadata(grpc_call_credentials* creds,
grpc_credentials_mdelem_array* md_array,
grpc_closure* on_request_metadata,
grpc_error** error) {
- grpc_google_iam_credentials* c = reinterpret_cast<grpc_google_iam_credentials*>(creds);
+ grpc_google_iam_credentials* c =
+ reinterpret_cast<grpc_google_iam_credentials*>(creds);
grpc_credentials_mdelem_array_append(md_array, &c->md_array);
return true;
}
diff --git a/src/core/lib/security/credentials/jwt/json_token.cc b/src/core/lib/security/credentials/jwt/json_token.cc
index eae1be17fd..f7c9f57808 100644
--- a/src/core/lib/security/credentials/jwt/json_token.cc
+++ b/src/core/lib/security/credentials/jwt/json_token.cc
@@ -219,7 +219,8 @@ static char* dot_concat_and_free_strings(char* str1, char* str2) {
size_t str1_len = strlen(str1);
size_t str2_len = strlen(str2);
size_t result_len = str1_len + 1 /* dot */ + str2_len;
- char* result = static_cast<char*>(gpr_malloc(result_len + 1 /* NULL terminated */));
+ char* result =
+ static_cast<char*>(gpr_malloc(result_len + 1 /* NULL terminated */));
char* current = result;
memcpy(current, str1, str1_len);
current += str1_len;
diff --git a/src/core/lib/security/credentials/jwt/jwt_credentials.cc b/src/core/lib/security/credentials/jwt/jwt_credentials.cc
index 44101acd78..05c08a68b0 100644
--- a/src/core/lib/security/credentials/jwt/jwt_credentials.cc
+++ b/src/core/lib/security/credentials/jwt/jwt_credentials.cc
@@ -123,8 +123,8 @@ grpc_service_account_jwt_access_credentials_create_from_auth_json_key(
gpr_log(GPR_ERROR, "Invalid input for jwt credentials creation");
return nullptr;
}
- c = static_cast<grpc_service_account_jwt_access_credentials*>(gpr_zalloc(
- sizeof(grpc_service_account_jwt_access_credentials)));
+ c = static_cast<grpc_service_account_jwt_access_credentials*>(
+ gpr_zalloc(sizeof(grpc_service_account_jwt_access_credentials)));
c->base.type = GRPC_CALL_CREDENTIALS_TYPE_JWT;
gpr_ref_init(&c->base.refcount, 1);
c->base.vtable = &jwt_vtable;
diff --git a/src/core/lib/security/credentials/jwt/jwt_verifier.cc b/src/core/lib/security/credentials/jwt/jwt_verifier.cc
index 3d7541f4c9..f5c1ada6ca 100644
--- a/src/core/lib/security/credentials/jwt/jwt_verifier.cc
+++ b/src/core/lib/security/credentials/jwt/jwt_verifier.cc
@@ -82,8 +82,9 @@ static grpc_json* parse_json_part_from_jwt(const char* str, size_t len,
gpr_log(GPR_ERROR, "Invalid base64.");
return nullptr;
}
- json = grpc_json_parse_string_with_len(reinterpret_cast<char*>GRPC_SLICE_START_PTR(*buffer),
- GRPC_SLICE_LENGTH(*buffer));
+ json = grpc_json_parse_string_with_len(
+ reinterpret_cast<char*> GRPC_SLICE_START_PTR(*buffer),
+ GRPC_SLICE_LENGTH(*buffer));
if (json == nullptr) {
grpc_slice_unref_internal(*buffer);
gpr_log(GPR_ERROR, "JSON parsing error.");
@@ -347,7 +348,8 @@ static verifier_cb_ctx* verifier_cb_ctx_create(
const char* signed_jwt, size_t signed_jwt_len, void* user_data,
grpc_jwt_verification_done_cb cb) {
grpc_core::ExecCtx exec_ctx;
- verifier_cb_ctx* ctx = static_cast<verifier_cb_ctx*>(gpr_zalloc(sizeof(verifier_cb_ctx)));
+ verifier_cb_ctx* ctx =
+ static_cast<verifier_cb_ctx*>(gpr_zalloc(sizeof(verifier_cb_ctx)));
ctx->verifier = verifier;
ctx->pollent = grpc_polling_entity_create_from_pollset(pollset);
ctx->header = header;
@@ -754,8 +756,8 @@ const char* grpc_jwt_issuer_email_domain(const char* issuer) {
if (dot == nullptr || dot == email_domain) return email_domain;
GPR_ASSERT(dot > email_domain);
/* There may be a subdomain, we just want the domain. */
- dot = static_cast<const char*>(gpr_memrchr((void*)email_domain, '.',
- static_cast<size_t>(dot - email_domain)));
+ dot = static_cast<const char*>(gpr_memrchr(
+ (void*)email_domain, '.', static_cast<size_t>(dot - email_domain)));
if (dot == nullptr) return email_domain;
return dot + 1;
}
@@ -861,7 +863,8 @@ void grpc_jwt_verifier_verify(grpc_jwt_verifier* verifier,
cb != nullptr);
dot = strchr(cur, '.');
if (dot == nullptr) goto error;
- json = parse_json_part_from_jwt(cur, static_cast<size_t>(dot - cur), &header_buffer);
+ json = parse_json_part_from_jwt(cur, static_cast<size_t>(dot - cur),
+ &header_buffer);
if (json == nullptr) goto error;
header = jose_header_from_json(json, header_buffer);
if (header == nullptr) goto error;
@@ -869,7 +872,8 @@ void grpc_jwt_verifier_verify(grpc_jwt_verifier* verifier,
cur = dot + 1;
dot = strchr(cur, '.');
if (dot == nullptr) goto error;
- json = parse_json_part_from_jwt(cur, static_cast<size_t>(dot - cur), &claims_buffer);
+ json = parse_json_part_from_jwt(cur, static_cast<size_t>(dot - cur),
+ &claims_buffer);
if (json == nullptr) goto error;
claims = grpc_jwt_claims_from_json(json, claims_buffer);
if (claims == nullptr) goto error;
@@ -898,8 +902,8 @@ grpc_jwt_verifier* grpc_jwt_verifier_create(
/* We know at least of one mapping. */
v->allocated_mappings = 1 + num_mappings;
- v->mappings = static_cast<email_key_mapping*>(gpr_malloc(v->allocated_mappings *
- sizeof(email_key_mapping)));
+ v->mappings = static_cast<email_key_mapping*>(
+ gpr_malloc(v->allocated_mappings * sizeof(email_key_mapping)));
verifier_put_mapping(v, GRPC_GOOGLE_SERVICE_ACCOUNTS_EMAIL_DOMAIN,
GRPC_GOOGLE_SERVICE_ACCOUNTS_KEY_URL_PREFIX);
/* User-Provided mappings. */
diff --git a/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc b/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc
index b4fb9a43e7..afae7d8f2f 100644
--- a/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc
+++ b/src/core/lib/security/credentials/oauth2/oauth2_credentials.cc
@@ -128,7 +128,8 @@ grpc_oauth2_token_fetcher_credentials_parse_server_response(
}
if (response->body_length > 0) {
- null_terminated_body = static_cast<char*>(gpr_malloc(response->body_length + 1));
+ null_terminated_body =
+ static_cast<char*>(gpr_malloc(response->body_length + 1));
null_terminated_body[response->body_length] = '\0';
memcpy(null_terminated_body, response->body, response->body_length);
}
@@ -269,8 +270,8 @@ static bool oauth2_token_fetcher_get_request_metadata(
// Couldn't get the token from the cache.
// Add request to c->pending_requests and start a new fetch if needed.
grpc_oauth2_pending_get_request_metadata* pending_request =
- static_cast<grpc_oauth2_pending_get_request_metadata*>(gpr_malloc(
- sizeof(*pending_request)));
+ static_cast<grpc_oauth2_pending_get_request_metadata*>(
+ gpr_malloc(sizeof(*pending_request)));
pending_request->md_array = md_array;
pending_request->on_request_metadata = on_request_metadata;
pending_request->pollent = pollent;
@@ -371,8 +372,8 @@ static void compute_engine_fetch_oauth2(
grpc_call_credentials* grpc_google_compute_engine_credentials_create(
void* reserved) {
grpc_oauth2_token_fetcher_credentials* c =
- static_cast<grpc_oauth2_token_fetcher_credentials*>(gpr_malloc(
- sizeof(grpc_oauth2_token_fetcher_credentials)));
+ static_cast<grpc_oauth2_token_fetcher_credentials*>(
+ gpr_malloc(sizeof(grpc_oauth2_token_fetcher_credentials)));
GRPC_API_TRACE("grpc_compute_engine_credentials_create(reserved=%p)", 1,
(reserved));
GPR_ASSERT(reserved == nullptr);
@@ -401,7 +402,8 @@ static void refresh_token_fetch_oauth2(
grpc_httpcli_context* httpcli_context, grpc_polling_entity* pollent,
grpc_iomgr_cb_func response_cb, grpc_millis deadline) {
grpc_google_refresh_token_credentials* c =
- reinterpret_cast<grpc_google_refresh_token_credentials*>(metadata_req->creds);
+ reinterpret_cast<grpc_google_refresh_token_credentials*>(
+ metadata_req->creds);
grpc_http_header header = {(char*)"Content-Type",
(char*)"application/x-www-form-urlencoded"};
grpc_httpcli_request request;
@@ -437,8 +439,8 @@ grpc_refresh_token_credentials_create_from_auth_refresh_token(
gpr_log(GPR_ERROR, "Invalid input for refresh token credentials creation");
return nullptr;
}
- c = static_cast<grpc_google_refresh_token_credentials*>(gpr_zalloc(
- sizeof(grpc_google_refresh_token_credentials)));
+ c = static_cast<grpc_google_refresh_token_credentials*>(
+ gpr_zalloc(sizeof(grpc_google_refresh_token_credentials)));
init_oauth2_token_fetcher(&c->base, refresh_token_fetch_oauth2);
c->base.base.vtable = &refresh_token_vtable;
c->refresh_token = refresh_token;
@@ -478,7 +480,8 @@ grpc_call_credentials* grpc_google_refresh_token_credentials_create(
//
static void access_token_destruct(grpc_call_credentials* creds) {
- grpc_access_token_credentials* c = reinterpret_cast<grpc_access_token_credentials*>(creds);
+ grpc_access_token_credentials* c =
+ reinterpret_cast<grpc_access_token_credentials*>(creds);
GRPC_MDELEM_UNREF(c->access_token_md);
}
@@ -486,7 +489,8 @@ static bool access_token_get_request_metadata(
grpc_call_credentials* creds, grpc_polling_entity* pollent,
grpc_auth_metadata_context context, grpc_credentials_mdelem_array* md_array,
grpc_closure* on_request_metadata, grpc_error** error) {
- grpc_access_token_credentials* c = reinterpret_cast<grpc_access_token_credentials*>(creds);
+ grpc_access_token_credentials* c =
+ reinterpret_cast<grpc_access_token_credentials*>(creds);
grpc_credentials_mdelem_array_add(md_array, c->access_token_md);
return true;
}
@@ -503,8 +507,9 @@ static grpc_call_credentials_vtable access_token_vtable = {
grpc_call_credentials* grpc_access_token_credentials_create(
const char* access_token, void* reserved) {
- grpc_access_token_credentials* c = static_cast<grpc_access_token_credentials*>(gpr_zalloc(
- sizeof(grpc_access_token_credentials)));
+ grpc_access_token_credentials* c =
+ static_cast<grpc_access_token_credentials*>(
+ gpr_zalloc(sizeof(grpc_access_token_credentials)));
GRPC_API_TRACE(
"grpc_access_token_credentials_create(access_token=<redacted>, "
"reserved=%p)",
diff --git a/src/core/lib/security/credentials/plugin/plugin_credentials.cc b/src/core/lib/security/credentials/plugin/plugin_credentials.cc
index 89f94f9e6d..ddb86e153b 100644
--- a/src/core/lib/security/credentials/plugin/plugin_credentials.cc
+++ b/src/core/lib/security/credentials/plugin/plugin_credentials.cc
@@ -34,7 +34,8 @@
grpc_core::TraceFlag grpc_plugin_credentials_trace(false, "plugin_credentials");
static void plugin_destruct(grpc_call_credentials* creds) {
- grpc_plugin_credentials* c = reinterpret_cast<grpc_plugin_credentials*>(creds);
+ grpc_plugin_credentials* c =
+ reinterpret_cast<grpc_plugin_credentials*>(creds);
gpr_mu_destroy(&c->mu);
if (c->plugin.state != nullptr && c->plugin.destroy != nullptr) {
c->plugin.destroy(c->plugin.state);
@@ -147,13 +148,14 @@ static bool plugin_get_request_metadata(grpc_call_credentials* creds,
grpc_credentials_mdelem_array* md_array,
grpc_closure* on_request_metadata,
grpc_error** error) {
- grpc_plugin_credentials* c = reinterpret_cast<grpc_plugin_credentials*>(creds);
+ grpc_plugin_credentials* c =
+ reinterpret_cast<grpc_plugin_credentials*>(creds);
bool retval = true; // Synchronous return.
if (c->plugin.get_metadata != nullptr) {
// Create pending_request object.
grpc_plugin_credentials_pending_request* pending_request =
- static_cast<grpc_plugin_credentials_pending_request*>(gpr_zalloc(
- sizeof(*pending_request)));
+ static_cast<grpc_plugin_credentials_pending_request*>(
+ gpr_zalloc(sizeof(*pending_request)));
pending_request->creds = c;
pending_request->md_array = md_array;
pending_request->on_request_metadata = on_request_metadata;
@@ -225,7 +227,8 @@ static bool plugin_get_request_metadata(grpc_call_credentials* creds,
static void plugin_cancel_get_request_metadata(
grpc_call_credentials* creds, grpc_credentials_mdelem_array* md_array,
grpc_error* error) {
- grpc_plugin_credentials* c = reinterpret_cast<grpc_plugin_credentials*>(creds);
+ grpc_plugin_credentials* c =
+ reinterpret_cast<grpc_plugin_credentials*>(creds);
gpr_mu_lock(&c->mu);
for (grpc_plugin_credentials_pending_request* pending_request =
c->pending_requests;
@@ -252,7 +255,8 @@ static grpc_call_credentials_vtable plugin_vtable = {
grpc_call_credentials* grpc_metadata_credentials_create_from_plugin(
grpc_metadata_credentials_plugin plugin, void* reserved) {
- grpc_plugin_credentials* c = static_cast<grpc_plugin_credentials*>(gpr_zalloc(sizeof(*c)));
+ grpc_plugin_credentials* c =
+ static_cast<grpc_plugin_credentials*>(gpr_zalloc(sizeof(*c)));
GRPC_API_TRACE("grpc_metadata_credentials_create_from_plugin(reserved=%p)", 1,
(reserved));
GPR_ASSERT(reserved == nullptr);
diff --git a/src/core/lib/security/credentials/ssl/ssl_credentials.cc b/src/core/lib/security/credentials/ssl/ssl_credentials.cc
index 4237039274..a4fce25f3a 100644
--- a/src/core/lib/security/credentials/ssl/ssl_credentials.cc
+++ b/src/core/lib/security/credentials/ssl/ssl_credentials.cc
@@ -85,8 +85,8 @@ static void ssl_build_config(const char* pem_root_certs,
if (pem_key_cert_pair != nullptr) {
GPR_ASSERT(pem_key_cert_pair->private_key != nullptr);
GPR_ASSERT(pem_key_cert_pair->cert_chain != nullptr);
- config->pem_key_cert_pair = static_cast<tsi_ssl_pem_key_cert_pair*>(gpr_zalloc(
- sizeof(tsi_ssl_pem_key_cert_pair)));
+ config->pem_key_cert_pair = static_cast<tsi_ssl_pem_key_cert_pair*>(
+ gpr_zalloc(sizeof(tsi_ssl_pem_key_cert_pair)));
config->pem_key_cert_pair->cert_chain =
gpr_strdup(pem_key_cert_pair->cert_chain);
config->pem_key_cert_pair->private_key =
@@ -97,8 +97,8 @@ static void ssl_build_config(const char* pem_root_certs,
grpc_channel_credentials* grpc_ssl_credentials_create(
const char* pem_root_certs, grpc_ssl_pem_key_cert_pair* pem_key_cert_pair,
void* reserved) {
- grpc_ssl_credentials* c =
- static_cast<grpc_ssl_credentials*>(gpr_zalloc(sizeof(grpc_ssl_credentials)));
+ grpc_ssl_credentials* c = static_cast<grpc_ssl_credentials*>(
+ gpr_zalloc(sizeof(grpc_ssl_credentials)));
GRPC_API_TRACE(
"grpc_ssl_credentials_create(pem_root_certs=%s, "
"pem_key_cert_pair=%p, "
@@ -123,7 +123,8 @@ struct grpc_ssl_server_credentials_options {
};
static void ssl_server_destruct(grpc_server_credentials* creds) {
- grpc_ssl_server_credentials* c = reinterpret_cast<grpc_ssl_server_credentials*>(creds);
+ grpc_ssl_server_credentials* c =
+ reinterpret_cast<grpc_ssl_server_credentials*>(creds);
grpc_tsi_ssl_pem_key_cert_pairs_destroy(c->config.pem_key_cert_pairs,
c->config.num_key_cert_pairs);
gpr_free(c->config.pem_root_certs);
@@ -143,8 +144,8 @@ tsi_ssl_pem_key_cert_pair* grpc_convert_grpc_to_tsi_cert_pairs(
tsi_ssl_pem_key_cert_pair* tsi_pairs = nullptr;
if (num_key_cert_pairs > 0) {
GPR_ASSERT(pem_key_cert_pairs != nullptr);
- tsi_pairs = static_cast<tsi_ssl_pem_key_cert_pair*>(gpr_zalloc(
- num_key_cert_pairs * sizeof(tsi_ssl_pem_key_cert_pair)));
+ tsi_pairs = static_cast<tsi_ssl_pem_key_cert_pair*>(
+ gpr_zalloc(num_key_cert_pairs * sizeof(tsi_ssl_pem_key_cert_pair)));
}
for (size_t i = 0; i < num_key_cert_pairs; i++) {
GPR_ASSERT(pem_key_cert_pairs[i].private_key != nullptr);
@@ -174,15 +175,15 @@ grpc_ssl_server_certificate_config* grpc_ssl_server_certificate_config_create(
const grpc_ssl_pem_key_cert_pair* pem_key_cert_pairs,
size_t num_key_cert_pairs) {
grpc_ssl_server_certificate_config* config =
- static_cast<grpc_ssl_server_certificate_config*>(gpr_zalloc(
- sizeof(grpc_ssl_server_certificate_config)));
+ static_cast<grpc_ssl_server_certificate_config*>(
+ gpr_zalloc(sizeof(grpc_ssl_server_certificate_config)));
if (pem_root_certs != nullptr) {
config->pem_root_certs = gpr_strdup(pem_root_certs);
}
if (num_key_cert_pairs > 0) {
GPR_ASSERT(pem_key_cert_pairs != nullptr);
- config->pem_key_cert_pairs = static_cast<grpc_ssl_pem_key_cert_pair*>(gpr_zalloc(
- num_key_cert_pairs * sizeof(grpc_ssl_pem_key_cert_pair)));
+ config->pem_key_cert_pairs = static_cast<grpc_ssl_pem_key_cert_pair*>(
+ gpr_zalloc(num_key_cert_pairs * sizeof(grpc_ssl_pem_key_cert_pair)));
}
config->num_key_cert_pairs = num_key_cert_pairs;
for (size_t i = 0; i < num_key_cert_pairs; i++) {
@@ -217,8 +218,8 @@ grpc_ssl_server_credentials_create_options_using_config(
gpr_log(GPR_ERROR, "Certificate config must not be NULL.");
goto done;
}
- options = static_cast<grpc_ssl_server_credentials_options*>(gpr_zalloc(
- sizeof(grpc_ssl_server_credentials_options)));
+ options = static_cast<grpc_ssl_server_credentials_options*>(
+ gpr_zalloc(sizeof(grpc_ssl_server_credentials_options)));
options->client_certificate_request = client_certificate_request;
options->certificate_config = config;
done:
@@ -235,14 +236,14 @@ grpc_ssl_server_credentials_create_options_using_config_fetcher(
}
grpc_ssl_server_certificate_config_fetcher* fetcher =
- static_cast<grpc_ssl_server_certificate_config_fetcher*>(gpr_zalloc(
- sizeof(grpc_ssl_server_certificate_config_fetcher)));
+ static_cast<grpc_ssl_server_certificate_config_fetcher*>(
+ gpr_zalloc(sizeof(grpc_ssl_server_certificate_config_fetcher)));
fetcher->cb = cb;
fetcher->user_data = user_data;
grpc_ssl_server_credentials_options* options =
- static_cast<grpc_ssl_server_credentials_options*>(gpr_zalloc(
- sizeof(grpc_ssl_server_credentials_options)));
+ static_cast<grpc_ssl_server_credentials_options*>(
+ gpr_zalloc(sizeof(grpc_ssl_server_credentials_options)));
options->client_certificate_request = client_certificate_request;
options->certificate_config_fetcher = fetcher;
@@ -307,8 +308,8 @@ grpc_server_credentials* grpc_ssl_server_credentials_create_with_options(
goto done;
}
- c = static_cast<grpc_ssl_server_credentials*>(gpr_zalloc(
- sizeof(grpc_ssl_server_credentials)));
+ c = static_cast<grpc_ssl_server_credentials*>(
+ gpr_zalloc(sizeof(grpc_ssl_server_credentials)));
c->base.type = GRPC_CHANNEL_CREDENTIALS_TYPE_SSL;
gpr_ref_init(&c->base.refcount, 1);
c->base.vtable = &ssl_server_vtable;
diff --git a/src/core/lib/security/transport/client_auth_filter.cc b/src/core/lib/security/transport/client_auth_filter.cc
index b5171acc87..d2313807ff 100644
--- a/src/core/lib/security/transport/client_auth_filter.cc
+++ b/src/core/lib/security/transport/client_auth_filter.cc
@@ -93,7 +93,8 @@ static void add_error(grpc_error** combined, grpc_error* error) {
}
static void on_credentials_metadata(void* arg, grpc_error* input_error) {
- grpc_transport_stream_op_batch* batch = static_cast<grpc_transport_stream_op_batch*>(arg);
+ grpc_transport_stream_op_batch* batch =
+ static_cast<grpc_transport_stream_op_batch*>(arg);
grpc_call_element* elem =
static_cast<grpc_call_element*>(batch->handler_private.extra_arg);
call_data* calld = static_cast<call_data*>(elem->call_data);
@@ -173,9 +174,8 @@ static void send_security_metadata(grpc_call_element* elem,
call_data* calld = static_cast<call_data*>(elem->call_data);
channel_data* chand = static_cast<channel_data*>(elem->channel_data);
grpc_client_security_context* ctx =
- static_cast<grpc_client_security_context*>(batch->payload
- ->context[GRPC_CONTEXT_SECURITY]
- .value);
+ static_cast<grpc_client_security_context*>(
+ batch->payload->context[GRPC_CONTEXT_SECURITY].value);
grpc_call_credentials* channel_call_creds =
chand->security_connector->request_metadata_creds;
int call_creds_has_md = (ctx != nullptr) && (ctx->creds != nullptr);
@@ -231,7 +231,8 @@ static void send_security_metadata(grpc_call_element* elem,
}
static void on_host_checked(void* arg, grpc_error* error) {
- grpc_transport_stream_op_batch* batch = static_cast<grpc_transport_stream_op_batch*>(arg);
+ grpc_transport_stream_op_batch* batch =
+ static_cast<grpc_transport_stream_op_batch*>(arg);
grpc_call_element* elem =
static_cast<grpc_call_element*>(batch->handler_private.extra_arg);
call_data* calld = static_cast<call_data*>(elem->call_data);
@@ -283,9 +284,8 @@ static void auth_start_transport_stream_op_batch(
grpc_client_security_context_destroy;
}
grpc_client_security_context* sec_ctx =
- static_cast<grpc_client_security_context*>(batch->payload
- ->context[GRPC_CONTEXT_SECURITY]
- .value);
+ static_cast<grpc_client_security_context*>(
+ batch->payload->context[GRPC_CONTEXT_SECURITY].value);
GRPC_AUTH_CONTEXT_UNREF(sec_ctx->auth_context, "client auth filter");
sec_ctx->auth_context =
GRPC_AUTH_CONTEXT_REF(chand->auth_context, "client_auth_filter");
@@ -400,8 +400,8 @@ static grpc_error* init_channel_elem(grpc_channel_element* elem,
/* initialize members */
chand->security_connector =
- reinterpret_cast<grpc_channel_security_connector*>(GRPC_SECURITY_CONNECTOR_REF(
- sc, "client_auth_filter"));
+ reinterpret_cast<grpc_channel_security_connector*>(
+ GRPC_SECURITY_CONNECTOR_REF(sc, "client_auth_filter"));
chand->auth_context =
GRPC_AUTH_CONTEXT_REF(auth_context, "client_auth_filter");
return GRPC_ERROR_NONE;
diff --git a/src/core/lib/security/transport/lb_targets_info.cc b/src/core/lib/security/transport/lb_targets_info.cc
index 84a72731c9..67a3c7449d 100644
--- a/src/core/lib/security/transport/lb_targets_info.cc
+++ b/src/core/lib/security/transport/lb_targets_info.cc
@@ -32,8 +32,9 @@ static void targets_info_destroy(void* p) {
grpc_slice_hash_table_unref(static_cast<grpc_slice_hash_table*>(p));
}
static int targets_info_cmp(void* a, void* b) {
- return grpc_slice_hash_table_cmp(static_cast<const grpc_slice_hash_table*>(a),
- static_cast<const grpc_slice_hash_table*>(b));
+ return grpc_slice_hash_table_cmp(
+ static_cast<const grpc_slice_hash_table*>(a),
+ static_cast<const grpc_slice_hash_table*>(b));
}
static const grpc_arg_pointer_vtable server_to_balancer_names_vtable = {
targets_info_copy, targets_info_destroy, targets_info_cmp};
@@ -51,7 +52,8 @@ grpc_slice_hash_table* grpc_lb_targets_info_find_in_args(
grpc_channel_args_find(args, GRPC_ARG_LB_SECURE_NAMING_MAP);
if (targets_info_arg != nullptr) {
GPR_ASSERT(targets_info_arg->type == GRPC_ARG_POINTER);
- return static_cast<grpc_slice_hash_table*>(targets_info_arg->value.pointer.p);
+ return static_cast<grpc_slice_hash_table*>(
+ targets_info_arg->value.pointer.p);
}
return nullptr;
}
diff --git a/src/core/lib/security/transport/secure_endpoint.cc b/src/core/lib/security/transport/secure_endpoint.cc
index a63dbc07c8..f72f8b6121 100644
--- a/src/core/lib/security/transport/secure_endpoint.cc
+++ b/src/core/lib/security/transport/secure_endpoint.cc
@@ -205,7 +205,8 @@ static void on_read(void* user_data, grpc_error* error) {
ep->read_buffer,
grpc_slice_split_head(
&ep->read_staging_buffer,
- static_cast<size_t>(cur - GRPC_SLICE_START_PTR(ep->read_staging_buffer))));
+ static_cast<size_t>(
+ cur - GRPC_SLICE_START_PTR(ep->read_staging_buffer))));
}
}
@@ -324,8 +325,8 @@ static void endpoint_write(grpc_endpoint* secure_ep, grpc_slice_buffer* slices,
&ep->output_buffer,
grpc_slice_split_head(
&ep->write_staging_buffer,
- static_cast<size_t>(cur -
- GRPC_SLICE_START_PTR(ep->write_staging_buffer))));
+ static_cast<size_t>(
+ cur - GRPC_SLICE_START_PTR(ep->write_staging_buffer))));
}
}
}
@@ -403,7 +404,8 @@ grpc_endpoint* grpc_secure_endpoint_create(
grpc_endpoint* transport, grpc_slice* leftover_slices,
size_t leftover_nslices) {
size_t i;
- secure_endpoint* ep = static_cast<secure_endpoint*>(gpr_malloc(sizeof(secure_endpoint)));
+ secure_endpoint* ep =
+ static_cast<secure_endpoint*>(gpr_malloc(sizeof(secure_endpoint)));
ep->base.vtable = &vtable;
ep->wrapped_ep = transport;
ep->protector = protector;
diff --git a/src/core/lib/security/transport/security_connector.cc b/src/core/lib/security/transport/security_connector.cc
index e9a2d23535..bd5da1bbd2 100644
--- a/src/core/lib/security/transport/security_connector.cc
+++ b/src/core/lib/security/transport/security_connector.cc
@@ -498,7 +498,8 @@ grpc_channel_security_connector* grpc_fake_channel_security_connector_create(
grpc_call_credentials* request_metadata_creds, const char* target,
const grpc_channel_args* args) {
grpc_fake_channel_security_connector* c =
- static_cast<grpc_fake_channel_security_connector*>(gpr_zalloc(sizeof(*c)));
+ static_cast<grpc_fake_channel_security_connector*>(
+ gpr_zalloc(sizeof(*c)));
gpr_ref_init(&c->base.base.refcount, 1);
c->base.base.url_scheme = GRPC_FAKE_SECURITY_URL_SCHEME;
c->base.base.vtable = &fake_channel_vtable;
@@ -518,8 +519,8 @@ grpc_channel_security_connector* grpc_fake_channel_security_connector_create(
grpc_server_security_connector* grpc_fake_server_security_connector_create(
grpc_server_credentials* server_creds) {
grpc_server_security_connector* c =
- static_cast<grpc_server_security_connector*>(gpr_zalloc(
- sizeof(grpc_server_security_connector)));
+ static_cast<grpc_server_security_connector*>(
+ gpr_zalloc(sizeof(grpc_server_security_connector)));
gpr_ref_init(&c->base.refcount, 1);
c->base.vtable = &fake_server_vtable;
c->base.url_scheme = GRPC_FAKE_SECURITY_URL_SCHEME;
@@ -597,8 +598,8 @@ static void ssl_channel_add_handshakers(grpc_channel_security_connector* sc,
static const char** fill_alpn_protocol_strings(size_t* num_alpn_protocols) {
GPR_ASSERT(num_alpn_protocols != nullptr);
*num_alpn_protocols = grpc_chttp2_num_alpn_versions();
- const char** alpn_protocol_strings =
- static_cast<const char**>(gpr_malloc(sizeof(const char*) * (*num_alpn_protocols)));
+ const char** alpn_protocol_strings = static_cast<const char**>(
+ gpr_malloc(sizeof(const char*) * (*num_alpn_protocols)));
for (size_t i = 0; i < *num_alpn_protocols; i++) {
alpn_protocol_strings[i] = grpc_chttp2_get_alpn_version_index(i);
}
@@ -632,8 +633,8 @@ static bool try_replace_server_handshaker_factory(
cert_pairs, config->num_key_cert_pairs, config->pem_root_certs,
get_tsi_client_certificate_request_type(
server_creds->config.client_certificate_request),
- ssl_cipher_suites(), alpn_protocol_strings, static_cast<uint16_t>(num_alpn_protocols),
- &new_handshaker_factory);
+ ssl_cipher_suites(), alpn_protocol_strings,
+ static_cast<uint16_t>(num_alpn_protocols), &new_handshaker_factory);
gpr_free(cert_pairs);
gpr_free((void*)alpn_protocol_strings);
@@ -850,8 +851,8 @@ tsi_peer tsi_shallow_peer_from_ssl_auth_context(
while (grpc_auth_property_iterator_next(&it) != nullptr) max_num_props++;
if (max_num_props > 0) {
- peer.properties = static_cast<tsi_peer_property*>(gpr_malloc(max_num_props *
- sizeof(tsi_peer_property)));
+ peer.properties = static_cast<tsi_peer_property*>(
+ gpr_malloc(max_num_props * sizeof(tsi_peer_property)));
it = grpc_auth_context_property_iterator(auth_context);
while ((prop = grpc_auth_property_iterator_next(&it)) != nullptr) {
if (strcmp(prop->name, GRPC_X509_SAN_PROPERTY_NAME) == 0) {
@@ -963,7 +964,8 @@ const char* grpc_get_default_ssl_roots(void) {
gpr_once_init(&once, init_default_pem_root_certs);
return GRPC_SLICE_IS_EMPTY(default_pem_root_certs)
? nullptr
- : reinterpret_cast<const char*>GRPC_SLICE_START_PTR(default_pem_root_certs);
+ : reinterpret_cast<const char*>
+ GRPC_SLICE_START_PTR(default_pem_root_certs);
}
grpc_security_status grpc_ssl_channel_security_connector_create(
@@ -994,8 +996,8 @@ grpc_security_status grpc_ssl_channel_security_connector_create(
pem_root_certs = config->pem_root_certs;
}
- c = static_cast<grpc_ssl_channel_security_connector*>(gpr_zalloc(
- sizeof(grpc_ssl_channel_security_connector)));
+ c = static_cast<grpc_ssl_channel_security_connector*>(
+ gpr_zalloc(sizeof(grpc_ssl_channel_security_connector)));
gpr_ref_init(&c->base.base.refcount, 1);
c->base.base.vtable = &ssl_channel_vtable;
@@ -1017,8 +1019,8 @@ grpc_security_status grpc_ssl_channel_security_connector_create(
config->pem_key_cert_pair->cert_chain != nullptr;
result = tsi_create_ssl_client_handshaker_factory(
has_key_cert_pair ? config->pem_key_cert_pair : nullptr, pem_root_certs,
- ssl_cipher_suites(), alpn_protocol_strings, static_cast<uint16_t>(num_alpn_protocols),
- &c->client_handshaker_factory);
+ ssl_cipher_suites(), alpn_protocol_strings,
+ static_cast<uint16_t>(num_alpn_protocols), &c->client_handshaker_factory);
if (result != TSI_OK) {
gpr_log(GPR_ERROR, "Handshaker factory creation failed with %s.",
tsi_result_to_string(result));
@@ -1039,8 +1041,8 @@ static grpc_ssl_server_security_connector*
grpc_ssl_server_security_connector_initialize(
grpc_server_credentials* server_creds) {
grpc_ssl_server_security_connector* c =
- static_cast<grpc_ssl_server_security_connector*>(gpr_zalloc(
- sizeof(grpc_ssl_server_security_connector)));
+ static_cast<grpc_ssl_server_security_connector*>(
+ gpr_zalloc(sizeof(grpc_ssl_server_security_connector)));
gpr_ref_init(&c->base.base.refcount, 1);
c->base.base.url_scheme = GRPC_SSL_URL_SCHEME;
c->base.base.vtable = &ssl_server_vtable;
@@ -1078,7 +1080,8 @@ grpc_security_status grpc_ssl_server_security_connector_create(
get_tsi_client_certificate_request_type(
server_credentials->config.client_certificate_request),
ssl_cipher_suites(), alpn_protocol_strings,
- static_cast<uint16_t>(num_alpn_protocols), &c->server_handshaker_factory);
+ static_cast<uint16_t>(num_alpn_protocols),
+ &c->server_handshaker_factory);
gpr_free((void*)alpn_protocol_strings);
if (result != TSI_OK) {
gpr_log(GPR_ERROR, "Handshaker factory creation failed with %s.",
diff --git a/src/core/lib/security/transport/security_handshaker.cc b/src/core/lib/security/transport/security_handshaker.cc
index 2e7c3570b6..b37392ab81 100644
--- a/src/core/lib/security/transport/security_handshaker.cc
+++ b/src/core/lib/security/transport/security_handshaker.cc
@@ -68,8 +68,8 @@ typedef struct {
static size_t move_read_buffer_into_handshake_buffer(security_handshaker* h) {
size_t bytes_in_read_buffer = h->args->read_buffer->length;
if (h->handshake_buffer_size < bytes_in_read_buffer) {
- h->handshake_buffer =
- static_cast<uint8_t*>(gpr_realloc(h->handshake_buffer, bytes_in_read_buffer));
+ h->handshake_buffer = static_cast<uint8_t*>(
+ gpr_realloc(h->handshake_buffer, bytes_in_read_buffer));
h->handshake_buffer_size = bytes_in_read_buffer;
}
size_t offset = 0;
@@ -408,15 +408,16 @@ static const grpc_handshaker_vtable security_handshaker_vtable = {
static grpc_handshaker* security_handshaker_create(
tsi_handshaker* handshaker, grpc_security_connector* connector) {
- security_handshaker* h =
- static_cast<security_handshaker*>(gpr_zalloc(sizeof(security_handshaker)));
+ security_handshaker* h = static_cast<security_handshaker*>(
+ gpr_zalloc(sizeof(security_handshaker)));
grpc_handshaker_init(&security_handshaker_vtable, &h->base);
h->handshaker = handshaker;
h->connector = GRPC_SECURITY_CONNECTOR_REF(connector, "handshake");
gpr_mu_init(&h->mu);
gpr_ref_init(&h->refs, 1);
h->handshake_buffer_size = GRPC_INITIAL_HANDSHAKE_BUFFER_SIZE;
- h->handshake_buffer = static_cast<uint8_t*>(gpr_malloc(h->handshake_buffer_size));
+ h->handshake_buffer =
+ static_cast<uint8_t*>(gpr_malloc(h->handshake_buffer_size));
GRPC_CLOSURE_INIT(&h->on_handshake_data_sent_to_peer,
on_handshake_data_sent_to_peer, h,
grpc_schedule_on_exec_ctx);
@@ -469,8 +470,8 @@ static void client_handshaker_factory_add_handshakers(
grpc_handshaker_factory* handshaker_factory, const grpc_channel_args* args,
grpc_handshake_manager* handshake_mgr) {
grpc_channel_security_connector* security_connector =
- reinterpret_cast<grpc_channel_security_connector*>(grpc_security_connector_find_in_args(
- args));
+ reinterpret_cast<grpc_channel_security_connector*>(
+ grpc_security_connector_find_in_args(args));
grpc_channel_security_connector_add_handshakers(security_connector,
handshake_mgr);
}
@@ -479,8 +480,8 @@ static void server_handshaker_factory_add_handshakers(
grpc_handshaker_factory* hf, const grpc_channel_args* args,
grpc_handshake_manager* handshake_mgr) {
grpc_server_security_connector* security_connector =
- reinterpret_cast<grpc_server_security_connector*>(grpc_security_connector_find_in_args(
- args));
+ reinterpret_cast<grpc_server_security_connector*>(
+ grpc_security_connector_find_in_args(args));
grpc_server_security_connector_add_handshakers(security_connector,
handshake_mgr);
}
diff --git a/src/core/lib/slice/b64.cc b/src/core/lib/slice/b64.cc
index 1d938be11c..3e19b7197f 100644
--- a/src/core/lib/slice/b64.cc
+++ b/src/core/lib/slice/b64.cc
@@ -128,13 +128,15 @@ grpc_slice grpc_base64_decode(const char* b64, int url_safe) {
static void decode_one_char(const unsigned char* codes, unsigned char* result,
size_t* result_offset) {
- uint32_t packed = (static_cast<uint32_t>(codes[0]) << 2) | (static_cast<uint32_t>(codes[1]) >> 4);
+ uint32_t packed = (static_cast<uint32_t>(codes[0]) << 2) |
+ (static_cast<uint32_t>(codes[1]) >> 4);
result[(*result_offset)++] = static_cast<unsigned char>(packed);
}
static void decode_two_chars(const unsigned char* codes, unsigned char* result,
size_t* result_offset) {
- uint32_t packed = (static_cast<uint32_t>(codes[0]) << 10) | (static_cast<uint32_t>(codes[1]) << 4) |
+ uint32_t packed = (static_cast<uint32_t>(codes[0]) << 10) |
+ (static_cast<uint32_t>(codes[1]) << 4) |
(static_cast<uint32_t>(codes[2]) >> 2);
result[(*result_offset)++] = static_cast<unsigned char>(packed >> 8);
result[(*result_offset)++] = static_cast<unsigned char>(packed);
@@ -175,7 +177,8 @@ static int decode_group(const unsigned char* codes, size_t num_codes,
decode_two_chars(codes, result, result_offset);
} else {
/* No padding. */
- uint32_t packed = (static_cast<uint32_t>(codes[0]) << 18) | (static_cast<uint32_t>(codes[1]) << 12) |
+ uint32_t packed = (static_cast<uint32_t>(codes[0]) << 18) |
+ (static_cast<uint32_t>(codes[1]) << 12) |
(static_cast<uint32_t>(codes[2]) << 6) | codes[3];
result[(*result_offset)++] = static_cast<unsigned char>(packed >> 16);
result[(*result_offset)++] = static_cast<unsigned char>(packed >> 8);
diff --git a/src/core/lib/slice/slice.cc b/src/core/lib/slice/slice.cc
index 136cce1d1e..476d941fbb 100644
--- a/src/core/lib/slice/slice.cc
+++ b/src/core/lib/slice/slice.cc
@@ -173,8 +173,8 @@ static const grpc_slice_refcount_vtable new_with_len_vtable = {
grpc_slice grpc_slice_new_with_len(void* p, size_t len,
void (*destroy)(void*, size_t)) {
grpc_slice slice;
- new_with_len_slice_refcount* rc = static_cast<new_with_len_slice_refcount*>(gpr_malloc(
- sizeof(new_with_len_slice_refcount)));
+ new_with_len_slice_refcount* rc = static_cast<new_with_len_slice_refcount*>(
+ gpr_malloc(sizeof(new_with_len_slice_refcount)));
gpr_ref_init(&rc->refs, 1);
rc->rc.vtable = &new_with_len_vtable;
rc->rc.sub_refcount = &rc->rc;
@@ -232,8 +232,8 @@ grpc_slice grpc_slice_malloc_large(size_t length) {
refcount is a malloc_refcount
bytes is an array of bytes of the requested length
Both parts are placed in the same allocation returned from gpr_malloc */
- malloc_refcount* rc =
- static_cast<malloc_refcount*>(gpr_malloc(sizeof(malloc_refcount) + length));
+ malloc_refcount* rc = static_cast<malloc_refcount*>(
+ gpr_malloc(sizeof(malloc_refcount) + length));
/* Initial refcount on rc is 1 - and it's up to the caller to release
this reference. */
@@ -314,7 +314,8 @@ grpc_slice grpc_slice_split_tail_maybe_ref(grpc_slice* source, size_t split,
/* inlined data, copy it out */
GPR_ASSERT(source->data.inlined.length >= split);
tail.refcount = nullptr;
- tail.data.inlined.length = static_cast<uint8_t>(source->data.inlined.length - split);
+ tail.data.inlined.length =
+ static_cast<uint8_t>(source->data.inlined.length - split);
memcpy(tail.data.inlined.bytes, source->data.inlined.bytes + split,
tail.data.inlined.length);
source->data.inlined.length = static_cast<uint8_t>(split);
@@ -443,15 +444,15 @@ int grpc_slice_buf_start_eq(grpc_slice a, const void* b, size_t len) {
}
int grpc_slice_rchr(grpc_slice s, char c) {
- const char* b = reinterpret_cast<const char*>GRPC_SLICE_START_PTR(s);
+ const char* b = reinterpret_cast<const char*> GRPC_SLICE_START_PTR(s);
int i;
- for (i = static_cast<int>GRPC_SLICE_LENGTH(s) - 1; i != -1 && b[i] != c; i--)
+ for (i = static_cast<int> GRPC_SLICE_LENGTH(s) - 1; i != -1 && b[i] != c; i--)
;
return i;
}
int grpc_slice_chr(grpc_slice s, char c) {
- const char* b = reinterpret_cast<const char*>GRPC_SLICE_START_PTR(s);
+ const char* b = reinterpret_cast<const char*> GRPC_SLICE_START_PTR(s);
const char* p = static_cast<const char*>(memchr(b, c, GRPC_SLICE_LENGTH(s)));
return p == nullptr ? -1 : static_cast<int>(p - b);
}
@@ -466,7 +467,8 @@ int grpc_slice_slice(grpc_slice haystack, grpc_slice needle) {
if (haystack_len < needle_len) return -1;
if (haystack_len == needle_len)
return grpc_slice_eq(haystack, needle) ? 0 : -1;
- if (needle_len == 1) return grpc_slice_chr(haystack, static_cast<char>(*needle_bytes));
+ if (needle_len == 1)
+ return grpc_slice_chr(haystack, static_cast<char>(*needle_bytes));
const uint8_t* last = haystack_bytes + haystack_len - needle_len;
for (const uint8_t* cur = haystack_bytes; cur != last; ++cur) {
diff --git a/src/core/lib/slice/slice_buffer.cc b/src/core/lib/slice/slice_buffer.cc
index 84a2b5f6d9..0416c9d371 100644
--- a/src/core/lib/slice/slice_buffer.cc
+++ b/src/core/lib/slice/slice_buffer.cc
@@ -45,12 +45,12 @@ static void maybe_embiggen(grpc_slice_buffer* sb) {
sb->capacity = GROW(sb->capacity);
GPR_ASSERT(sb->capacity > slice_count);
if (sb->base_slices == sb->inlined) {
- sb->base_slices =
- static_cast<grpc_slice*>(gpr_malloc(sb->capacity * sizeof(grpc_slice)));
+ sb->base_slices = static_cast<grpc_slice*>(
+ gpr_malloc(sb->capacity * sizeof(grpc_slice)));
memcpy(sb->base_slices, sb->inlined, slice_count * sizeof(grpc_slice));
} else {
- sb->base_slices = static_cast<grpc_slice*>(gpr_realloc(
- sb->base_slices, sb->capacity * sizeof(grpc_slice)));
+ sb->base_slices = static_cast<grpc_slice*>(
+ gpr_realloc(sb->base_slices, sb->capacity * sizeof(grpc_slice)));
}
sb->slices = sb->base_slices + slice_offset;
@@ -89,7 +89,8 @@ uint8_t* grpc_slice_buffer_tiny_add(grpc_slice_buffer* sb, size_t n) {
if ((back->data.inlined.length + n) > sizeof(back->data.inlined.bytes))
goto add_new;
out = back->data.inlined.bytes + back->data.inlined.length;
- back->data.inlined.length = static_cast<uint8_t>(back->data.inlined.length + n);
+ back->data.inlined.length =
+ static_cast<uint8_t>(back->data.inlined.length + n);
return out;
add_new:
@@ -125,8 +126,8 @@ void grpc_slice_buffer_add(grpc_slice_buffer* sb, grpc_slice s) {
GRPC_SLICE_INLINED_SIZE) {
memcpy(back->data.inlined.bytes + back->data.inlined.length,
s.data.inlined.bytes, s.data.inlined.length);
- back->data.inlined.length =
- static_cast<uint8_t>(back->data.inlined.length + s.data.inlined.length);
+ back->data.inlined.length = static_cast<uint8_t>(
+ back->data.inlined.length + s.data.inlined.length);
} else {
size_t cp1 = GRPC_SLICE_INLINED_SIZE - back->data.inlined.length;
memcpy(back->data.inlined.bytes + back->data.inlined.length,
@@ -136,7 +137,8 @@ void grpc_slice_buffer_add(grpc_slice_buffer* sb, grpc_slice s) {
back = &sb->slices[n];
sb->count = n + 1;
back->refcount = nullptr;
- back->data.inlined.length = static_cast<uint8_t>(s.data.inlined.length - cp1);
+ back->data.inlined.length =
+ static_cast<uint8_t>(s.data.inlined.length - cp1);
memcpy(back->data.inlined.bytes, s.data.inlined.bytes + cp1,
s.data.inlined.length - cp1);
}
diff --git a/src/core/lib/slice/slice_hash_table.cc b/src/core/lib/slice/slice_hash_table.cc
index 1818b126ca..2342e90485 100644
--- a/src/core/lib/slice/slice_hash_table.cc
+++ b/src/core/lib/slice/slice_hash_table.cc
@@ -67,7 +67,8 @@ grpc_slice_hash_table* grpc_slice_hash_table_create(
// Keep load factor low to improve performance of lookups.
table->size = num_entries * 2;
const size_t entry_size = sizeof(grpc_slice_hash_table_entry) * table->size;
- table->entries = static_cast<grpc_slice_hash_table_entry*>(gpr_zalloc(entry_size));
+ table->entries =
+ static_cast<grpc_slice_hash_table_entry*>(gpr_zalloc(entry_size));
for (size_t i = 0; i < num_entries; ++i) {
grpc_slice_hash_table_entry* entry = &entries[i];
grpc_slice_hash_table_add(table, entry->key, entry->value);
diff --git a/src/core/lib/slice/slice_intern.cc b/src/core/lib/slice/slice_intern.cc
index f4aad73e0f..2d633c4903 100644
--- a/src/core/lib/slice/slice_intern.cc
+++ b/src/core/lib/slice/slice_intern.cc
@@ -98,15 +98,18 @@ static void interned_slice_unref(void* p) {
}
static void interned_slice_sub_ref(void* p) {
- interned_slice_ref((static_cast<char*>(p)) - offsetof(interned_slice_refcount, sub));
+ interned_slice_ref((static_cast<char*>(p)) -
+ offsetof(interned_slice_refcount, sub));
}
static void interned_slice_sub_unref(void* p) {
- interned_slice_unref((static_cast<char*>(p)) - offsetof(interned_slice_refcount, sub));
+ interned_slice_unref((static_cast<char*>(p)) -
+ offsetof(interned_slice_refcount, sub));
}
static uint32_t interned_slice_hash(grpc_slice slice) {
- interned_slice_refcount* s = reinterpret_cast<interned_slice_refcount*>(slice.refcount);
+ interned_slice_refcount* s =
+ reinterpret_cast<interned_slice_refcount*>(slice.refcount);
return s->hash;
}
@@ -129,8 +132,8 @@ static void grow_shard(slice_shard* shard) {
interned_slice_refcount** strtab;
interned_slice_refcount *s, *next;
- strtab = static_cast<interned_slice_refcount**>(gpr_zalloc(
- sizeof(interned_slice_refcount*) * capacity));
+ strtab = static_cast<interned_slice_refcount**>(
+ gpr_zalloc(sizeof(interned_slice_refcount*) * capacity));
for (i = 0; i < shard->capacity; i++) {
for (s = shard->strs[i]; s; s = next) {
@@ -237,8 +240,8 @@ grpc_slice grpc_slice_intern(grpc_slice slice) {
/* not found: create a new string */
/* string data goes after the internal_string header */
- s = static_cast<interned_slice_refcount*>(gpr_malloc(sizeof(*s) +
- GRPC_SLICE_LENGTH(slice)));
+ s = static_cast<interned_slice_refcount*>(
+ gpr_malloc(sizeof(*s) + GRPC_SLICE_LENGTH(slice)));
gpr_atm_rel_store(&s->refcnt, 1);
s->length = GRPC_SLICE_LENGTH(slice);
s->hash = hash;
@@ -275,8 +278,8 @@ void grpc_slice_intern_init(void) {
gpr_mu_init(&shard->mu);
shard->count = 0;
shard->capacity = INITIAL_SHARD_CAPACITY;
- shard->strs = static_cast<interned_slice_refcount**>(gpr_zalloc(sizeof(*shard->strs) *
- shard->capacity));
+ shard->strs = static_cast<interned_slice_refcount**>(
+ gpr_zalloc(sizeof(*shard->strs) * shard->capacity));
}
for (size_t i = 0; i < GPR_ARRAY_SIZE(static_metadata_hash); i++) {
static_metadata_hash[i].hash = 0;
diff --git a/src/core/lib/slice/slice_string_helpers.cc b/src/core/lib/slice/slice_string_helpers.cc
index 2015040c12..f91ece3b98 100644
--- a/src/core/lib/slice/slice_string_helpers.cc
+++ b/src/core/lib/slice/slice_string_helpers.cc
@@ -26,8 +26,8 @@
#include "src/core/lib/slice/slice_internal.h"
char* grpc_dump_slice(grpc_slice s, uint32_t flags) {
- return gpr_dump(reinterpret_cast<const char*>GRPC_SLICE_START_PTR(s), GRPC_SLICE_LENGTH(s),
- flags);
+ return gpr_dump(reinterpret_cast<const char*> GRPC_SLICE_START_PTR(s),
+ GRPC_SLICE_LENGTH(s), flags);
}
/** Finds the initial (\a begin) and final (\a end) offsets of the next
@@ -110,6 +110,7 @@ void grpc_slice_split_without_space(grpc_slice str, const char* sep,
}
bool grpc_parse_slice_to_uint32(grpc_slice str, uint32_t* result) {
- return gpr_parse_bytes_to_uint32(reinterpret_cast<const char*>GRPC_SLICE_START_PTR(str),
- GRPC_SLICE_LENGTH(str), result) != 0;
+ return gpr_parse_bytes_to_uint32(
+ reinterpret_cast<const char*> GRPC_SLICE_START_PTR(str),
+ GRPC_SLICE_LENGTH(str), result) != 0;
}
diff --git a/src/core/lib/surface/call.cc b/src/core/lib/surface/call.cc
index d6949103c7..db7c01cc33 100644
--- a/src/core/lib/surface/call.cc
+++ b/src/core/lib/surface/call.cc
@@ -360,7 +360,8 @@ grpc_error* grpc_call_create(const grpc_call_create_args* args,
GRPC_MDVALUE(args->add_initial_metadata[i]));
}
}
- call->send_extra_metadata_count = static_cast<int>(args->add_initial_metadata_count);
+ call->send_extra_metadata_count =
+ static_cast<int>(args->add_initial_metadata_count);
} else {
GPR_ASSERT(args->add_initial_metadata_count == 0);
call->send_extra_metadata_count = 0;
@@ -608,7 +609,8 @@ grpc_call_error grpc_call_cancel(grpc_call* call, void* reserved) {
// the filter stack.
static void execute_batch_in_call_combiner(void* arg, grpc_error* ignored) {
GPR_TIMER_SCOPE("execute_batch", 0);
- grpc_transport_stream_op_batch* batch = static_cast<grpc_transport_stream_op_batch*>(arg);
+ grpc_transport_stream_op_batch* batch =
+ static_cast<grpc_transport_stream_op_batch*>(arg);
grpc_call* call = static_cast<grpc_call*>(batch->handler_private.extra_arg);
grpc_call_element* elem = CALL_ELEM_FROM_CALL(call, 0);
GRPC_CALL_LOG_OP(GPR_INFO, elem, batch);
@@ -991,8 +993,9 @@ static uint32_t decode_status(grpc_mdelem md) {
if (!grpc_parse_slice_to_uint32(GRPC_MDVALUE(md), &status)) {
status = GRPC_STATUS_UNKNOWN; /* could not parse status code */
}
- grpc_mdelem_set_user_data(md, destroy_status,
- (void*)static_cast<intptr_t>(status + STATUS_OFFSET));
+ grpc_mdelem_set_user_data(
+ md, destroy_status,
+ (void*)static_cast<intptr_t>(status + STATUS_OFFSET));
}
return status;
}
@@ -1040,8 +1043,8 @@ static void publish_app_metadata(grpc_call* call, grpc_metadata_batch* b,
if (dest->count + b->list.count > dest->capacity) {
dest->capacity =
GPR_MAX(dest->capacity + b->list.count, dest->capacity * 3 / 2);
- dest->metadata = static_cast<grpc_metadata*>(gpr_realloc(
- dest->metadata, sizeof(grpc_metadata) * dest->capacity));
+ dest->metadata = static_cast<grpc_metadata*>(
+ gpr_realloc(dest->metadata, sizeof(grpc_metadata) * dest->capacity));
}
for (grpc_linked_mdelem* l = b->list.head; l != nullptr; l = l->next) {
mdusr = &dest->metadata[dest->count++];
@@ -1170,8 +1173,8 @@ static batch_control* allocate_batch_control(grpc_call* call,
int slot = batch_slot_for_op(ops[0].op);
batch_control** pslot = &call->active_batches[slot];
if (*pslot == nullptr) {
- *pslot =
- static_cast<batch_control*>(gpr_arena_alloc(call->arena, sizeof(batch_control)));
+ *pslot = static_cast<batch_control*>(
+ gpr_arena_alloc(call->arena, sizeof(batch_control)));
}
batch_control* bctl = *pslot;
if (bctl->call != nullptr) {
@@ -1192,7 +1195,7 @@ static void finish_batch_completion(void* user_data,
}
static grpc_error* consolidate_batch_errors(batch_control* bctl) {
- size_t n = static_cast<size_t>gpr_atm_acq_load(&bctl->num_errors);
+ size_t n = static_cast<size_t> gpr_atm_acq_load(&bctl->num_errors);
if (n == 0) {
return GRPC_ERROR_NONE;
} else if (n == 1) {
@@ -1584,9 +1587,10 @@ static grpc_call_error call_start_batch(grpc_call* call, const grpc_op* ops,
if (nops == 0) {
if (!is_notify_tag_closure) {
GPR_ASSERT(grpc_cq_begin_op(call->cq, notify_tag));
- grpc_cq_end_op(
- call->cq, notify_tag, GRPC_ERROR_NONE, free_no_op_completion, nullptr,
- static_cast<grpc_cq_completion*>(gpr_malloc(sizeof(grpc_cq_completion))));
+ grpc_cq_end_op(call->cq, notify_tag, GRPC_ERROR_NONE,
+ free_no_op_completion, nullptr,
+ static_cast<grpc_cq_completion*>(
+ gpr_malloc(sizeof(grpc_cq_completion))));
} else {
GRPC_CLOSURE_SCHED((grpc_closure*)notify_tag, GRPC_ERROR_NONE);
}
@@ -1662,7 +1666,8 @@ static grpc_call_error call_start_batch(grpc_call* call, const grpc_op* ops,
if (!prepare_application_metadata(
call, static_cast<int>(op->data.send_initial_metadata.count),
op->data.send_initial_metadata.metadata, 0, call->is_client,
- &call->compression_md, static_cast<int>(additional_metadata_count))) {
+ &call->compression_md,
+ static_cast<int>(additional_metadata_count))) {
error = GRPC_CALL_ERROR_INVALID_METADATA;
goto done_with_error;
}
@@ -1779,7 +1784,8 @@ static grpc_call_error call_start_batch(grpc_call* call, const grpc_op* ops,
}
if (!prepare_application_metadata(
call,
- static_cast<int>(op->data.send_status_from_server.trailing_metadata_count),
+ static_cast<int>(
+ op->data.send_status_from_server.trailing_metadata_count),
op->data.send_status_from_server.trailing_metadata, 1, 1,
nullptr, 0)) {
for (int n = 0; n < call->send_extra_metadata_count; n++) {
diff --git a/src/core/lib/surface/channel.cc b/src/core/lib/surface/channel.cc
index 06dbfdcb49..6c73c2cd76 100644
--- a/src/core/lib/surface/channel.cc
+++ b/src/core/lib/surface/channel.cc
@@ -190,17 +190,20 @@ size_t grpc_channel_get_call_size_estimate(grpc_channel* channel) {
(which is common) - which tends to help most allocators reuse memory
2. a small amount of allowed growth over the estimate without hitting
the arena size doubling case, reducing overall memory usage */
- return (static_cast<size_t>gpr_atm_no_barrier_load(&channel->call_size_estimate) +
+ return (static_cast<size_t> gpr_atm_no_barrier_load(
+ &channel->call_size_estimate) +
2 * ROUND_UP_SIZE) &
~static_cast<size_t>(ROUND_UP_SIZE - 1);
}
void grpc_channel_update_call_size_estimate(grpc_channel* channel,
size_t size) {
- size_t cur = static_cast<size_t>gpr_atm_no_barrier_load(&channel->call_size_estimate);
+ size_t cur =
+ static_cast<size_t> gpr_atm_no_barrier_load(&channel->call_size_estimate);
if (cur < size) {
/* size grew: update estimate */
- gpr_atm_no_barrier_cas(&channel->call_size_estimate, static_cast<gpr_atm>(cur),
+ gpr_atm_no_barrier_cas(&channel->call_size_estimate,
+ static_cast<gpr_atm>(cur),
static_cast<gpr_atm>(size));
/* if we lose: never mind, something else will likely update soon enough */
} else if (cur == size) {
@@ -297,7 +300,8 @@ grpc_call* grpc_channel_create_pollset_set_call(
void* grpc_channel_register_call(grpc_channel* channel, const char* method,
const char* host, void* reserved) {
- registered_call* rc = static_cast<registered_call*>(gpr_malloc(sizeof(registered_call)));
+ registered_call* rc =
+ static_cast<registered_call*>(gpr_malloc(sizeof(registered_call)));
GRPC_API_TRACE(
"grpc_channel_register_call(channel=%p, method=%s, host=%s, reserved=%p)",
4, (channel, method, host, reserved));
diff --git a/src/core/lib/surface/channel_init.cc b/src/core/lib/surface/channel_init.cc
index 6b63195272..b1e1dceed3 100644
--- a/src/core/lib/surface/channel_init.cc
+++ b/src/core/lib/surface/channel_init.cc
@@ -52,9 +52,9 @@ void grpc_channel_init_register_stage(grpc_channel_stack_type type,
GPR_ASSERT(!g_finalized);
if (g_slots[type].cap_slots == g_slots[type].num_slots) {
g_slots[type].cap_slots = GPR_MAX(8, 3 * g_slots[type].cap_slots / 2);
- g_slots[type].slots = static_cast<stage_slot*>(gpr_realloc(
- g_slots[type].slots,
- g_slots[type].cap_slots * sizeof(*g_slots[type].slots)));
+ g_slots[type].slots = static_cast<stage_slot*>(
+ gpr_realloc(g_slots[type].slots,
+ g_slots[type].cap_slots * sizeof(*g_slots[type].slots)));
}
stage_slot* s = &g_slots[type].slots[g_slots[type].num_slots++];
s->insertion_order = g_slots[type].num_slots;
@@ -84,7 +84,8 @@ void grpc_channel_init_finalize(void) {
void grpc_channel_init_shutdown(void) {
for (int i = 0; i < GRPC_NUM_CHANNEL_STACK_TYPES; i++) {
gpr_free(g_slots[i].slots);
- g_slots[i].slots = static_cast<stage_slot*>((void*)static_cast<uintptr_t>(0xdeadbeef));
+ g_slots[i].slots =
+ static_cast<stage_slot*>((void*)static_cast<uintptr_t>(0xdeadbeef));
}
}
diff --git a/src/core/lib/surface/completion_queue.cc b/src/core/lib/surface/completion_queue.cc
index 2f4bcc357c..d1f3276257 100644
--- a/src/core/lib/surface/completion_queue.cc
+++ b/src/core/lib/surface/completion_queue.cc
@@ -142,7 +142,8 @@ static grpc_error* non_polling_poller_kick(
if (specific_worker == nullptr)
specific_worker = reinterpret_cast<grpc_pollset_worker*>(p->root);
if (specific_worker != nullptr) {
- non_polling_worker* w = reinterpret_cast<non_polling_worker*>(specific_worker);
+ non_polling_worker* w =
+ reinterpret_cast<non_polling_worker*>(specific_worker);
if (!w->kicked) {
w->kicked = true;
gpr_cv_signal(&w->cv);
@@ -357,7 +358,7 @@ int grpc_completion_queue_thread_local_cache_flush(grpc_completion_queue* cq,
*ok = (storage->next & static_cast<uintptr_t>(1)) == 1;
storage->done(storage->done_arg, storage);
ret = 1;
- cq_next_data* cqd = static_cast<cq_next_data*>DATA_FROM_CQ(cq);
+ cq_next_data* cqd = static_cast<cq_next_data*> DATA_FROM_CQ(cq);
if (gpr_atm_full_fetch_add(&cqd->pending_events, -1) == 1) {
GRPC_CQ_INTERNAL_REF(cq, "shutting_down");
gpr_mu_lock(cq->mu);
@@ -395,7 +396,8 @@ static grpc_cq_completion* cq_event_queue_pop(grpc_cq_event_queue* q) {
GRPC_STATS_INC_CQ_EV_QUEUE_TRYLOCK_SUCCESSES();
bool is_empty = false;
- c = reinterpret_cast<grpc_cq_completion*>(gpr_mpscq_pop_and_check_end(&q->queue, &is_empty));
+ c = reinterpret_cast<grpc_cq_completion*>(
+ gpr_mpscq_pop_and_check_end(&q->queue, &is_empty));
gpr_spinlock_unlock(&q->queue_lock);
if (c == nullptr && !is_empty) {
@@ -415,7 +417,7 @@ static grpc_cq_completion* cq_event_queue_pop(grpc_cq_event_queue* q) {
/* Note: The counter is not incremented/decremented atomically with push/pop.
* The count is only eventually consistent */
static long cq_event_queue_num_items(grpc_cq_event_queue* q) {
- return static_cast<long>gpr_atm_no_barrier_load(&q->num_queue_items);
+ return static_cast<long> gpr_atm_no_barrier_load(&q->num_queue_items);
}
grpc_completion_queue* grpc_completion_queue_create_internal(
@@ -437,9 +439,9 @@ grpc_completion_queue* grpc_completion_queue_create_internal(
grpc_core::ExecCtx exec_ctx;
GRPC_STATS_INC_CQS_CREATED();
- cq = static_cast<grpc_completion_queue*>(gpr_zalloc(sizeof(grpc_completion_queue) +
- vtable->data_size +
- poller_vtable->size()));
+ cq = static_cast<grpc_completion_queue*>(
+ gpr_zalloc(sizeof(grpc_completion_queue) + vtable->data_size +
+ poller_vtable->size()));
cq->vtable = vtable;
cq->poller_vtable = poller_vtable;
@@ -587,12 +589,12 @@ static bool atm_inc_if_nonzero(gpr_atm* counter) {
}
static bool cq_begin_op_for_next(grpc_completion_queue* cq, void* tag) {
- cq_next_data* cqd = static_cast<cq_next_data*>DATA_FROM_CQ(cq);
+ cq_next_data* cqd = static_cast<cq_next_data*> DATA_FROM_CQ(cq);
return atm_inc_if_nonzero(&cqd->pending_events);
}
static bool cq_begin_op_for_pluck(grpc_completion_queue* cq, void* tag) {
- cq_pluck_data* cqd = static_cast<cq_pluck_data*>DATA_FROM_CQ(cq);
+ cq_pluck_data* cqd = static_cast<cq_pluck_data*> DATA_FROM_CQ(cq);
return atm_inc_if_nonzero(&cqd->pending_events);
}
@@ -632,7 +634,7 @@ static void cq_end_op_for_next(grpc_completion_queue* cq, void* tag,
gpr_log(GPR_ERROR, "Operation failed: tag=%p, error=%s", tag, errmsg);
}
}
- cq_next_data* cqd = static_cast<cq_next_data*>DATA_FROM_CQ(cq);
+ cq_next_data* cqd = static_cast<cq_next_data*> DATA_FROM_CQ(cq);
int is_success = (error == GRPC_ERROR_NONE);
storage->tag = tag;
@@ -701,7 +703,7 @@ static void cq_end_op_for_pluck(grpc_completion_queue* cq, void* tag,
void* done_arg, grpc_cq_completion* storage) {
GPR_TIMER_SCOPE("cq_end_op_for_pluck", 0);
- cq_pluck_data* cqd = static_cast<cq_pluck_data*>DATA_FROM_CQ(cq);
+ cq_pluck_data* cqd = static_cast<cq_pluck_data*> DATA_FROM_CQ(cq);
int is_success = (error == GRPC_ERROR_NONE);
if (grpc_api_trace.enabled() ||
@@ -719,7 +721,8 @@ static void cq_end_op_for_pluck(grpc_completion_queue* cq, void* tag,
storage->tag = tag;
storage->done = done;
storage->done_arg = done_arg;
- storage->next = ((uintptr_t)&cqd->completed_head) | (static_cast<uintptr_t>(is_success));
+ storage->next =
+ ((uintptr_t)&cqd->completed_head) | (static_cast<uintptr_t>(is_success));
gpr_mu_lock(cq->mu);
cq_check_tag(cq, tag, false); /* Used in debug builds only */
@@ -778,9 +781,10 @@ class ExecCtxNext : public grpc_core::ExecCtx {
ExecCtxNext(void* arg) : ExecCtx(0), check_ready_to_finish_arg_(arg) {}
bool CheckReadyToFinish() override {
- cq_is_finished_arg* a = static_cast<cq_is_finished_arg*>(check_ready_to_finish_arg_);
+ cq_is_finished_arg* a =
+ static_cast<cq_is_finished_arg*>(check_ready_to_finish_arg_);
grpc_completion_queue* cq = a->cq;
- cq_next_data* cqd = static_cast<cq_next_data*>DATA_FROM_CQ(cq);
+ cq_next_data* cqd = static_cast<cq_next_data*> DATA_FROM_CQ(cq);
GPR_ASSERT(a->stolen_completion == nullptr);
gpr_atm current_last_seen_things_queued_ever =
@@ -836,7 +840,7 @@ static grpc_event cq_next(grpc_completion_queue* cq, gpr_timespec deadline,
GPR_TIMER_SCOPE("grpc_completion_queue_next", 0);
grpc_event ret;
- cq_next_data* cqd = static_cast<cq_next_data*>DATA_FROM_CQ(cq);
+ cq_next_data* cqd = static_cast<cq_next_data*> DATA_FROM_CQ(cq);
GRPC_API_TRACE(
"grpc_completion_queue_next("
@@ -961,7 +965,7 @@ static grpc_event cq_next(grpc_completion_queue* cq, gpr_timespec deadline,
- grpc_completion_queue_shutdown() MUST have been called before calling
this function */
static void cq_finish_shutdown_next(grpc_completion_queue* cq) {
- cq_next_data* cqd = static_cast<cq_next_data*>DATA_FROM_CQ(cq);
+ cq_next_data* cqd = static_cast<cq_next_data*> DATA_FROM_CQ(cq);
GPR_ASSERT(cqd->shutdown_called);
GPR_ASSERT(gpr_atm_no_barrier_load(&cqd->pending_events) == 0);
@@ -970,7 +974,7 @@ static void cq_finish_shutdown_next(grpc_completion_queue* cq) {
}
static void cq_shutdown_next(grpc_completion_queue* cq) {
- cq_next_data* cqd = static_cast<cq_next_data*>DATA_FROM_CQ(cq);
+ cq_next_data* cqd = static_cast<cq_next_data*> DATA_FROM_CQ(cq);
/* Need an extra ref for cq here because:
* We call cq_finish_shutdown_next() below, that would call pollset shutdown.
@@ -1003,7 +1007,7 @@ grpc_event grpc_completion_queue_next(grpc_completion_queue* cq,
static int add_plucker(grpc_completion_queue* cq, void* tag,
grpc_pollset_worker** worker) {
- cq_pluck_data* cqd = static_cast<cq_pluck_data*>DATA_FROM_CQ(cq);
+ cq_pluck_data* cqd = static_cast<cq_pluck_data*> DATA_FROM_CQ(cq);
if (cqd->num_pluckers == GRPC_MAX_COMPLETION_QUEUE_PLUCKERS) {
return 0;
}
@@ -1015,7 +1019,7 @@ static int add_plucker(grpc_completion_queue* cq, void* tag,
static void del_plucker(grpc_completion_queue* cq, void* tag,
grpc_pollset_worker** worker) {
- cq_pluck_data* cqd = static_cast<cq_pluck_data*>DATA_FROM_CQ(cq);
+ cq_pluck_data* cqd = static_cast<cq_pluck_data*> DATA_FROM_CQ(cq);
for (int i = 0; i < cqd->num_pluckers; i++) {
if (cqd->pluckers[i].tag == tag && cqd->pluckers[i].worker == worker) {
cqd->num_pluckers--;
@@ -1031,9 +1035,10 @@ class ExecCtxPluck : public grpc_core::ExecCtx {
ExecCtxPluck(void* arg) : ExecCtx(0), check_ready_to_finish_arg_(arg) {}
bool CheckReadyToFinish() override {
- cq_is_finished_arg* a = static_cast<cq_is_finished_arg*>(check_ready_to_finish_arg_);
+ cq_is_finished_arg* a =
+ static_cast<cq_is_finished_arg*>(check_ready_to_finish_arg_);
grpc_completion_queue* cq = a->cq;
- cq_pluck_data* cqd = static_cast<cq_pluck_data*>DATA_FROM_CQ(cq);
+ cq_pluck_data* cqd = static_cast<cq_pluck_data*> DATA_FROM_CQ(cq);
GPR_ASSERT(a->stolen_completion == nullptr);
gpr_atm current_last_seen_things_queued_ever =
@@ -1045,10 +1050,12 @@ class ExecCtxPluck : public grpc_core::ExecCtx {
gpr_atm_no_barrier_load(&cqd->things_queued_ever);
grpc_cq_completion* c;
grpc_cq_completion* prev = &cqd->completed_head;
- while ((c = (grpc_cq_completion*)(prev->next & ~static_cast<uintptr_t>(1))) !=
+ while ((c = (grpc_cq_completion*)(prev->next &
+ ~static_cast<uintptr_t>(1))) !=
&cqd->completed_head) {
if (c->tag == a->tag) {
- prev->next = (prev->next & static_cast<uintptr_t>(1)) | (c->next & ~static_cast<uintptr_t>(1));
+ prev->next = (prev->next & static_cast<uintptr_t>(1)) |
+ (c->next & ~static_cast<uintptr_t>(1));
if (c == cqd->completed_tail) {
cqd->completed_tail = prev;
}
@@ -1075,7 +1082,7 @@ static grpc_event cq_pluck(grpc_completion_queue* cq, void* tag,
grpc_cq_completion* c;
grpc_cq_completion* prev;
grpc_pollset_worker* worker = nullptr;
- cq_pluck_data* cqd = static_cast<cq_pluck_data*>DATA_FROM_CQ(cq);
+ cq_pluck_data* cqd = static_cast<cq_pluck_data*> DATA_FROM_CQ(cq);
if (grpc_cq_pluck_trace.enabled()) {
GRPC_API_TRACE(
@@ -1115,10 +1122,12 @@ static grpc_event cq_pluck(grpc_completion_queue* cq, void* tag,
break;
}
prev = &cqd->completed_head;
- while ((c = (grpc_cq_completion*)(prev->next & ~static_cast<uintptr_t>(1))) !=
- &cqd->completed_head) {
+ while (
+ (c = (grpc_cq_completion*)(prev->next & ~static_cast<uintptr_t>(1))) !=
+ &cqd->completed_head) {
if (c->tag == tag) {
- prev->next = (prev->next & static_cast<uintptr_t>(1)) | (c->next & ~static_cast<uintptr_t>(1));
+ prev->next = (prev->next & static_cast<uintptr_t>(1)) |
+ (c->next & ~static_cast<uintptr_t>(1));
if (c == cqd->completed_tail) {
cqd->completed_tail = prev;
}
@@ -1191,7 +1200,7 @@ grpc_event grpc_completion_queue_pluck(grpc_completion_queue* cq, void* tag,
}
static void cq_finish_shutdown_pluck(grpc_completion_queue* cq) {
- cq_pluck_data* cqd = static_cast<cq_pluck_data*>DATA_FROM_CQ(cq);
+ cq_pluck_data* cqd = static_cast<cq_pluck_data*> DATA_FROM_CQ(cq);
GPR_ASSERT(cqd->shutdown_called);
GPR_ASSERT(!gpr_atm_no_barrier_load(&cqd->shutdown));
@@ -1203,7 +1212,7 @@ static void cq_finish_shutdown_pluck(grpc_completion_queue* cq) {
/* NOTE: This function is almost exactly identical to cq_shutdown_next() but
* merging them is a bit tricky and probably not worth it */
static void cq_shutdown_pluck(grpc_completion_queue* cq) {
- cq_pluck_data* cqd = static_cast<cq_pluck_data*>DATA_FROM_CQ(cq);
+ cq_pluck_data* cqd = static_cast<cq_pluck_data*> DATA_FROM_CQ(cq);
/* Need an extra ref for cq here because:
* We call cq_finish_shutdown_pluck() below, that would call pollset shutdown.
diff --git a/src/core/lib/surface/server.cc b/src/core/lib/surface/server.cc
index ad3ee62ad8..d71a23a5d7 100644
--- a/src/core/lib/surface/server.cc
+++ b/src/core/lib/surface/server.cc
@@ -241,8 +241,8 @@ static void channel_broadcaster_init(grpc_server* s, channel_broadcaster* cb) {
count++;
}
cb->num_channels = count;
- cb->channels =
- static_cast<grpc_channel**>(gpr_malloc(sizeof(*cb->channels) * cb->num_channels));
+ cb->channels = static_cast<grpc_channel**>(
+ gpr_malloc(sizeof(*cb->channels) * cb->num_channels));
count = 0;
for (c = s->root_channel_data.next; c != &s->root_channel_data; c = c->next) {
cb->channels[count++] = c->channel;
@@ -256,7 +256,8 @@ struct shutdown_cleanup_args {
};
static void shutdown_cleanup(void* arg, grpc_error* error) {
- struct shutdown_cleanup_args* a = static_cast<struct shutdown_cleanup_args*>(arg);
+ struct shutdown_cleanup_args* a =
+ static_cast<struct shutdown_cleanup_args*>(arg);
grpc_slice_unref_internal(a->slice);
gpr_free(a);
}
@@ -304,8 +305,8 @@ static void channel_broadcaster_shutdown(channel_broadcaster* cb,
static void request_matcher_init(request_matcher* rm, grpc_server* server) {
memset(rm, 0, sizeof(*rm));
rm->server = server;
- rm->requests_per_cq = static_cast<gpr_locked_mpscq*>(gpr_malloc(
- sizeof(*rm->requests_per_cq) * server->cq_count));
+ rm->requests_per_cq = static_cast<gpr_locked_mpscq*>(
+ gpr_malloc(sizeof(*rm->requests_per_cq) * server->cq_count));
for (size_t i = 0; i < server->cq_count; i++) {
gpr_locked_mpscq_init(&rm->requests_per_cq[i]);
}
@@ -320,7 +321,8 @@ static void request_matcher_destroy(request_matcher* rm) {
}
static void kill_zombie(void* elem, grpc_error* error) {
- grpc_call_unref(grpc_call_from_top_element(static_cast<grpc_call_element*>(elem)));
+ grpc_call_unref(
+ grpc_call_from_top_element(static_cast<grpc_call_element*>(elem)));
}
static void request_matcher_zombify_all_pending_calls(request_matcher* rm) {
@@ -341,8 +343,8 @@ static void request_matcher_kill_requests(grpc_server* server,
grpc_error* error) {
requested_call* rc;
for (size_t i = 0; i < server->cq_count; i++) {
- while ((rc = reinterpret_cast<requested_call*>(gpr_locked_mpscq_pop(
- &rm->requests_per_cq[i]))) != nullptr) {
+ while ((rc = reinterpret_cast<requested_call*>(
+ gpr_locked_mpscq_pop(&rm->requests_per_cq[i]))) != nullptr) {
fail_call(server, i, rc, GRPC_ERROR_REF(error));
}
}
@@ -487,8 +489,8 @@ static void publish_new_rpc(void* arg, grpc_error* error) {
for (size_t i = 0; i < server->cq_count; i++) {
size_t cq_idx = (chand->cq_idx + i) % server->cq_count;
- requested_call* rc =
- reinterpret_cast<requested_call*>(gpr_locked_mpscq_try_pop(&rm->requests_per_cq[cq_idx]));
+ requested_call* rc = reinterpret_cast<requested_call*>(
+ gpr_locked_mpscq_try_pop(&rm->requests_per_cq[cq_idx]));
if (rc == nullptr) {
continue;
} else {
@@ -509,8 +511,8 @@ static void publish_new_rpc(void* arg, grpc_error* error) {
// added to the pending list.
for (size_t i = 0; i < server->cq_count; i++) {
size_t cq_idx = (chand->cq_idx + i) % server->cq_count;
- requested_call* rc =
- reinterpret_cast<requested_call*>(gpr_locked_mpscq_pop(&rm->requests_per_cq[cq_idx]));
+ requested_call* rc = reinterpret_cast<requested_call*>(
+ gpr_locked_mpscq_pop(&rm->requests_per_cq[cq_idx]));
if (rc == nullptr) {
continue;
} else {
@@ -939,7 +941,8 @@ void grpc_server_register_completion_queue(grpc_server* server,
grpc_server* grpc_server_create(const grpc_channel_args* args, void* reserved) {
GRPC_API_TRACE("grpc_server_create(%p, %p)", 2, (args, reserved));
- grpc_server* server = static_cast<grpc_server*>(gpr_zalloc(sizeof(grpc_server)));
+ grpc_server* server =
+ static_cast<grpc_server*>(gpr_zalloc(sizeof(grpc_server)));
gpr_mu_init(&server->mu_global);
gpr_mu_init(&server->mu_call);
@@ -1020,8 +1023,8 @@ void grpc_server_start(grpc_server* server) {
server->started = true;
server->pollset_count = 0;
- server->pollsets =
- static_cast<grpc_pollset**>(gpr_malloc(sizeof(grpc_pollset*) * server->cq_count));
+ server->pollsets = static_cast<grpc_pollset**>(
+ gpr_malloc(sizeof(grpc_pollset*) * server->cq_count));
for (i = 0; i < server->cq_count; i++) {
if (grpc_cq_can_listen(server->cqs[i])) {
server->pollsets[server->pollset_count++] =
@@ -1063,9 +1066,9 @@ void grpc_server_setup_transport(grpc_server* s, grpc_transport* transport,
grpc_transport_op* op = nullptr;
channel = grpc_channel_create(nullptr, args, GRPC_SERVER_CHANNEL, transport);
- chand = static_cast<channel_data*>(grpc_channel_stack_element(
- grpc_channel_get_channel_stack(channel), 0)
- ->channel_data);
+ chand = static_cast<channel_data*>(
+ grpc_channel_stack_element(grpc_channel_get_channel_stack(channel), 0)
+ ->channel_data);
chand->server = s;
server_ref(s);
chand->channel = channel;
@@ -1089,7 +1092,8 @@ void grpc_server_setup_transport(grpc_server* s, grpc_transport* transport,
if (num_registered_methods > 0) {
slots = 2 * num_registered_methods;
alloc = sizeof(channel_registered_method) * slots;
- chand->registered_methods = static_cast<channel_registered_method*>(gpr_zalloc(alloc));
+ chand->registered_methods =
+ static_cast<channel_registered_method*>(gpr_zalloc(alloc));
for (rm = s->registered_methods; rm; rm = rm->next) {
grpc_slice host;
bool has_host;
@@ -1176,13 +1180,14 @@ void grpc_server_shutdown_and_notify(grpc_server* server,
GPR_ASSERT(grpc_cq_begin_op(cq, tag));
if (server->shutdown_published) {
grpc_cq_end_op(cq, tag, GRPC_ERROR_NONE, done_published_shutdown, nullptr,
- static_cast<grpc_cq_completion*>(gpr_malloc(sizeof(grpc_cq_completion))));
+ static_cast<grpc_cq_completion*>(
+ gpr_malloc(sizeof(grpc_cq_completion))));
gpr_mu_unlock(&server->mu_global);
return;
}
- server->shutdown_tags = static_cast<shutdown_tag*>(gpr_realloc(
- server->shutdown_tags,
- sizeof(shutdown_tag) * (server->num_shutdown_tags + 1)));
+ server->shutdown_tags = static_cast<shutdown_tag*>(
+ gpr_realloc(server->shutdown_tags,
+ sizeof(shutdown_tag) * (server->num_shutdown_tags + 1)));
sdt = &server->shutdown_tags[server->num_shutdown_tags++];
sdt->tag = tag;
sdt->cq = cq;
@@ -1289,7 +1294,8 @@ static grpc_call_error queue_call_request(grpc_server* server, size_t cq_idx,
matching calls */
gpr_mu_lock(&server->mu_call);
while ((calld = rm->pending_head) != nullptr) {
- rc = reinterpret_cast<requested_call*>(gpr_locked_mpscq_pop(&rm->requests_per_cq[cq_idx]));
+ rc = reinterpret_cast<requested_call*>(
+ gpr_locked_mpscq_pop(&rm->requests_per_cq[cq_idx]));
if (rc == nullptr) break;
rm->pending_head = calld->pending_next;
gpr_mu_unlock(&server->mu_call);
diff --git a/src/core/lib/transport/bdp_estimator.cc b/src/core/lib/transport/bdp_estimator.cc
index 044183e8fd..70b308230b 100644
--- a/src/core/lib/transport/bdp_estimator.cc
+++ b/src/core/lib/transport/bdp_estimator.cc
@@ -40,7 +40,8 @@ BdpEstimator::BdpEstimator(const char* name)
grpc_millis BdpEstimator::CompletePing() {
gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC);
gpr_timespec dt_ts = gpr_time_sub(now, ping_start_time_);
- double dt = static_cast<double>(dt_ts.tv_sec) + 1e-9 * static_cast<double>(dt_ts.tv_nsec);
+ double dt = static_cast<double>(dt_ts.tv_sec) +
+ 1e-9 * static_cast<double>(dt_ts.tv_nsec);
double bw = dt > 0 ? (static_cast<double>(accumulator_) / dt) : 0;
int start_inter_ping_delay = inter_ping_delay_;
if (grpc_bdp_estimator_trace.enabled()) {
@@ -64,8 +65,8 @@ grpc_millis BdpEstimator::CompletePing() {
stable_estimate_count_++;
if (stable_estimate_count_ >= 2) {
inter_ping_delay_ +=
- 100 +
- static_cast<int>(rand() * 100.0 / RAND_MAX); // if the ping estimate is steady,
+ 100 + static_cast<int>(rand() * 100.0 /
+ RAND_MAX); // if the ping estimate is steady,
// slowly ramp down the probe time
}
}
diff --git a/src/core/lib/transport/byte_stream.cc b/src/core/lib/transport/byte_stream.cc
index 2ae0b8298a..afb55b2f20 100644
--- a/src/core/lib/transport/byte_stream.cc
+++ b/src/core/lib/transport/byte_stream.cc
@@ -49,14 +49,16 @@ void grpc_byte_stream_destroy(grpc_byte_stream* byte_stream) {
static bool slice_buffer_stream_next(grpc_byte_stream* byte_stream,
size_t max_size_hint,
grpc_closure* on_complete) {
- grpc_slice_buffer_stream* stream = reinterpret_cast<grpc_slice_buffer_stream*>(byte_stream);
+ grpc_slice_buffer_stream* stream =
+ reinterpret_cast<grpc_slice_buffer_stream*>(byte_stream);
GPR_ASSERT(stream->cursor < stream->backing_buffer->count);
return true;
}
static grpc_error* slice_buffer_stream_pull(grpc_byte_stream* byte_stream,
grpc_slice* slice) {
- grpc_slice_buffer_stream* stream = reinterpret_cast<grpc_slice_buffer_stream*>(byte_stream);
+ grpc_slice_buffer_stream* stream =
+ reinterpret_cast<grpc_slice_buffer_stream*>(byte_stream);
if (stream->shutdown_error != GRPC_ERROR_NONE) {
return GRPC_ERROR_REF(stream->shutdown_error);
}
@@ -69,13 +71,15 @@ static grpc_error* slice_buffer_stream_pull(grpc_byte_stream* byte_stream,
static void slice_buffer_stream_shutdown(grpc_byte_stream* byte_stream,
grpc_error* error) {
- grpc_slice_buffer_stream* stream = reinterpret_cast<grpc_slice_buffer_stream*>(byte_stream);
+ grpc_slice_buffer_stream* stream =
+ reinterpret_cast<grpc_slice_buffer_stream*>(byte_stream);
GRPC_ERROR_UNREF(stream->shutdown_error);
stream->shutdown_error = error;
}
static void slice_buffer_stream_destroy(grpc_byte_stream* byte_stream) {
- grpc_slice_buffer_stream* stream = reinterpret_cast<grpc_slice_buffer_stream*>(byte_stream);
+ grpc_slice_buffer_stream* stream =
+ reinterpret_cast<grpc_slice_buffer_stream*>(byte_stream);
grpc_slice_buffer_reset_and_unref_internal(stream->backing_buffer);
GRPC_ERROR_UNREF(stream->shutdown_error);
}
@@ -112,7 +116,8 @@ void grpc_byte_stream_cache_destroy(grpc_byte_stream_cache* cache) {
static bool caching_byte_stream_next(grpc_byte_stream* byte_stream,
size_t max_size_hint,
grpc_closure* on_complete) {
- grpc_caching_byte_stream* stream = reinterpret_cast<grpc_caching_byte_stream*>(byte_stream);
+ grpc_caching_byte_stream* stream =
+ reinterpret_cast<grpc_caching_byte_stream*>(byte_stream);
if (stream->shutdown_error != GRPC_ERROR_NONE) return true;
if (stream->cursor < stream->cache->cache_buffer.count) return true;
return grpc_byte_stream_next(stream->cache->underlying_stream, max_size_hint,
@@ -121,7 +126,8 @@ static bool caching_byte_stream_next(grpc_byte_stream* byte_stream,
static grpc_error* caching_byte_stream_pull(grpc_byte_stream* byte_stream,
grpc_slice* slice) {
- grpc_caching_byte_stream* stream = reinterpret_cast<grpc_caching_byte_stream*>(byte_stream);
+ grpc_caching_byte_stream* stream =
+ reinterpret_cast<grpc_caching_byte_stream*>(byte_stream);
if (stream->shutdown_error != GRPC_ERROR_NONE) {
return GRPC_ERROR_REF(stream->shutdown_error);
}
@@ -143,14 +149,16 @@ static grpc_error* caching_byte_stream_pull(grpc_byte_stream* byte_stream,
static void caching_byte_stream_shutdown(grpc_byte_stream* byte_stream,
grpc_error* error) {
- grpc_caching_byte_stream* stream = reinterpret_cast<grpc_caching_byte_stream*>(byte_stream);
+ grpc_caching_byte_stream* stream =
+ reinterpret_cast<grpc_caching_byte_stream*>(byte_stream);
GRPC_ERROR_UNREF(stream->shutdown_error);
stream->shutdown_error = GRPC_ERROR_REF(error);
grpc_byte_stream_shutdown(stream->cache->underlying_stream, error);
}
static void caching_byte_stream_destroy(grpc_byte_stream* byte_stream) {
- grpc_caching_byte_stream* stream = reinterpret_cast<grpc_caching_byte_stream*>(byte_stream);
+ grpc_caching_byte_stream* stream =
+ reinterpret_cast<grpc_caching_byte_stream*>(byte_stream);
GRPC_ERROR_UNREF(stream->shutdown_error);
}
diff --git a/src/core/lib/transport/connectivity_state.cc b/src/core/lib/transport/connectivity_state.cc
index 183d5987ee..a5b7bb508f 100644
--- a/src/core/lib/transport/connectivity_state.cc
+++ b/src/core/lib/transport/connectivity_state.cc
@@ -74,7 +74,7 @@ void grpc_connectivity_state_destroy(grpc_connectivity_state_tracker* tracker) {
grpc_connectivity_state grpc_connectivity_state_check(
grpc_connectivity_state_tracker* tracker) {
grpc_connectivity_state cur =
- static_cast<grpc_connectivity_state>gpr_atm_no_barrier_load(
+ static_cast<grpc_connectivity_state> gpr_atm_no_barrier_load(
&tracker->current_state_atm);
if (grpc_connectivity_state_trace.enabled()) {
gpr_log(GPR_DEBUG, "CONWATCH: %p %s: get %s", tracker, tracker->name,
@@ -86,7 +86,7 @@ grpc_connectivity_state grpc_connectivity_state_check(
grpc_connectivity_state grpc_connectivity_state_get(
grpc_connectivity_state_tracker* tracker, grpc_error** error) {
grpc_connectivity_state cur =
- static_cast<grpc_connectivity_state>gpr_atm_no_barrier_load(
+ static_cast<grpc_connectivity_state> gpr_atm_no_barrier_load(
&tracker->current_state_atm);
if (grpc_connectivity_state_trace.enabled()) {
gpr_log(GPR_DEBUG, "CONWATCH: %p %s: get %s", tracker, tracker->name,
@@ -107,7 +107,7 @@ bool grpc_connectivity_state_notify_on_state_change(
grpc_connectivity_state_tracker* tracker, grpc_connectivity_state* current,
grpc_closure* notify) {
grpc_connectivity_state cur =
- static_cast<grpc_connectivity_state>gpr_atm_no_barrier_load(
+ static_cast<grpc_connectivity_state> gpr_atm_no_barrier_load(
&tracker->current_state_atm);
if (grpc_connectivity_state_trace.enabled()) {
if (current == nullptr) {
@@ -158,7 +158,7 @@ void grpc_connectivity_state_set(grpc_connectivity_state_tracker* tracker,
grpc_connectivity_state state,
grpc_error* error, const char* reason) {
grpc_connectivity_state cur =
- static_cast<grpc_connectivity_state>gpr_atm_no_barrier_load(
+ static_cast<grpc_connectivity_state> gpr_atm_no_barrier_load(
&tracker->current_state_atm);
grpc_connectivity_state_watcher* w;
if (grpc_connectivity_state_trace.enabled()) {
diff --git a/src/core/lib/transport/error_utils.cc b/src/core/lib/transport/error_utils.cc
index b968383eda..79d904315e 100644
--- a/src/core/lib/transport/error_utils.cc
+++ b/src/core/lib/transport/error_utils.cc
@@ -32,7 +32,8 @@ static grpc_error* recursively_find_error_with_field(grpc_error* error,
// Otherwise, search through its children.
uint8_t slot = error->first_err;
while (slot != UINT8_MAX) {
- grpc_linked_error* lerr = reinterpret_cast<grpc_linked_error*>(error->arena + slot);
+ grpc_linked_error* lerr =
+ reinterpret_cast<grpc_linked_error*>(error->arena + slot);
grpc_error* result = recursively_find_error_with_field(lerr->err, which);
if (result) return result;
slot = lerr->next;
@@ -65,8 +66,8 @@ void grpc_error_get_status(grpc_error* error, grpc_millis deadline,
status = static_cast<grpc_status_code>(integer);
} else if (grpc_error_get_int(found_error, GRPC_ERROR_INT_HTTP2_ERROR,
&integer)) {
- status = grpc_http2_error_to_grpc_status(static_cast<grpc_http2_error_code>(integer),
- deadline);
+ status = grpc_http2_error_to_grpc_status(
+ static_cast<grpc_http2_error_code>(integer), deadline);
}
if (code != nullptr) *code = status;
@@ -79,7 +80,8 @@ void grpc_error_get_status(grpc_error* error, grpc_millis deadline,
*http_error = static_cast<grpc_http2_error_code>(integer);
} else if (grpc_error_get_int(found_error, GRPC_ERROR_INT_GRPC_STATUS,
&integer)) {
- *http_error = grpc_status_to_http2_error(static_cast<grpc_status_code>(integer));
+ *http_error =
+ grpc_status_to_http2_error(static_cast<grpc_status_code>(integer));
} else {
*http_error = found_error == GRPC_ERROR_NONE ? GRPC_HTTP2_NO_ERROR
: GRPC_HTTP2_INTERNAL_ERROR;
@@ -103,7 +105,8 @@ bool grpc_error_has_clear_grpc_status(grpc_error* error) {
}
uint8_t slot = error->first_err;
while (slot != UINT8_MAX) {
- grpc_linked_error* lerr = reinterpret_cast<grpc_linked_error*>(error->arena + slot);
+ grpc_linked_error* lerr =
+ reinterpret_cast<grpc_linked_error*>(error->arena + slot);
if (grpc_error_has_clear_grpc_status(lerr->err)) {
return true;
}
diff --git a/src/core/lib/transport/metadata.cc b/src/core/lib/transport/metadata.cc
index 418224bc97..e06e0b5313 100644
--- a/src/core/lib/transport/metadata.cc
+++ b/src/core/lib/transport/metadata.cc
@@ -118,8 +118,8 @@ void grpc_mdctx_global_init(void) {
shard->count = 0;
gpr_atm_no_barrier_store(&shard->free_estimate, 0);
shard->capacity = INITIAL_SHARD_CAPACITY;
- shard->elems = static_cast<interned_metadata**>(gpr_zalloc(sizeof(*shard->elems) *
- shard->capacity));
+ shard->elems = static_cast<interned_metadata**>(
+ gpr_zalloc(sizeof(*shard->elems) * shard->capacity));
}
}
@@ -206,8 +206,8 @@ static void grow_mdtab(mdtab_shard* shard) {
interned_metadata *md, *next;
uint32_t hash;
- mdtab =
- static_cast<interned_metadata**>(gpr_zalloc(sizeof(interned_metadata*) * capacity));
+ mdtab = static_cast<interned_metadata**>(
+ gpr_zalloc(sizeof(interned_metadata*) * capacity));
for (i = 0; i < shard->capacity; i++) {
for (md = shard->elems[i]; md; md = next) {
@@ -335,8 +335,9 @@ grpc_mdelem grpc_mdelem_from_grpc_metadata(grpc_metadata* metadata) {
grpc_slice_maybe_static_intern(metadata->key, &changed);
grpc_slice value_slice =
grpc_slice_maybe_static_intern(metadata->value, &changed);
- return grpc_mdelem_create(key_slice, value_slice,
- changed ? nullptr : reinterpret_cast<grpc_mdelem_data*>(metadata));
+ return grpc_mdelem_create(
+ key_slice, value_slice,
+ changed ? nullptr : reinterpret_cast<grpc_mdelem_data*>(metadata));
}
static size_t get_base64_encoded_size(size_t raw_length) {
@@ -363,7 +364,8 @@ grpc_mdelem grpc_mdelem_ref(grpc_mdelem gmd DEBUG_ARGS) {
case GRPC_MDELEM_STORAGE_STATIC:
break;
case GRPC_MDELEM_STORAGE_INTERNED: {
- interned_metadata* md = reinterpret_cast<interned_metadata*>GRPC_MDELEM_DATA(gmd);
+ interned_metadata* md =
+ reinterpret_cast<interned_metadata*> GRPC_MDELEM_DATA(gmd);
#ifndef NDEBUG
if (grpc_trace_metadata.enabled()) {
char* key_str = grpc_slice_to_c_string(md->key);
@@ -385,7 +387,8 @@ grpc_mdelem grpc_mdelem_ref(grpc_mdelem gmd DEBUG_ARGS) {
break;
}
case GRPC_MDELEM_STORAGE_ALLOCATED: {
- allocated_metadata* md = reinterpret_cast<allocated_metadata*>GRPC_MDELEM_DATA(gmd);
+ allocated_metadata* md =
+ reinterpret_cast<allocated_metadata*> GRPC_MDELEM_DATA(gmd);
#ifndef NDEBUG
if (grpc_trace_metadata.enabled()) {
char* key_str = grpc_slice_to_c_string(md->key);
@@ -415,7 +418,8 @@ void grpc_mdelem_unref(grpc_mdelem gmd DEBUG_ARGS) {
case GRPC_MDELEM_STORAGE_STATIC:
break;
case GRPC_MDELEM_STORAGE_INTERNED: {
- interned_metadata* md = reinterpret_cast<interned_metadata*>GRPC_MDELEM_DATA(gmd);
+ interned_metadata* md =
+ reinterpret_cast<interned_metadata*> GRPC_MDELEM_DATA(gmd);
#ifndef NDEBUG
if (grpc_trace_metadata.enabled()) {
char* key_str = grpc_slice_to_c_string(md->key);
@@ -441,7 +445,8 @@ void grpc_mdelem_unref(grpc_mdelem gmd DEBUG_ARGS) {
break;
}
case GRPC_MDELEM_STORAGE_ALLOCATED: {
- allocated_metadata* md = reinterpret_cast<allocated_metadata*>GRPC_MDELEM_DATA(gmd);
+ allocated_metadata* md =
+ reinterpret_cast<allocated_metadata*> GRPC_MDELEM_DATA(gmd);
#ifndef NDEBUG
if (grpc_trace_metadata.enabled()) {
char* key_str = grpc_slice_to_c_string(md->key);
@@ -475,7 +480,8 @@ void* grpc_mdelem_get_user_data(grpc_mdelem md, void (*destroy_func)(void*)) {
return (void*)grpc_static_mdelem_user_data[GRPC_MDELEM_DATA(md) -
grpc_static_mdelem_table];
case GRPC_MDELEM_STORAGE_INTERNED: {
- interned_metadata* im = reinterpret_cast<interned_metadata*>GRPC_MDELEM_DATA(md);
+ interned_metadata* im =
+ reinterpret_cast<interned_metadata*> GRPC_MDELEM_DATA(md);
void* result;
if (gpr_atm_acq_load(&im->destroy_user_data) == (gpr_atm)destroy_func) {
return (void*)gpr_atm_no_barrier_load(&im->user_data);
@@ -500,7 +506,8 @@ void* grpc_mdelem_set_user_data(grpc_mdelem md, void (*destroy_func)(void*),
return (void*)grpc_static_mdelem_user_data[GRPC_MDELEM_DATA(md) -
grpc_static_mdelem_table];
case GRPC_MDELEM_STORAGE_INTERNED: {
- interned_metadata* im = reinterpret_cast<interned_metadata*>GRPC_MDELEM_DATA(md);
+ interned_metadata* im =
+ reinterpret_cast<interned_metadata*> GRPC_MDELEM_DATA(md);
GPR_ASSERT(!is_mdelem_static(md));
GPR_ASSERT((user_data == nullptr) == (destroy_func == nullptr));
gpr_mu_lock(&im->mu_user_data);
diff --git a/src/core/lib/transport/service_config.cc b/src/core/lib/transport/service_config.cc
index f5805b2fa4..75196c5f88 100644
--- a/src/core/lib/transport/service_config.cc
+++ b/src/core/lib/transport/service_config.cc
@@ -209,8 +209,8 @@ grpc_slice_hash_table* grpc_service_config_create_method_config_table(
num_entries += count;
}
// Populate method config table entries.
- entries = static_cast<grpc_slice_hash_table_entry*>(gpr_malloc(
- num_entries * sizeof(grpc_slice_hash_table_entry)));
+ entries = static_cast<grpc_slice_hash_table_entry*>(
+ gpr_malloc(num_entries * sizeof(grpc_slice_hash_table_entry)));
size_t idx = 0;
for (grpc_json* method = field->child; method != nullptr;
method = method->next) {
diff --git a/src/core/lib/transport/timeout_encoding.cc b/src/core/lib/transport/timeout_encoding.cc
index f47f3fa44b..6800255be2 100644
--- a/src/core/lib/transport/timeout_encoding.cc
+++ b/src/core/lib/transport/timeout_encoding.cc
@@ -138,5 +138,6 @@ int grpc_http2_decode_timeout(grpc_slice text, grpc_millis* timeout) {
return 0;
}
p++;
- return is_all_whitespace(reinterpret_cast<const char*>(p), reinterpret_cast<const char*>(end));
+ return is_all_whitespace(reinterpret_cast<const char*>(p),
+ reinterpret_cast<const char*>(end));
}
diff --git a/src/core/lib/transport/transport.cc b/src/core/lib/transport/transport.cc
index 56fc1ce13e..d71d4fdd76 100644
--- a/src/core/lib/transport/transport.cc
+++ b/src/core/lib/transport/transport.cc
@@ -239,7 +239,8 @@ static void destroy_made_transport_op(void* arg, grpc_error* error) {
}
grpc_transport_op* grpc_make_transport_op(grpc_closure* on_complete) {
- made_transport_op* op = static_cast<made_transport_op*>(gpr_malloc(sizeof(*op)));
+ made_transport_op* op =
+ static_cast<made_transport_op*>(gpr_malloc(sizeof(*op)));
GRPC_CLOSURE_INIT(&op->outer_on_complete, destroy_made_transport_op, op,
grpc_schedule_on_exec_ctx);
op->inner_on_complete = on_complete;
diff --git a/src/core/tsi/fake_transport_security.cc b/src/core/tsi/fake_transport_security.cc
index c7eb750a5b..b5b7203d20 100644
--- a/src/core/tsi/fake_transport_security.cc
+++ b/src/core/tsi/fake_transport_security.cc
@@ -112,7 +112,8 @@ static tsi_result tsi_fake_handshake_message_from_string(
static uint32_t load32_little_endian(const unsigned char* buf) {
return (static_cast<uint32_t>(buf[0]) | static_cast<uint32_t>(buf[1] << 8) |
- static_cast<uint32_t>(buf[2] << 16) | static_cast<uint32_t>(buf[3] << 24));
+ static_cast<uint32_t>(buf[2] << 16) |
+ static_cast<uint32_t>(buf[3] << 24));
}
static void store32_little_endian(uint32_t value, unsigned char* buf) {
@@ -155,7 +156,8 @@ static void tsi_fake_frame_reset(tsi_fake_frame* frame, int needs_draining) {
static void tsi_fake_frame_ensure_size(tsi_fake_frame* frame) {
if (frame->data == nullptr) {
frame->allocated_size = frame->size;
- frame->data = static_cast<unsigned char*>(gpr_malloc(frame->allocated_size));
+ frame->data =
+ static_cast<unsigned char*>(gpr_malloc(frame->allocated_size));
} else if (frame->size > frame->allocated_size) {
unsigned char* new_data =
static_cast<unsigned char*>(gpr_realloc(frame->data, frame->size));
@@ -177,7 +179,8 @@ static tsi_result tsi_fake_frame_decode(const unsigned char* incoming_bytes,
if (frame->needs_draining) return TSI_INTERNAL_ERROR;
if (frame->data == nullptr) {
frame->allocated_size = TSI_FAKE_FRAME_INITIAL_ALLOCATED_SIZE;
- frame->data = static_cast<unsigned char*>(gpr_malloc(frame->allocated_size));
+ frame->data =
+ static_cast<unsigned char*>(gpr_malloc(frame->allocated_size));
}
if (frame->offset < TSI_FAKE_FRAME_HEADER_SIZE) {
@@ -258,7 +261,8 @@ static tsi_result fake_protector_protect(tsi_frame_protector* self,
unsigned char* protected_output_frames,
size_t* protected_output_frames_size) {
tsi_result result = TSI_OK;
- tsi_fake_frame_protector* impl = reinterpret_cast<tsi_fake_frame_protector*>(self);
+ tsi_fake_frame_protector* impl =
+ reinterpret_cast<tsi_fake_frame_protector*>(self);
unsigned char frame_header[TSI_FAKE_FRAME_HEADER_SIZE];
tsi_fake_frame* frame = &impl->protect_frame;
size_t saved_output_size = *protected_output_frames_size;
@@ -287,7 +291,8 @@ static tsi_result fake_protector_protect(tsi_frame_protector* self,
if (frame->size == 0) {
/* New frame, create a header. */
size_t written_in_frame_size = 0;
- store32_little_endian(static_cast<uint32_t>(impl->max_frame_size), frame_header);
+ store32_little_endian(static_cast<uint32_t>(impl->max_frame_size),
+ frame_header);
written_in_frame_size = TSI_FAKE_FRAME_HEADER_SIZE;
result = tsi_fake_frame_decode(frame_header, &written_in_frame_size, frame);
if (result != TSI_INCOMPLETE_DATA) {
@@ -317,7 +322,8 @@ static tsi_result fake_protector_protect_flush(
tsi_frame_protector* self, unsigned char* protected_output_frames,
size_t* protected_output_frames_size, size_t* still_pending_size) {
tsi_result result = TSI_OK;
- tsi_fake_frame_protector* impl = reinterpret_cast<tsi_fake_frame_protector*>(self);
+ tsi_fake_frame_protector* impl =
+ reinterpret_cast<tsi_fake_frame_protector*>(self);
tsi_fake_frame* frame = &impl->protect_frame;
if (!frame->needs_draining) {
/* Create a short frame. */
@@ -339,7 +345,8 @@ static tsi_result fake_protector_unprotect(
size_t* protected_frames_bytes_size, unsigned char* unprotected_bytes,
size_t* unprotected_bytes_size) {
tsi_result result = TSI_OK;
- tsi_fake_frame_protector* impl = reinterpret_cast<tsi_fake_frame_protector*>(self);
+ tsi_fake_frame_protector* impl =
+ reinterpret_cast<tsi_fake_frame_protector*>(self);
tsi_fake_frame* frame = &impl->unprotect_frame;
size_t saved_output_size = *unprotected_bytes_size;
size_t drained_size = 0;
@@ -384,7 +391,8 @@ static tsi_result fake_protector_unprotect(
}
static void fake_protector_destroy(tsi_frame_protector* self) {
- tsi_fake_frame_protector* impl = reinterpret_cast<tsi_fake_frame_protector*>(self);
+ tsi_fake_frame_protector* impl =
+ reinterpret_cast<tsi_fake_frame_protector*>(self);
tsi_fake_frame_destruct(&impl->protect_frame);
tsi_fake_frame_destruct(&impl->unprotect_frame);
gpr_free(self);
@@ -414,7 +422,8 @@ static tsi_result fake_zero_copy_grpc_protector_protect(
GPR_MIN(impl->max_frame_size,
unprotected_slices->length + TSI_FAKE_FRAME_HEADER_SIZE);
grpc_slice slice = GRPC_SLICE_MALLOC(TSI_FAKE_FRAME_HEADER_SIZE);
- store32_little_endian(static_cast<uint32_t>(frame_length), GRPC_SLICE_START_PTR(slice));
+ store32_little_endian(static_cast<uint32_t>(frame_length),
+ GRPC_SLICE_START_PTR(slice));
grpc_slice_buffer_add(protected_slices, slice);
size_t data_length = frame_length - TSI_FAKE_FRAME_HEADER_SIZE;
grpc_slice_buffer_move_first(unprotected_slices, data_length,
@@ -520,7 +529,8 @@ static tsi_result fake_handshaker_result_get_unused_bytes(
}
static void fake_handshaker_result_destroy(tsi_handshaker_result* self) {
- fake_handshaker_result* result = reinterpret_cast<fake_handshaker_result*>(self);
+ fake_handshaker_result* result =
+ reinterpret_cast<fake_handshaker_result*>(self);
gpr_free(result->unused_bytes);
gpr_free(self);
}
@@ -544,7 +554,8 @@ static tsi_result fake_handshaker_result_create(
static_cast<fake_handshaker_result*>(gpr_zalloc(sizeof(*result)));
result->base.vtable = &handshaker_result_vtable;
if (unused_bytes_size > 0) {
- result->unused_bytes = static_cast<unsigned char*>(gpr_malloc(unused_bytes_size));
+ result->unused_bytes =
+ static_cast<unsigned char*>(gpr_malloc(unused_bytes_size));
memcpy(result->unused_bytes, unused_bytes, unused_bytes_size);
}
result->unused_bytes_size = unused_bytes_size;
@@ -612,7 +623,8 @@ static tsi_result fake_handshaker_process_bytes_from_peer(
/* We now have a complete frame. */
result = tsi_fake_handshake_message_from_string(
- reinterpret_cast<const char*>(impl->incoming_frame.data) + TSI_FAKE_FRAME_HEADER_SIZE,
+ reinterpret_cast<const char*>(impl->incoming_frame.data) +
+ TSI_FAKE_FRAME_HEADER_SIZE,
&received_msg);
if (result != TSI_OK) {
impl->result = result;
@@ -663,7 +675,8 @@ static tsi_result fake_handshaker_next(
handshaker_result == nullptr) {
return TSI_INVALID_ARGUMENT;
}
- tsi_fake_handshaker* handshaker = reinterpret_cast<tsi_fake_handshaker*>(self);
+ tsi_fake_handshaker* handshaker =
+ reinterpret_cast<tsi_fake_handshaker*>(self);
tsi_result result = TSI_OK;
/* Decode and process a handshake frame from the peer. */
@@ -684,9 +697,9 @@ static tsi_result fake_handshaker_next(
offset += sent_bytes_size;
if (result == TSI_INCOMPLETE_DATA) {
handshaker->outgoing_bytes_buffer_size *= 2;
- handshaker->outgoing_bytes_buffer =
- static_cast<unsigned char*>(gpr_realloc(handshaker->outgoing_bytes_buffer,
- handshaker->outgoing_bytes_buffer_size));
+ handshaker->outgoing_bytes_buffer = static_cast<unsigned char*>(
+ gpr_realloc(handshaker->outgoing_bytes_buffer,
+ handshaker->outgoing_bytes_buffer_size));
}
} while (result == TSI_INCOMPLETE_DATA);
if (result != TSI_OK) return result;
@@ -727,7 +740,8 @@ static const tsi_handshaker_vtable handshaker_vtable = {
};
tsi_handshaker* tsi_create_fake_handshaker(int is_client) {
- tsi_fake_handshaker* impl = static_cast<tsi_fake_handshaker*>(gpr_zalloc(sizeof(*impl)));
+ tsi_fake_handshaker* impl =
+ static_cast<tsi_fake_handshaker*>(gpr_zalloc(sizeof(*impl)));
impl->base.vtable = &handshaker_vtable;
impl->is_client = is_client;
impl->result = TSI_HANDSHAKE_IN_PROGRESS;
@@ -759,7 +773,8 @@ tsi_frame_protector* tsi_create_fake_frame_protector(
tsi_zero_copy_grpc_protector* tsi_create_fake_zero_copy_grpc_protector(
size_t* max_protected_frame_size) {
tsi_fake_zero_copy_grpc_protector* impl =
- static_cast<tsi_fake_zero_copy_grpc_protector*>(gpr_zalloc(sizeof(*impl)));
+ static_cast<tsi_fake_zero_copy_grpc_protector*>(
+ gpr_zalloc(sizeof(*impl)));
grpc_slice_buffer_init(&impl->header_sb);
grpc_slice_buffer_init(&impl->protected_sb);
impl->max_frame_size = (max_protected_frame_size == nullptr)
diff --git a/src/core/tsi/ssl_transport_security.cc b/src/core/tsi/ssl_transport_security.cc
index b32649a8b9..643b5a5c79 100644
--- a/src/core/tsi/ssl_transport_security.cc
+++ b/src/core/tsi/ssl_transport_security.cc
@@ -137,7 +137,8 @@ static void init_openssl(void) {
OpenSSL_add_all_algorithms();
num_locks = CRYPTO_num_locks();
GPR_ASSERT(num_locks > 0);
- openssl_mutexes = static_cast<gpr_mu*>(gpr_malloc(static_cast<size_t>(num_locks) * sizeof(gpr_mu)));
+ openssl_mutexes = static_cast<gpr_mu*>(
+ gpr_malloc(static_cast<size_t>(num_locks) * sizeof(gpr_mu)));
for (i = 0; i < CRYPTO_num_locks(); i++) {
gpr_mu_init(&openssl_mutexes[i]);
}
@@ -275,8 +276,8 @@ static tsi_result peer_property_from_x509_common_name(
}
result = tsi_construct_string_peer_property(
TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY,
- common_name == nullptr ? "" : reinterpret_cast<const char*>(common_name), common_name_size,
- property);
+ common_name == nullptr ? "" : reinterpret_cast<const char*>(common_name),
+ common_name_size, property);
OPENSSL_free(common_name);
return result;
}
@@ -295,7 +296,8 @@ static tsi_result add_pem_certificate(X509* cert, tsi_peer_property* property) {
return TSI_INTERNAL_ERROR;
}
tsi_result result = tsi_construct_string_peer_property(
- TSI_X509_PEM_CERT_PROPERTY, (const char*)contents, static_cast<size_t>(len), property);
+ TSI_X509_PEM_CERT_PROPERTY, (const char*)contents,
+ static_cast<size_t>(len), property);
BIO_free(bio);
return result;
}
@@ -324,8 +326,9 @@ static tsi_result add_subject_alt_names_properties_to_peer(
break;
}
result = tsi_construct_string_peer_property(
- TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY, reinterpret_cast<const char*>(name),
- static_cast<size_t>(name_size), &peer->properties[peer->property_count++]);
+ TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY,
+ reinterpret_cast<const char*>(name), static_cast<size_t>(name_size),
+ &peer->properties[peer->property_count++]);
OPENSSL_free(name);
} else if (subject_alt_name->type == GEN_IPADD) {
char ntop_buf[INET6_ADDRSTRLEN];
@@ -361,11 +364,12 @@ static tsi_result add_subject_alt_names_properties_to_peer(
static tsi_result peer_from_x509(X509* cert, int include_certificate_type,
tsi_peer* peer) {
/* TODO(jboeuf): Maybe add more properties. */
- GENERAL_NAMES* subject_alt_names = static_cast<GENERAL_NAMES*>(X509_get_ext_d2i(
- cert, NID_subject_alt_name, nullptr, nullptr));
- int subject_alt_name_count = (subject_alt_names != nullptr)
- ? static_cast<int>(sk_GENERAL_NAME_num(subject_alt_names))
- : 0;
+ GENERAL_NAMES* subject_alt_names = static_cast<GENERAL_NAMES*>(
+ X509_get_ext_d2i(cert, NID_subject_alt_name, nullptr, nullptr));
+ int subject_alt_name_count =
+ (subject_alt_names != nullptr)
+ ? static_cast<int>(sk_GENERAL_NAME_num(subject_alt_names))
+ : 0;
size_t property_count;
tsi_result result;
GPR_ASSERT(subject_alt_name_count >= 0);
@@ -418,8 +422,8 @@ static tsi_result do_ssl_read(SSL* ssl, unsigned char* unprotected_bytes,
size_t* unprotected_bytes_size) {
int read_from_ssl;
GPR_ASSERT(*unprotected_bytes_size <= INT_MAX);
- read_from_ssl =
- SSL_read(ssl, unprotected_bytes, static_cast<int>(*unprotected_bytes_size));
+ read_from_ssl = SSL_read(ssl, unprotected_bytes,
+ static_cast<int>(*unprotected_bytes_size));
if (read_from_ssl <= 0) {
read_from_ssl = SSL_get_error(ssl, read_from_ssl);
switch (read_from_ssl) {
@@ -451,8 +455,8 @@ static tsi_result do_ssl_write(SSL* ssl, unsigned char* unprotected_bytes,
size_t unprotected_bytes_size) {
int ssl_write_result;
GPR_ASSERT(unprotected_bytes_size <= INT_MAX);
- ssl_write_result =
- SSL_write(ssl, unprotected_bytes, static_cast<int>(unprotected_bytes_size));
+ ssl_write_result = SSL_write(ssl, unprotected_bytes,
+ static_cast<int>(unprotected_bytes_size));
if (ssl_write_result < 0) {
ssl_write_result = SSL_get_error(ssl, ssl_write_result);
if (ssl_write_result == SSL_ERROR_WANT_READ) {
@@ -476,7 +480,8 @@ static tsi_result ssl_ctx_use_certificate_chain(SSL_CTX* context,
X509* certificate = nullptr;
BIO* pem;
GPR_ASSERT(pem_cert_chain_size <= INT_MAX);
- pem = BIO_new_mem_buf((void*)pem_cert_chain, static_cast<int>(pem_cert_chain_size));
+ pem = BIO_new_mem_buf((void*)pem_cert_chain,
+ static_cast<int>(pem_cert_chain_size));
if (pem == nullptr) return TSI_OUT_OF_RESOURCES;
do {
@@ -683,12 +688,14 @@ static tsi_result build_alpn_protocol_name_list(
size_t length =
alpn_protocols[i] == nullptr ? 0 : strlen(alpn_protocols[i]);
if (length == 0 || length > 255) {
- gpr_log(GPR_ERROR, "Invalid protocol name length: %d.", static_cast<int>(length));
+ gpr_log(GPR_ERROR, "Invalid protocol name length: %d.",
+ static_cast<int>(length));
return TSI_INVALID_ARGUMENT;
}
*protocol_name_list_length += length + 1;
}
- *protocol_name_list = static_cast<unsigned char*>(gpr_malloc(*protocol_name_list_length));
+ *protocol_name_list =
+ static_cast<unsigned char*>(gpr_malloc(*protocol_name_list_length));
if (*protocol_name_list == nullptr) return TSI_OUT_OF_RESOURCES;
current = *protocol_name_list;
for (i = 0; i < num_alpn_protocols; i++) {
@@ -721,7 +728,8 @@ static tsi_result ssl_protector_protect(tsi_frame_protector* self,
size_t* unprotected_bytes_size,
unsigned char* protected_output_frames,
size_t* protected_output_frames_size) {
- tsi_ssl_frame_protector* impl = reinterpret_cast<tsi_ssl_frame_protector*>(self);
+ tsi_ssl_frame_protector* impl =
+ reinterpret_cast<tsi_ssl_frame_protector*>(self);
int read_from_ssl;
size_t available;
tsi_result result = TSI_OK;
@@ -775,7 +783,8 @@ static tsi_result ssl_protector_protect_flush(
tsi_frame_protector* self, unsigned char* protected_output_frames,
size_t* protected_output_frames_size, size_t* still_pending_size) {
tsi_result result = TSI_OK;
- tsi_ssl_frame_protector* impl = reinterpret_cast<tsi_ssl_frame_protector*>(self);
+ tsi_ssl_frame_protector* impl =
+ reinterpret_cast<tsi_ssl_frame_protector*>(self);
int read_from_ssl = 0;
int pending;
@@ -812,7 +821,8 @@ static tsi_result ssl_protector_unprotect(
int written_into_ssl = 0;
size_t output_bytes_size = *unprotected_bytes_size;
size_t output_bytes_offset = 0;
- tsi_ssl_frame_protector* impl = reinterpret_cast<tsi_ssl_frame_protector*>(self);
+ tsi_ssl_frame_protector* impl =
+ reinterpret_cast<tsi_ssl_frame_protector*>(self);
/* First, try to read remaining data from ssl. */
result = do_ssl_read(impl->ssl, unprotected_bytes, unprotected_bytes_size);
@@ -847,7 +857,8 @@ static tsi_result ssl_protector_unprotect(
}
static void ssl_protector_destroy(tsi_frame_protector* self) {
- tsi_ssl_frame_protector* impl = reinterpret_cast<tsi_ssl_frame_protector*>(self);
+ tsi_ssl_frame_protector* impl =
+ reinterpret_cast<tsi_ssl_frame_protector*>(self);
if (impl->buffer != nullptr) gpr_free(impl->buffer);
if (impl->ssl != nullptr) SSL_free(impl->ssl);
if (impl->network_io != nullptr) BIO_free(impl->network_io);
@@ -914,7 +925,8 @@ static tsi_result ssl_handshaker_get_bytes_to_send_to_peer(tsi_handshaker* self,
return TSI_INVALID_ARGUMENT;
}
GPR_ASSERT(*bytes_size <= INT_MAX);
- bytes_read_from_ssl = BIO_read(impl->network_io, bytes, static_cast<int>(*bytes_size));
+ bytes_read_from_ssl =
+ BIO_read(impl->network_io, bytes, static_cast<int>(*bytes_size));
if (bytes_read_from_ssl < 0) {
*bytes_size = 0;
if (!BIO_should_retry(impl->network_io)) {
@@ -1005,14 +1017,15 @@ static tsi_result ssl_handshaker_extract_peer(tsi_handshaker* self,
}
if (alpn_selected != nullptr) {
size_t i;
- tsi_peer_property* new_properties = static_cast<tsi_peer_property*>(gpr_zalloc(
- sizeof(*new_properties) * (peer->property_count + 1)));
+ tsi_peer_property* new_properties = static_cast<tsi_peer_property*>(
+ gpr_zalloc(sizeof(*new_properties) * (peer->property_count + 1)));
for (i = 0; i < peer->property_count; i++) {
new_properties[i] = peer->properties[i];
}
result = tsi_construct_string_peer_property(
- TSI_SSL_ALPN_SELECTED_PROTOCOL, reinterpret_cast<const char*>(alpn_selected),
- alpn_selected_len, &new_properties[peer->property_count]);
+ TSI_SSL_ALPN_SELECTED_PROTOCOL,
+ reinterpret_cast<const char*>(alpn_selected), alpn_selected_len,
+ &new_properties[peer->property_count]);
if (result != TSI_OK) {
gpr_free(new_properties);
return result;
@@ -1031,7 +1044,8 @@ static tsi_result ssl_handshaker_create_frame_protector(
TSI_SSL_MAX_PROTECTED_FRAME_SIZE_UPPER_BOUND;
tsi_ssl_handshaker* impl = reinterpret_cast<tsi_ssl_handshaker*>(self);
tsi_ssl_frame_protector* protector_impl =
- static_cast<tsi_ssl_frame_protector*>(gpr_zalloc(sizeof(*protector_impl)));
+ static_cast<tsi_ssl_frame_protector*>(
+ gpr_zalloc(sizeof(*protector_impl)));
if (max_output_protected_frame_size != nullptr) {
if (*max_output_protected_frame_size >
@@ -1157,11 +1171,13 @@ static int select_protocol_list(const unsigned char** out,
const unsigned char* server_list,
size_t server_list_len) {
const unsigned char* client_current = client_list;
- while (static_cast<unsigned int>(client_current - client_list) < client_list_len) {
+ while (static_cast<unsigned int>(client_current - client_list) <
+ client_list_len) {
unsigned char client_current_len = *(client_current++);
const unsigned char* server_current = server_list;
while ((server_current >= server_list) &&
- static_cast<uintptr_t>(server_current - server_list) < server_list_len) {
+ static_cast<uintptr_t>(server_current - server_list) <
+ server_list_len) {
unsigned char server_current_len = *(server_current++);
if ((client_current_len == server_current_len) &&
!memcmp(client_current, server_current, server_current_len)) {
@@ -1367,7 +1383,8 @@ tsi_result tsi_create_ssl_client_handshaker_factory(
return TSI_INVALID_ARGUMENT;
}
- impl = static_cast<tsi_ssl_client_handshaker_factory*>(gpr_zalloc(sizeof(*impl)));
+ impl = static_cast<tsi_ssl_client_handshaker_factory*>(
+ gpr_zalloc(sizeof(*impl)));
tsi_ssl_handshaker_factory_init(&impl->base);
impl->base.vtable = &client_handshaker_factory_vtable;
@@ -1452,7 +1469,8 @@ tsi_result tsi_create_ssl_server_handshaker_factory_ex(
return TSI_INVALID_ARGUMENT;
}
- impl = static_cast<tsi_ssl_server_handshaker_factory*>(gpr_zalloc(sizeof(*impl)));
+ impl = static_cast<tsi_ssl_server_handshaker_factory*>(
+ gpr_zalloc(sizeof(*impl)));
tsi_ssl_handshaker_factory_init(&impl->base);
impl->base.vtable = &server_handshaker_factory_vtable;
diff --git a/src/core/tsi/transport_security.cc b/src/core/tsi/transport_security.cc
index 5cfdf6fc32..0c8e3e9dcc 100644
--- a/src/core/tsi/transport_security.cc
+++ b/src/core/tsi/transport_security.cc
@@ -316,8 +316,8 @@ tsi_result tsi_construct_string_peer_property(const char* name,
tsi_result tsi_construct_peer(size_t property_count, tsi_peer* peer) {
memset(peer, 0, sizeof(tsi_peer));
if (property_count > 0) {
- peer->properties = static_cast<tsi_peer_property*>(gpr_zalloc(
- property_count * sizeof(tsi_peer_property)));
+ peer->properties = static_cast<tsi_peer_property*>(
+ gpr_zalloc(property_count * sizeof(tsi_peer_property)));
peer->property_count = property_count;
}
return TSI_OK;
diff --git a/src/core/tsi/transport_security_adapter.cc b/src/core/tsi/transport_security_adapter.cc
index e57a42ad6c..5f094b3201 100644
--- a/src/core/tsi/transport_security_adapter.cc
+++ b/src/core/tsi/transport_security_adapter.cc
@@ -59,7 +59,8 @@ static tsi_result adapter_result_get_unused_bytes(
}
static void adapter_result_destroy(tsi_handshaker_result* self) {
- tsi_adapter_handshaker_result* impl = reinterpret_cast<tsi_adapter_handshaker_result*>(self);
+ tsi_adapter_handshaker_result* impl =
+ reinterpret_cast<tsi_adapter_handshaker_result*>(self);
tsi_handshaker_destroy(impl->wrapped);
gpr_free(impl->unused_bytes);
gpr_free(self);
@@ -87,7 +88,8 @@ static tsi_result tsi_adapter_create_handshaker_result(
impl->wrapped = wrapped;
impl->unused_bytes_size = unused_bytes_size;
if (unused_bytes_size > 0) {
- impl->unused_bytes = static_cast<unsigned char*>(gpr_malloc(unused_bytes_size));
+ impl->unused_bytes =
+ static_cast<unsigned char*>(gpr_malloc(unused_bytes_size));
memcpy(impl->unused_bytes, unused_bytes, unused_bytes_size);
} else {
impl->unused_bytes = nullptr;
@@ -137,7 +139,8 @@ static tsi_result adapter_create_frame_protector(
}
static void adapter_destroy(tsi_handshaker* self) {
- tsi_adapter_handshaker* impl = reinterpret_cast<tsi_adapter_handshaker*>(self);
+ tsi_adapter_handshaker* impl =
+ reinterpret_cast<tsi_adapter_handshaker*>(self);
tsi_handshaker_destroy(impl->wrapped);
gpr_free(impl->adapter_buffer);
gpr_free(self);
@@ -156,7 +159,8 @@ static tsi_result adapter_next(
}
/* If there are received bytes, process them first. */
- tsi_adapter_handshaker* impl = reinterpret_cast<tsi_adapter_handshaker*>(self);
+ tsi_adapter_handshaker* impl =
+ reinterpret_cast<tsi_adapter_handshaker*>(self);
tsi_result status = TSI_OK;
size_t bytes_consumed = received_bytes_size;
if (received_bytes_size > 0) {
@@ -174,8 +178,8 @@ static tsi_result adapter_next(
offset += to_send_size;
if (status == TSI_INCOMPLETE_DATA) {
impl->adapter_buffer_size *= 2;
- impl->adapter_buffer = static_cast<unsigned char*>(gpr_realloc(
- impl->adapter_buffer, impl->adapter_buffer_size));
+ impl->adapter_buffer = static_cast<unsigned char*>(
+ gpr_realloc(impl->adapter_buffer, impl->adapter_buffer_size));
}
} while (status == TSI_INCOMPLETE_DATA);
if (status != TSI_OK) return status;
@@ -216,12 +220,14 @@ tsi_handshaker* tsi_create_adapter_handshaker(tsi_handshaker* wrapped) {
impl->base.vtable = &handshaker_vtable;
impl->wrapped = wrapped;
impl->adapter_buffer_size = TSI_ADAPTER_INITIAL_BUFFER_SIZE;
- impl->adapter_buffer = static_cast<unsigned char*>(gpr_malloc(impl->adapter_buffer_size));
+ impl->adapter_buffer =
+ static_cast<unsigned char*>(gpr_malloc(impl->adapter_buffer_size));
return &impl->base;
}
tsi_handshaker* tsi_adapter_handshaker_get_wrapped(tsi_handshaker* adapter) {
if (adapter == nullptr) return nullptr;
- tsi_adapter_handshaker* impl = reinterpret_cast<tsi_adapter_handshaker*>(adapter);
+ tsi_adapter_handshaker* impl =
+ reinterpret_cast<tsi_adapter_handshaker*>(adapter);
return impl->wrapped;
}