aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-11-19 07:56:13 -0800
committerGravatar Craig Tiller <ctiller@google.com>2015-11-19 07:56:13 -0800
commitb774be46d76192ec0b2f073fa68b5b7f3b88a7be (patch)
tree8b638031bfffe046fa8bcfac2ba3916d8643e1de /src
parent86958126c22d8b4ee420b6d03995a5db96ebd7e2 (diff)
clang-format
Diffstat (limited to 'src')
-rw-r--r--src/core/client_config/subchannel.h6
-rw-r--r--src/core/iomgr/pollset_windows.c3
-rw-r--r--src/core/security/credentials.c48
-rw-r--r--src/core/security/credentials.h3
-rw-r--r--src/core/security/google_default_credentials.c3
-rw-r--r--src/core/security/security_connector.c6
-rw-r--r--src/core/support/slice.c5
-rw-r--r--src/core/surface/byte_buffer_reader.c1
-rw-r--r--src/core/transport/chttp2_transport.c5
-rw-r--r--src/core/transport/metadata.c44
-rw-r--r--src/core/transport/static_metadata.c89
-rw-r--r--src/cpp/client/insecure_credentials.cc4
-rw-r--r--src/cpp/client/secure_credentials.h1
13 files changed, 97 insertions, 121 deletions
diff --git a/src/core/client_config/subchannel.h b/src/core/client_config/subchannel.h
index 1fefa1888a..381b7689b8 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 c3f310ee27..deb661548d 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 3db531cd35..f7a2e73785 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 559574d514..132060910e 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 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/support/slice.c b/src/core/support/slice.c
index 0470533c1c..5b091f17b0 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 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/transport/chttp2_transport.c b/src/core/transport/chttp2_transport.c
index f62294c7c5..1545cf24ca 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 da52961fc9..0ea3dd20ee 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 f0b0f86310..c4dc0c7b88 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 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 b241761a7c..e9afa9e57f 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);