diff options
author | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2015-12-01 22:52:20 +0100 |
---|---|---|
committer | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2015-12-01 22:52:20 +0100 |
commit | ba404826be4720fc46ae161f950e27814928d5c5 (patch) | |
tree | ae21ff387782aaffab6e0c3cccd9aab6d629acfd | |
parent | 3e5cbee777cfd1d05f1161dfb97093878c7e48ed (diff) |
Clang format.
22 files changed, 76 insertions, 89 deletions
diff --git a/include/grpc++/alarm.h b/include/grpc++/alarm.h index 8cf7f59290..957d11c500 100644 --- a/include/grpc++/alarm.h +++ b/include/grpc++/alarm.h @@ -43,7 +43,7 @@ namespace grpc { /// A thin wrapper around \a grpc_alarm (see / \a / src/core/surface/alarm.h). -class Alarm: public GrpcLibrary { +class Alarm : public GrpcLibrary { public: /// Create a completion queue alarm instance associated to \a cq. /// diff --git a/include/grpc++/security/credentials.h b/include/grpc++/security/credentials.h index ad3572c003..e5652dc184 100644 --- a/include/grpc++/security/credentials.h +++ b/include/grpc++/security/credentials.h @@ -187,9 +187,8 @@ std::shared_ptr<CallCredentials> GoogleIAMCredentials( /// Combines a channel credentials and a call credentials into a composite /// channel credentials. std::shared_ptr<ChannelCredentials> CompositeChannelCredentials( - const std::shared_ptr<ChannelCredentials>& channel_creds, - const std::shared_ptr<CallCredentials>& call_creds); - + const std::shared_ptr<ChannelCredentials>& channel_creds, + const std::shared_ptr<CallCredentials>& call_creds); /// Combines two call credentials objects into a composite call credentials. std::shared_ptr<CallCredentials> CompositeCallCredentials( @@ -217,8 +216,7 @@ class MetadataCredentialsPlugin { // The channel_auth_context contains (among other things), the identity of // the server. virtual Status GetMetadata( - grpc::string_ref service_url, - grpc::string_ref method_name, + grpc::string_ref service_url, grpc::string_ref method_name, const AuthContext& channel_auth_context, std::multimap<grpc::string, grpc::string>* metadata) = 0; }; diff --git a/src/core/channel/client_uchannel.c b/src/core/channel/client_uchannel.c index 510677a844..19a8fa1f79 100644 --- a/src/core/channel/client_uchannel.c +++ b/src/core/channel/client_uchannel.c @@ -172,7 +172,7 @@ static void monitor_subchannel(grpc_exec_ctx *exec_ctx, void *arg, } static void started_call_locked(grpc_exec_ctx *exec_ctx, void *arg, - int iomgr_success) { + int iomgr_success) { call_data *calld = arg; grpc_transport_stream_op op; int have_waiting; @@ -466,15 +466,9 @@ static void cuc_destroy_channel_elem(grpc_exec_ctx *exec_ctx, } const grpc_channel_filter grpc_client_uchannel_filter = { - cuc_start_transport_stream_op, - cuc_start_transport_op, - sizeof(call_data), - cuc_init_call_elem, - cuc_destroy_call_elem, - sizeof(channel_data), - cuc_init_channel_elem, - cuc_destroy_channel_elem, - cuc_get_peer, + cuc_start_transport_stream_op, cuc_start_transport_op, sizeof(call_data), + cuc_init_call_elem, cuc_destroy_call_elem, sizeof(channel_data), + cuc_init_channel_elem, cuc_destroy_channel_elem, cuc_get_peer, "client-uchannel", }; diff --git a/src/core/security/client_auth_filter.c b/src/core/security/client_auth_filter.c index e7057051e0..18f18410d5 100644 --- a/src/core/security/client_auth_filter.c +++ b/src/core/security/client_auth_filter.c @@ -152,8 +152,8 @@ void build_auth_metadata_context(grpc_security_connector *sc, grpc_mdstr_as_c_string(calld->host), service); calld->auth_md_context.service_url = service_url; calld->auth_md_context.method_name = method_name; - calld->auth_md_context.channel_auth_context = GRPC_AUTH_CONTEXT_REF( - sc->auth_context, "grpc_auth_metadata_context"); + calld->auth_md_context.channel_auth_context = + GRPC_AUTH_CONTEXT_REF(sc->auth_context, "grpc_auth_metadata_context"); gpr_free(service); } diff --git a/src/core/security/credentials.c b/src/core/security/credentials.c index 751665b494..543c75044b 100644 --- a/src/core/security/credentials.c +++ b/src/core/security/credentials.c @@ -1272,4 +1272,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 0ce33d5e7c..96135f4776 100644 --- a/src/core/security/credentials.h +++ b/src/core/security/credentials.h @@ -174,19 +174,18 @@ struct grpc_call_credentials { grpc_call_credentials *grpc_call_credentials_ref(grpc_call_credentials *creds); void grpc_call_credentials_unref(grpc_call_credentials *creds); -void grpc_call_credentials_get_request_metadata(grpc_exec_ctx *exec_ctx, - grpc_call_credentials *creds, - grpc_pollset *pollset, - grpc_auth_metadata_context context, - 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, grpc_auth_metadata_context context, + grpc_credentials_metadata_cb cb, void *user_data); typedef struct { grpc_call_credentials **creds_array; 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 e5a810f23c..6a54fe4e47 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 8dbacdd35e..3c54a4deae 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/security/security_context.c b/src/core/security/security_context.c index 56c56a9506..2068c97d78 100644 --- a/src/core/security/security_context.c +++ b/src/core/security/security_context.c @@ -320,8 +320,7 @@ grpc_arg grpc_auth_context_to_arg(grpc_auth_context *p) { return arg; } -grpc_auth_context *grpc_auth_context_from_arg( - const grpc_arg *arg) { +grpc_auth_context *grpc_auth_context_from_arg(const grpc_arg *arg) { if (strcmp(arg->key, GRPC_AUTH_CONTEXT_ARG) != 0) return NULL; if (arg->type != GRPC_ARG_POINTER) { gpr_log(GPR_ERROR, "Invalid type %d for arg %s", arg->type, @@ -336,8 +335,7 @@ grpc_auth_context *grpc_find_auth_context_in_args( size_t i; if (args == NULL) return NULL; for (i = 0; i < args->num_args; i++) { - grpc_auth_context *p = - grpc_auth_context_from_arg(&args->args[i]); + grpc_auth_context *p = grpc_auth_context_from_arg(&args->args[i]); if (p != NULL) return p; } return NULL; diff --git a/src/core/security/server_auth_filter.c b/src/core/security/server_auth_filter.c index 2e18369fe8..67b3826162 100644 --- a/src/core/security/server_auth_filter.c +++ b/src/core/security/server_auth_filter.c @@ -220,8 +220,7 @@ static void init_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem, initial_op->context[GRPC_CONTEXT_SECURITY].value); } server_ctx = grpc_server_security_context_create(); - server_ctx->auth_context = - grpc_auth_context_create(chand->auth_context); + server_ctx->auth_context = grpc_auth_context_create(chand->auth_context); server_ctx->auth_context->pollset = initial_op->bind_pollset; initial_op->context[GRPC_CONTEXT_SECURITY].value = server_ctx; initial_op->context[GRPC_CONTEXT_SECURITY].destroy = diff --git a/src/core/security/server_secure_chttp2.c b/src/core/security/server_secure_chttp2.c index 82c639e830..851e0cfab3 100644 --- a/src/core/security/server_secure_chttp2.c +++ b/src/core/security/server_secure_chttp2.c @@ -94,8 +94,7 @@ static void setup_transport(grpc_exec_ctx *exec_ctx, void *statep, grpc_channel_args *args_copy; grpc_arg args_to_add[2]; args_to_add[0] = grpc_server_credentials_to_arg(state->creds); - args_to_add[1] = - grpc_auth_context_to_arg(state->sc->auth_context); + args_to_add[1] = grpc_auth_context_to_arg(state->sc->auth_context); args_copy = grpc_channel_args_copy_and_add( grpc_server_get_channel_args(state->server), args_to_add, GPR_ARRAY_SIZE(args_to_add)); diff --git a/src/core/surface/byte_buffer_reader.c b/src/core/surface/byte_buffer_reader.c index 9f830df68c..57417f41b0 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/surface/call_test_only.h b/src/core/surface/call_test_only.h index df4be3248b..b3a2bbd6f1 100644 --- a/src/core/surface/call_test_only.h +++ b/src/core/surface/call_test_only.h @@ -57,7 +57,6 @@ gpr_uint32 grpc_call_test_only_get_message_flags(grpc_call *call); * To be indexed by grpc_compression_algorithm enum values. */ gpr_uint32 grpc_call_test_only_get_encodings_accepted_by_peer(grpc_call *call); - #ifdef __cplusplus } #endif diff --git a/src/cpp/client/insecure_credentials.cc b/src/cpp/client/insecure_credentials.cc index 563fa9267d..1293203b93 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 8e3c713a50..cef59292dd 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/src/cpp/common/alarm.cc b/src/cpp/common/alarm.cc index bce0b174f8..1f0f04175e 100644 --- a/src/cpp/common/alarm.cc +++ b/src/cpp/common/alarm.cc @@ -38,12 +38,8 @@ namespace grpc { Alarm::Alarm(CompletionQueue* cq, gpr_timespec deadline, void* tag) : alarm_(grpc_alarm_create(cq->cq(), deadline, tag)) {} -Alarm::~Alarm() { - grpc_alarm_destroy(alarm_); -} +Alarm::~Alarm() { grpc_alarm_destroy(alarm_); } -void Alarm::Cancel() { - grpc_alarm_cancel(alarm_); -} +void Alarm::Cancel() { grpc_alarm_cancel(alarm_); } } // namespace grpc diff --git a/test/core/client_config/lb_policies_test.c b/test/core/client_config/lb_policies_test.c index 3eb6f11bf7..02d3314eb8 100644 --- a/test/core/client_config/lb_policies_test.c +++ b/test/core/client_config/lb_policies_test.c @@ -286,10 +286,12 @@ int *perform_request(servers_fixture *f, grpc_channel *client, op->reserved = NULL; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; - op->data.recv_status_on_client.trailing_metadata = &rdata->trailing_metadata_recv; + op->data.recv_status_on_client.trailing_metadata = + &rdata->trailing_metadata_recv; op->data.recv_status_on_client.status = &rdata->status; op->data.recv_status_on_client.status_details = &rdata->details; - op->data.recv_status_on_client.status_details_capacity = &rdata->details_capacity; + op->data.recv_status_on_client.status_details_capacity = + &rdata->details_capacity; op->flags = 0; op->reserved = NULL; op++; @@ -354,7 +356,8 @@ int *perform_request(servers_fixture *f, grpc_channel *client, GPR_ASSERT(rdata->status == GRPC_STATUS_UNIMPLEMENTED); GPR_ASSERT(0 == strcmp(rdata->details, "xyz")); GPR_ASSERT(0 == strcmp(rdata->call_details[s_idx].method, "/foo")); - GPR_ASSERT(0 == strcmp(rdata->call_details[s_idx].host, "foo.test.google.fr")); + GPR_ASSERT(0 == + strcmp(rdata->call_details[s_idx].host, "foo.test.google.fr")); GPR_ASSERT(was_cancelled == 1); } else { } diff --git a/test/core/network_benchmarks/low_level_ping_pong.c b/test/core/network_benchmarks/low_level_ping_pong.c index 7a2d894481..dd1544c27b 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 ad17b059f1..b2b7cfdb6e 100644 --- a/test/core/security/credentials_test.c +++ b/test/core/security/credentials_test.c @@ -382,8 +382,7 @@ static void test_access_token_creds(void) { NULL}; GPR_ASSERT(strcmp(creds->type, GRPC_CALL_CREDENTIALS_TYPE_OAUTH2) == 0); grpc_call_credentials_get_request_metadata( - &exec_ctx, creds, NULL, auth_md_ctx, check_access_token_metadata, - creds); + &exec_ctx, creds, NULL, auth_md_ctx, check_access_token_metadata, creds); grpc_exec_ctx_finish(&exec_ctx); } @@ -443,7 +442,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( @@ -488,7 +488,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); @@ -981,8 +982,8 @@ static void test_metadata_plugin_success(void) { creds = grpc_metadata_credentials_create_from_plugin(plugin, NULL); GPR_ASSERT(state == PLUGIN_INITIAL_STATE); grpc_call_credentials_get_request_metadata( - &exec_ctx, creds, NULL, auth_md_ctx, - on_plugin_metadata_received_success, NULL); + &exec_ctx, creds, NULL, auth_md_ctx, on_plugin_metadata_received_success, + NULL); GPR_ASSERT(state == PLUGIN_GET_METADATA_CALLED_STATE); grpc_call_credentials_release(creds); GPR_ASSERT(state == PLUGIN_DESTROY_CALLED_STATE); @@ -1004,8 +1005,8 @@ static void test_metadata_plugin_failure(void) { creds = grpc_metadata_credentials_create_from_plugin(plugin, NULL); GPR_ASSERT(state == PLUGIN_INITIAL_STATE); grpc_call_credentials_get_request_metadata( - &exec_ctx, creds, NULL, auth_md_ctx, - on_plugin_metadata_received_failure, NULL); + &exec_ctx, creds, NULL, auth_md_ctx, on_plugin_metadata_received_failure, + NULL); GPR_ASSERT(state == PLUGIN_GET_METADATA_CALLED_STATE); grpc_call_credentials_release(creds); GPR_ASSERT(state == PLUGIN_DESTROY_CALLED_STATE); diff --git a/test/core/security/oauth2_utils.c b/test/core/security/oauth2_utils.c index a283a881e0..fb62bf4134 100644 --- a/test/core/security/oauth2_utils.c +++ b/test/core/security/oauth2_utils.c @@ -88,7 +88,8 @@ char *grpc_test_fetch_oauth2_token_with_credentials( grpc_closure_init(&do_nothing_closure, do_nothing, NULL); grpc_call_credentials_get_request_metadata(&exec_ctx, creds, &request.pollset, - null_ctx, on_oauth2_response, &request); + null_ctx, on_oauth2_response, + &request); grpc_exec_ctx_finish(&exec_ctx); diff --git a/test/core/surface/byte_buffer_reader_test.c b/test/core/surface/byte_buffer_reader_test.c index 7f9cd6b62b..6b41698717 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 f4400692fe..b24a90adac 100644 --- a/test/cpp/qps/client.h +++ b/test/cpp/qps/client.h @@ -181,29 +181,29 @@ class Client { std::unique_ptr<RandomDist> 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 |