diff --git a/include/grpc++/security/credentials.h b/include/grpc++/security/credentials.h index 56827c0f21b..cc827f09b0a 100644 --- a/include/grpc++/security/credentials.h +++ b/include/grpc++/security/credentials.h @@ -186,9 +186,8 @@ std::shared_ptr GoogleIAMCredentials( /// Combines a channel credentials and a call credentials into a composite /// channel credentials. std::shared_ptr CompositeChannelCredentials( - const std::shared_ptr& channel_creds, - const std::shared_ptr& call_creds); - + const std::shared_ptr& channel_creds, + const std::shared_ptr& call_creds); /// Combines two call credentials objects into a composite call credentials. std::shared_ptr CompositeCallCredentials( diff --git a/src/core/client_config/subchannel.h b/src/core/client_config/subchannel.h index 1fefa1888a7..381b7689b89 100644 --- a/src/core/client_config/subchannel.h +++ b/src/core/client_config/subchannel.h @@ -77,10 +77,10 @@ void grpc_subchannel_call_unref(grpc_exec_ctx *exec_ctx, /** construct a subchannel call (possibly asynchronously). * - * If the returned status is 1, the call will return immediately and \a target - * will point to a connected \a subchannel_call instance. Note that \a notify + * If the returned status is 1, the call will return immediately and \a target + * will point to a connected \a subchannel_call instance. Note that \a notify * will \em not be invoked in this case. - * Otherwise, if the returned status is 0, the subchannel call will be created + * Otherwise, if the returned status is 0, the subchannel call will be created * asynchronously, invoking the \a notify callback upon completion. */ int grpc_subchannel_create_call(grpc_exec_ctx *exec_ctx, grpc_subchannel *subchannel, diff --git a/src/core/iomgr/pollset_windows.c b/src/core/iomgr/pollset_windows.c index c3f310ee27f..deb661548d2 100644 --- a/src/core/iomgr/pollset_windows.c +++ b/src/core/iomgr/pollset_windows.c @@ -126,7 +126,8 @@ void grpc_pollset_destroy(grpc_pollset *pollset) {} void grpc_pollset_reset(grpc_pollset *pollset) { GPR_ASSERT(pollset->shutting_down); - GPR_ASSERT(!has_workers(&pollset->root_worker, GRPC_POLLSET_WORKER_LINK_POLLSET)); + GPR_ASSERT( + !has_workers(&pollset->root_worker, GRPC_POLLSET_WORKER_LINK_POLLSET)); pollset->shutting_down = 0; pollset->is_iocp_worker = 0; pollset->kicked_without_pollers = 0; diff --git a/src/core/security/credentials.c b/src/core/security/credentials.c index 3db531cd353..f7a2e737858 100644 --- a/src/core/security/credentials.c +++ b/src/core/security/credentials.c @@ -116,9 +116,12 @@ void grpc_call_credentials_release(grpc_call_credentials *creds) { grpc_call_credentials_unref(creds); } -void grpc_call_credentials_get_request_metadata( - grpc_exec_ctx *exec_ctx, grpc_call_credentials *creds, grpc_pollset *pollset, - const char *service_url, grpc_credentials_metadata_cb cb, void *user_data) { +void grpc_call_credentials_get_request_metadata(grpc_exec_ctx *exec_ctx, + grpc_call_credentials *creds, + grpc_pollset *pollset, + const char *service_url, + grpc_credentials_metadata_cb cb, + void *user_data) { if (creds == NULL || creds->vtable->get_request_metadata == NULL) { if (cb != NULL) { cb(exec_ctx, user_data, NULL, 0, GRPC_CREDENTIALS_OK); @@ -423,9 +426,12 @@ static void jwt_destruct(grpc_call_credentials *creds) { gpr_mu_destroy(&c->cache_mu); } -static void jwt_get_request_metadata( - grpc_exec_ctx *exec_ctx, grpc_call_credentials *creds, grpc_pollset *pollset, - const char *service_url, grpc_credentials_metadata_cb cb, void *user_data) { +static void jwt_get_request_metadata(grpc_exec_ctx *exec_ctx, + grpc_call_credentials *creds, + grpc_pollset *pollset, + const char *service_url, + grpc_credentials_metadata_cb cb, + void *user_data) { grpc_service_account_jwt_access_credentials *c = (grpc_service_account_jwt_access_credentials *)creds; gpr_timespec refresh_threshold = gpr_time_from_seconds( @@ -798,9 +804,12 @@ static void on_simulated_token_fetch_done(void *user_data) { grpc_exec_ctx_finish(&exec_ctx); } -static void md_only_test_get_request_metadata( - grpc_exec_ctx *exec_ctx, grpc_call_credentials *creds, grpc_pollset *pollset, - const char *service_url, grpc_credentials_metadata_cb cb, void *user_data) { +static void md_only_test_get_request_metadata(grpc_exec_ctx *exec_ctx, + grpc_call_credentials *creds, + grpc_pollset *pollset, + const char *service_url, + grpc_credentials_metadata_cb cb, + void *user_data) { grpc_md_only_test_credentials *c = (grpc_md_only_test_credentials *)creds; if (c->is_async) { @@ -837,9 +846,12 @@ static void access_token_destruct(grpc_call_credentials *creds) { grpc_credentials_md_store_unref(c->access_token_md); } -static void access_token_get_request_metadata( - grpc_exec_ctx *exec_ctx, grpc_call_credentials *creds, grpc_pollset *pollset, - const char *service_url, grpc_credentials_metadata_cb cb, void *user_data) { +static void access_token_get_request_metadata(grpc_exec_ctx *exec_ctx, + grpc_call_credentials *creds, + grpc_pollset *pollset, + const char *service_url, + grpc_credentials_metadata_cb cb, + void *user_data) { grpc_access_token_credentials *c = (grpc_access_token_credentials *)creds; cb(exec_ctx, user_data, c->access_token_md->entries, 1, GRPC_CREDENTIALS_OK); } @@ -978,9 +990,12 @@ static void composite_call_metadata_cb(grpc_exec_ctx *exec_ctx, void *user_data, composite_call_md_context_destroy(ctx); } -static void composite_call_get_request_metadata( - grpc_exec_ctx *exec_ctx, grpc_call_credentials *creds, grpc_pollset *pollset, - const char *service_url, grpc_credentials_metadata_cb cb, void *user_data) { +static void composite_call_get_request_metadata(grpc_exec_ctx *exec_ctx, + grpc_call_credentials *creds, + grpc_pollset *pollset, + const char *service_url, + grpc_credentials_metadata_cb cb, + void *user_data) { grpc_composite_call_credentials *c = (grpc_composite_call_credentials *)creds; grpc_composite_call_credentials_metadata_context *ctx; @@ -1097,7 +1112,7 @@ static void iam_get_request_metadata(grpc_exec_ctx *exec_ctx, } static grpc_call_credentials_vtable iam_vtable = {iam_destruct, - iam_get_request_metadata}; + iam_get_request_metadata}; grpc_call_credentials *grpc_google_iam_credentials_create( const char *token, const char *authority_selector, void *reserved) { @@ -1265,4 +1280,3 @@ grpc_channel_credentials *grpc_composite_channel_credentials_create( c->call_creds = grpc_call_credentials_ref(call_creds); return &c->base; } - diff --git a/src/core/security/credentials.h b/src/core/security/credentials.h index 559574d514e..132060910ec 100644 --- a/src/core/security/credentials.h +++ b/src/core/security/credentials.h @@ -187,7 +187,8 @@ typedef struct { size_t num_creds; } grpc_call_credentials_array; -const grpc_call_credentials_array *grpc_composite_call_credentials_get_credentials( +const grpc_call_credentials_array * +grpc_composite_call_credentials_get_credentials( grpc_call_credentials *composite_creds); /* Returns creds if creds is of the specified type or the inner creds of the diff --git a/src/core/security/google_default_credentials.c b/src/core/security/google_default_credentials.c index e5a810f23cc..6a54fe4e47c 100644 --- a/src/core/security/google_default_credentials.c +++ b/src/core/security/google_default_credentials.c @@ -214,7 +214,8 @@ grpc_channel_credentials *grpc_google_default_credentials_create(void) { end: if (result == NULL) { if (call_creds != NULL) { - /* Blend with default ssl credentials and add a global reference so that it + /* Blend with default ssl credentials and add a global reference so that + it can be cached and re-served. */ grpc_channel_credentials *ssl_creds = grpc_ssl_credentials_create(NULL, NULL, NULL); diff --git a/src/core/security/security_connector.c b/src/core/security/security_connector.c index 8dbacdd35e5..3c54a4deae1 100644 --- a/src/core/security/security_connector.c +++ b/src/core/security/security_connector.c @@ -571,9 +571,9 @@ size_t grpc_get_default_ssl_roots(const unsigned char **pem_root_certs) { } grpc_security_status grpc_ssl_channel_security_connector_create( - grpc_call_credentials *request_metadata_creds, const grpc_ssl_config *config, - const char *target_name, const char *overridden_target_name, - grpc_channel_security_connector **sc) { + grpc_call_credentials *request_metadata_creds, + const grpc_ssl_config *config, const char *target_name, + const char *overridden_target_name, grpc_channel_security_connector **sc) { size_t num_alpn_protocols = grpc_chttp2_num_alpn_versions(); const unsigned char **alpn_protocol_strings = gpr_malloc(sizeof(const char *) * num_alpn_protocols); diff --git a/src/core/support/slice.c b/src/core/support/slice.c index 0470533c1cf..5b091f17b0f 100644 --- a/src/core/support/slice.c +++ b/src/core/support/slice.c @@ -61,12 +61,13 @@ void gpr_slice_unref(gpr_slice slice) { nothing */ static void noop_ref_or_unref(void *unused) {} -static gpr_slice_refcount noop_refcount = {noop_ref_or_unref, noop_ref_or_unref}; +static gpr_slice_refcount noop_refcount = {noop_ref_or_unref, + noop_ref_or_unref}; gpr_slice gpr_slice_from_static_string(const char *s) { gpr_slice slice; slice.refcount = &noop_refcount; - slice.data.refcounted.bytes = (gpr_uint8*)s; + slice.data.refcounted.bytes = (gpr_uint8 *)s; slice.data.refcounted.length = strlen(s); return slice; } diff --git a/src/core/surface/byte_buffer_reader.c b/src/core/surface/byte_buffer_reader.c index 9f830df68ce..57417f41b0d 100644 --- a/src/core/surface/byte_buffer_reader.c +++ b/src/core/surface/byte_buffer_reader.c @@ -121,4 +121,3 @@ gpr_slice grpc_byte_buffer_reader_readall(grpc_byte_buffer_reader *reader) { } return out_slice; } - diff --git a/src/core/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c index f62294c7c50..1545cf24ca5 100644 --- a/src/core/transport/chttp2_transport.c +++ b/src/core/transport/chttp2_transport.c @@ -806,7 +806,7 @@ static void perform_stream_op_locked( } if (stream_global->write_closed) { grpc_chttp2_complete_closure_step( - exec_ctx, &stream_global->send_trailing_metadata_finished, + exec_ctx, &stream_global->send_trailing_metadata_finished, grpc_metadata_batch_is_empty(op->send_trailing_metadata)); } else if (stream_global->id != 0) { /* TODO(ctiller): check if there's flow control for any outstanding @@ -1033,7 +1033,8 @@ void grpc_chttp2_fake_status(grpc_exec_ctx *exec_ctx, to the upper layers - drop what we've got, and then publish what we want - which is safe because we haven't told anyone about the metadata yet */ - if (!stream_global->published_trailing_metadata || stream_global->recv_trailing_metadata_finished != NULL) { + if (!stream_global->published_trailing_metadata || + stream_global->recv_trailing_metadata_finished != NULL) { grpc_mdctx *mdctx = TRANSPORT_FROM_GLOBAL(transport_global)->metadata_context; char status_string[GPR_LTOA_MIN_BUFSIZE]; diff --git a/src/core/transport/metadata.c b/src/core/transport/metadata.c index da52961fc9a..0ea3dd20eec 100644 --- a/src/core/transport/metadata.c +++ b/src/core/transport/metadata.c @@ -52,14 +52,30 @@ #ifdef GRPC_METADATA_REFCOUNT_DEBUG #define DEBUG_ARGS , const char *file, int line #define FWD_DEBUG_ARGS , file, line -#define INTERNAL_STRING_REF(s) if (is_mdstr_static((grpc_mdstr*)(s))); else internal_string_ref((s), __FILE__, __LINE__) -#define INTERNAL_STRING_UNREF(s) if (is_mdstr_static((grpc_mdstr*)(s))); else internal_string_unref((s), __FILE__, __LINE__) +#define INTERNAL_STRING_REF(s) \ + if (is_mdstr_static((grpc_mdstr *)(s))) \ + ; \ + else \ + internal_string_ref((s), __FILE__, __LINE__) +#define INTERNAL_STRING_UNREF(s) \ + if (is_mdstr_static((grpc_mdstr *)(s))) \ + ; \ + else \ + internal_string_unref((s), __FILE__, __LINE__) #define REF_MD_LOCKED(s) ref_md_locked((s), __FILE__, __LINE__) #else #define DEBUG_ARGS #define FWD_DEBUG_ARGS -#define INTERNAL_STRING_REF(s) if (is_mdstr_static((grpc_mdstr*)(s))); else internal_string_ref((s)) -#define INTERNAL_STRING_UNREF(s) if (is_mdstr_static((grpc_mdstr*)(s))); else internal_string_unref((s)) +#define INTERNAL_STRING_REF(s) \ + if (is_mdstr_static((grpc_mdstr *)(s))) \ + ; \ + else \ + internal_string_ref((s)) +#define INTERNAL_STRING_UNREF(s) \ + if (is_mdstr_static((grpc_mdstr *)(s))) \ + ; \ + else \ + internal_string_unref((s)) #define REF_MD_LOCKED(s) ref_md_locked((s)) #endif @@ -140,27 +156,28 @@ void grpc_mdctx_global_init(void) { for (i = 0; i < GRPC_STATIC_MDSTR_COUNT; i++) { grpc_mdstr *elem = &grpc_static_mdstr_table[i]; const char *str = grpc_static_metadata_strings[i]; - *(gpr_slice*)&elem->slice = gpr_slice_from_static_string(str); - *(gpr_uint32*)&elem->hash = gpr_murmur_hash3(str, strlen(str), 0); + *(gpr_slice *)&elem->slice = gpr_slice_from_static_string(str); + *(gpr_uint32 *)&elem->hash = gpr_murmur_hash3(str, strlen(str), 0); } for (i = 0; i < GRPC_STATIC_MDELEM_COUNT; i++) { grpc_mdelem *elem = &grpc_static_mdelem_table[i]; grpc_mdstr *key = &grpc_static_mdstr_table[2 * i + 0]; grpc_mdstr *value = &grpc_static_mdstr_table[2 * i + 1]; - *(grpc_mdstr**)&elem->key = key; - *(grpc_mdstr**)&elem->value = value; + *(grpc_mdstr **)&elem->key = key; + *(grpc_mdstr **)&elem->value = value; } } -void grpc_mdctx_global_shutdown(void) { -} +void grpc_mdctx_global_shutdown(void) {} static int is_mdstr_static(grpc_mdstr *s) { - return s >= &grpc_static_mdstr_table[0] && s < &grpc_static_mdstr_table[GRPC_STATIC_MDSTR_COUNT]; + return s >= &grpc_static_mdstr_table[0] && + s < &grpc_static_mdstr_table[GRPC_STATIC_MDSTR_COUNT]; } static int is_mdelem_static(grpc_mdelem *e) { - return e >= &grpc_static_mdelem_table[0] && e < &grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT]; + return e >= &grpc_static_mdelem_table[0] && + e < &grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT]; } static void lock(grpc_mdctx *ctx) { gpr_mu_lock(&ctx->mu); } @@ -580,7 +597,8 @@ grpc_mdelem *grpc_mdelem_from_metadata_strings(grpc_mdctx *ctx, for (i = 0; i <= ctx->static_mdtab_maxprobe; i++) { size_t idx = (hash + i) % GPR_ARRAY_SIZE(ctx->static_mdtab); static_mdelem *smd = &ctx->static_mdtab[idx]; - if (smd->hash == hash && smd->mdelem->key == mkey && smd->mdelem->value == mvalue) { + if (smd->hash == hash && smd->mdelem->key == mkey && + smd->mdelem->value == mvalue) { return smd->mdelem; } } diff --git a/src/core/transport/static_metadata.c b/src/core/transport/static_metadata.c index f0b0f863109..c4dc0c7b887 100644 --- a/src/core/transport/static_metadata.c +++ b/src/core/transport/static_metadata.c @@ -58,79 +58,18 @@ const gpr_uint8 grpc_static_metadata_elem_indices[GRPC_STATIC_MDELEM_COUNT * 67, 7, 68, 28, 69, 70, 71, 28, 72, 28, 73, 28, 74, 28, 75, 28}; const char *const grpc_static_metadata_strings[GRPC_STATIC_MDSTR_COUNT] = { - "0", - "200", - "204", - "206", - "304", - "400", - "404", - "500", - "accept", - "accept-charset", - "accept-encoding", - "accept-language", - "accept-ranges", - "access-control-allow-origin", - "age", - "allow", - ":authority", - "authorization", - "cache-control", - "content-disposition", - "content-encoding", - "content-language", - "content-length", - "content-location", - "content-range", - "content-type", - "cookie", - "date", - "", - "etag", - "expect", - "expires", - "from", - "GET", - "grpc", - "grpc-accept-encoding", - "grpc-encoding", - "grpc-message", - "grpc-status", - "grpc-timeout", - "gzip, deflate", - "host", - "http", - "https", - "if-match", - "if-modified-since", - "if-none-match", - "if-range", - "if-unmodified-since", - "last-modified", - "link", - "location", - "max-forwards", - ":method", - ":path", - "POST", - "proxy-authenticate", - "proxy-authorization", - "range", - "referer", - "refresh", - "retry-after", - ":scheme", - "server", - "set-cookie", - "/", - "/index.html", - ":status", - "strict-transport-security", - "te", - "trailers", - "transfer-encoding", - "user-agent", - "vary", - "via", + "0", "200", "204", "206", "304", "400", "404", "500", "accept", + "accept-charset", "accept-encoding", "accept-language", "accept-ranges", + "access-control-allow-origin", "age", "allow", ":authority", + "authorization", "cache-control", "content-disposition", "content-encoding", + "content-language", "content-length", "content-location", "content-range", + "content-type", "cookie", "date", "", "etag", "expect", "expires", "from", + "GET", "grpc", "grpc-accept-encoding", "grpc-encoding", "grpc-message", + "grpc-status", "grpc-timeout", "gzip, deflate", "host", "http", "https", + "if-match", "if-modified-since", "if-none-match", "if-range", + "if-unmodified-since", "last-modified", "link", "location", "max-forwards", + ":method", ":path", "POST", "proxy-authenticate", "proxy-authorization", + "range", "referer", "refresh", "retry-after", ":scheme", "server", + "set-cookie", "/", "/index.html", ":status", "strict-transport-security", + "te", "trailers", "transfer-encoding", "user-agent", "vary", "via", "www-authenticate"}; diff --git a/src/cpp/client/insecure_credentials.cc b/src/cpp/client/insecure_credentials.cc index 563fa9267d0..1293203b932 100644 --- a/src/cpp/client/insecure_credentials.cc +++ b/src/cpp/client/insecure_credentials.cc @@ -54,7 +54,9 @@ class InsecureChannelCredentialsImpl GRPC_FINAL : public ChannelCredentials { grpc_insecure_channel_create(target.c_str(), &channel_args, nullptr)); } - SecureChannelCredentials* AsSecureCredentials() GRPC_OVERRIDE { return nullptr; } + SecureChannelCredentials* AsSecureCredentials() GRPC_OVERRIDE { + return nullptr; + } }; } // namespace diff --git a/src/cpp/client/secure_credentials.h b/src/cpp/client/secure_credentials.h index b241761a7c4..e9afa9e57f8 100644 --- a/src/cpp/client/secure_credentials.h +++ b/src/cpp/client/secure_credentials.h @@ -76,7 +76,6 @@ class SecureCallCredentials GRPC_FINAL : public CallCredentials { grpc_call_credentials* const c_creds_; }; - class MetadataCredentialsPluginWrapper GRPC_FINAL { public: static void Destroy(void* wrapper); diff --git a/test/core/client_config/lb_policies_test.c b/test/core/client_config/lb_policies_test.c index 0218b8f07fb..6f218e7f08b 100644 --- a/test/core/client_config/lb_policies_test.c +++ b/test/core/client_config/lb_policies_test.c @@ -135,9 +135,8 @@ static void kill_server(const servers_fixture *f, size_t i) { gpr_log(GPR_INFO, "KILLING SERVER %d", i); GPR_ASSERT(f->servers[i] != NULL); grpc_server_shutdown_and_notify(f->servers[i], f->cq, tag(10000)); - GPR_ASSERT( - grpc_completion_queue_pluck(f->cq, tag(10000), n_millis_time(5000), NULL) - .type == GRPC_OP_COMPLETE); + GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(10000), n_millis_time(5000), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->servers[i]); f->servers[i] = NULL; } @@ -203,8 +202,8 @@ static void teardown_servers(servers_fixture *f) { if (f->servers[i] == NULL) continue; grpc_server_shutdown_and_notify(f->servers[i], f->cq, tag(10000)); GPR_ASSERT(grpc_completion_queue_pluck(f->cq, tag(10000), - n_millis_time(5000), NULL) - .type == GRPC_OP_COMPLETE); + n_millis_time(5000), + NULL).type == GRPC_OP_COMPLETE); grpc_server_destroy(f->servers[i]); } grpc_completion_queue_shutdown(f->cq); @@ -269,8 +268,8 @@ int *perform_request(servers_fixture *f, grpc_channel *client, memset(s_valid, 0, f->num_servers * sizeof(int)); c = grpc_channel_create_call(client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq, - "/foo", "foo.test.google.fr", gpr_inf_future(GPR_CLOCK_REALTIME), - NULL); + "/foo", "foo.test.google.fr", + gpr_inf_future(GPR_CLOCK_REALTIME), NULL); GPR_ASSERT(c); completed_client = 0; @@ -304,8 +303,8 @@ int *perform_request(servers_fixture *f, grpc_channel *client, s_idx = -1; while ((ev = grpc_completion_queue_next( - f->cq, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), NULL)) - .type != GRPC_QUEUE_TIMEOUT) { + f->cq, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(1), NULL)).type != + GRPC_QUEUE_TIMEOUT) { GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); read_tag = ((int)(gpr_intptr)ev.tag); gpr_log(GPR_DEBUG, "EVENT: success:%d, type:%d, tag:%d iter:%d", diff --git a/test/core/end2end/tests/cancel_with_status.c b/test/core/end2end/tests/cancel_with_status.c index eecfa83fa48..2005e5f8816 100644 --- a/test/core/end2end/tests/cancel_with_status.c +++ b/test/core/end2end/tests/cancel_with_status.c @@ -166,7 +166,8 @@ static void simple_request_body(grpc_end2end_test_fixture f, size_t num_ops) { cq_verifier_destroy(cqv); } -static void test_invoke_simple_request(grpc_end2end_test_config config, size_t num_ops) { +static void test_invoke_simple_request(grpc_end2end_test_config config, + size_t num_ops) { grpc_end2end_test_fixture f; f = begin_test(config, "test_invoke_simple_request", NULL, NULL); diff --git a/test/core/end2end/tests/negative_deadline.c b/test/core/end2end/tests/negative_deadline.c index abcc1ba3584..8fe9e7bcc57 100644 --- a/test/core/end2end/tests/negative_deadline.c +++ b/test/core/end2end/tests/negative_deadline.c @@ -163,7 +163,8 @@ static void simple_request_body(grpc_end2end_test_fixture f, size_t num_ops) { cq_verifier_destroy(cqv); } -static void test_invoke_simple_request(grpc_end2end_test_config config, size_t num_ops) { +static void test_invoke_simple_request(grpc_end2end_test_config config, + size_t num_ops) { grpc_end2end_test_fixture f; f = begin_test(config, "test_invoke_simple_request", NULL, NULL); diff --git a/test/core/network_benchmarks/low_level_ping_pong.c b/test/core/network_benchmarks/low_level_ping_pong.c index 7a2d894481b..dd1544c27b8 100644 --- a/test/core/network_benchmarks/low_level_ping_pong.c +++ b/test/core/network_benchmarks/low_level_ping_pong.c @@ -139,7 +139,7 @@ static int poll_read_bytes(int fd, char *buf, size_t read_size, int spin) { gpr_log(GPR_ERROR, "Read failed: %s", strerror(errno)); return -1; } - bytes_read += (size_t) err2; + bytes_read += (size_t)err2; } while (bytes_read < read_size); return 0; } @@ -174,11 +174,11 @@ static int epoll_read_bytes(struct thread_args *args, char *buf, int spin) { GPR_ASSERT(ev.data.fd == args->fds.read_fd); do { do { - err2 = read(args->fds.read_fd, buf + bytes_read, - read_size - bytes_read); + err2 = + read(args->fds.read_fd, buf + bytes_read, read_size - bytes_read); } while (err2 < 0 && errno == EINTR); if (errno == EAGAIN) break; - bytes_read += (size_t) err2; + bytes_read += (size_t)err2; /* TODO(klempner): This should really be doing an extra call after we are done to ensure we see an EAGAIN */ } while (bytes_read < read_size); diff --git a/test/core/security/credentials_test.c b/test/core/security/credentials_test.c index dcb35e53096..4cfef7be789 100644 --- a/test/core/security/credentials_test.c +++ b/test/core/security/credentials_test.c @@ -353,8 +353,8 @@ static void test_google_iam_creds(void) { test_google_iam_authorization_token, test_google_iam_authority_selector, NULL); grpc_call_credentials_get_request_metadata(&exec_ctx, creds, NULL, - test_service_url, - check_google_iam_metadata, creds); + test_service_url, + check_google_iam_metadata, creds); grpc_exec_ctx_finish(&exec_ctx); } @@ -436,7 +436,8 @@ static void test_oauth2_google_iam_composite_creds(void) { test_google_iam_authorization_token, test_google_iam_authority_selector, NULL); grpc_call_credentials *composite_creds = - grpc_composite_call_credentials_create(oauth2_creds, google_iam_creds, NULL); + grpc_composite_call_credentials_create(oauth2_creds, google_iam_creds, + NULL); grpc_call_credentials_unref(oauth2_creds); grpc_call_credentials_unref(google_iam_creds); GPR_ASSERT( @@ -481,7 +482,8 @@ static void test_channel_oauth2_google_iam_composite_creds(void) { grpc_call_credentials *oauth2_creds = grpc_access_token_credentials_create("blah", NULL); grpc_channel_credentials *channel_oauth2_creds = - grpc_composite_channel_credentials_create(channel_creds, oauth2_creds, NULL); + grpc_composite_channel_credentials_create(channel_creds, oauth2_creds, + NULL); grpc_call_credentials *google_iam_creds = grpc_google_iam_credentials_create( test_google_iam_authorization_token, test_google_iam_authority_selector, NULL); diff --git a/test/core/surface/byte_buffer_reader_test.c b/test/core/surface/byte_buffer_reader_test.c index 7f9cd6b62b0..6b41698717b 100644 --- a/test/core/surface/byte_buffer_reader_test.c +++ b/test/core/surface/byte_buffer_reader_test.c @@ -185,8 +185,8 @@ static void test_byte_buffer_from_reader(void) { } static void test_readall(void) { - char* lotsa_as[512]; - char* lotsa_bs[1024]; + char *lotsa_as[512]; + char *lotsa_bs[1024]; gpr_slice slices[2]; grpc_byte_buffer *buffer; grpc_byte_buffer_reader reader; diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h index f4400692fea..b24a90adacd 100644 --- a/test/cpp/qps/client.h +++ b/test/cpp/qps/client.h @@ -181,29 +181,29 @@ class Client { std::unique_ptr random_dist; switch (load.load_case()) { - case LoadParams::kClosedLoop: - // Closed-loop doesn't use random dist at all - break; - case LoadParams::kPoisson: - random_dist.reset( - new ExpDist(load.poisson().offered_load() / num_threads)); - break; - case LoadParams::kUniform: - random_dist.reset( - new UniformDist(load.uniform().interarrival_lo() * num_threads, - load.uniform().interarrival_hi() * num_threads)); - break; - case LoadParams::kDeterm: - random_dist.reset( - new DetDist(num_threads / load.determ().offered_load())); - break; - case LoadParams::kPareto: - random_dist.reset( - new ParetoDist(load.pareto().interarrival_base() * num_threads, - load.pareto().alpha())); - break; - default: - GPR_ASSERT(false); + case LoadParams::kClosedLoop: + // Closed-loop doesn't use random dist at all + break; + case LoadParams::kPoisson: + random_dist.reset( + new ExpDist(load.poisson().offered_load() / num_threads)); + break; + case LoadParams::kUniform: + random_dist.reset( + new UniformDist(load.uniform().interarrival_lo() * num_threads, + load.uniform().interarrival_hi() * num_threads)); + break; + case LoadParams::kDeterm: + random_dist.reset( + new DetDist(num_threads / load.determ().offered_load())); + break; + case LoadParams::kPareto: + random_dist.reset( + new ParetoDist(load.pareto().interarrival_base() * num_threads, + load.pareto().alpha())); + break; + default: + GPR_ASSERT(false); } // Set closed_loop_ based on whether or not random_dist is set