aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Yang Gao <yangg@google.com>2015-05-04 00:22:12 -0700
committerGravatar Yang Gao <yangg@google.com>2015-05-04 00:22:12 -0700
commitc71a9d2b56c8881bd076423d9c52f58fc822f6f7 (patch)
tree0e257b1f686cc9e89d25172ed6d9442bff167e4d
parentf7d05b572b229a78a08022e286f15fbb6b7266fd (diff)
clang-format
-rw-r--r--src/core/profiling/basic_timers.c5
-rw-r--r--src/core/profiling/stap_timers.c6
-rw-r--r--src/core/profiling/timers.h27
-rw-r--r--src/core/support/cpu_windows.c4
-rw-r--r--src/core/surface/call.c25
-rw-r--r--src/cpp/common/call.cc7
-rw-r--r--src/cpp/server/server.cc9
-rw-r--r--src/python/src/grpc/_adapter/_tag.h14
-rw-r--r--test/build/systemtap.c4
-rw-r--r--test/cpp/end2end/end2end_test.cc13
10 files changed, 58 insertions, 56 deletions
diff --git a/src/core/profiling/basic_timers.c b/src/core/profiling/basic_timers.c
index d89bba7b87..ab598b5a00 100644
--- a/src/core/profiling/basic_timers.c
+++ b/src/core/profiling/basic_timers.c
@@ -135,8 +135,8 @@ void grpc_timer_add_mark(int tag, void* id, const char* file, int line) {
grpc_timers_log_add(grpc_timers_log_global, tag, id, file, line);
}
-void grpc_timer_begin(int tag, void* id, const char *file, int line) {}
-void grpc_timer_end(int tag, void* id, const char *file, int line) {}
+void grpc_timer_begin(int tag, void* id, const char* file, int line) {}
+void grpc_timer_end(int tag, void* id, const char* file, int line) {}
/* Basic profiler specific API functions. */
void grpc_timers_global_init(void) {
@@ -147,7 +147,6 @@ void grpc_timers_global_destroy(void) {
grpc_timers_log_destroy(grpc_timers_log_global);
}
-
#else /* !GRPC_BASIC_PROFILER */
void grpc_timers_global_init(void) {}
void grpc_timers_global_destroy(void) {}
diff --git a/src/core/profiling/stap_timers.c b/src/core/profiling/stap_timers.c
index 52fb58a279..6e3a965dae 100644
--- a/src/core/profiling/stap_timers.c
+++ b/src/core/profiling/stap_timers.c
@@ -42,15 +42,15 @@
#include "src/core/profiling/stap_probes.h"
/* Latency profiler API implementation. */
-void grpc_timer_add_mark(int tag, void* id, const char *file, int line) {
+void grpc_timer_add_mark(int tag, void* id, const char* file, int line) {
_STAP_ADD_MARK(tag);
}
-void grpc_timer_begin(int tag, void* id, const char *file, int line) {
+void grpc_timer_begin(int tag, void* id, const char* file, int line) {
_STAP_TIMING_NS_BEGIN(tag);
}
-void grpc_timer_end(int tag, void* id, const char *file, int line) {
+void grpc_timer_end(int tag, void* id, const char* file, int line) {
_STAP_TIMING_NS_END(tag);
}
diff --git a/src/core/profiling/timers.h b/src/core/profiling/timers.h
index d0b8286c03..c7e6674f7c 100644
--- a/src/core/profiling/timers.h
+++ b/src/core/profiling/timers.h
@@ -41,9 +41,9 @@ extern "C" {
void grpc_timers_global_init(void);
void grpc_timers_global_destroy(void);
-void grpc_timer_add_mark(int tag, void* id, const char *file, int line);
-void grpc_timer_begin(int tag, void* id, const char *file, int line);
-void grpc_timer_end(int tag, void* id, const char *file, int line);
+void grpc_timer_add_mark(int tag, void *id, const char *file, int line);
+void grpc_timer_begin(int tag, void *id, const char *file, int line);
+void grpc_timer_end(int tag, void *id, const char *file, int line);
enum grpc_profiling_tags {
/* Any GRPC_PTAG_* >= than the threshold won't generate any profiling mark. */
@@ -74,13 +74,16 @@ enum grpc_profiling_tags {
#if !(defined(GRPC_STAP_PROFILER) + defined(GRPC_BASIC_PROFILER))
/* No profiling. No-op all the things. */
#define GRPC_TIMER_MARK(tag, id) \
- do {} while(0)
+ do { \
+ } while (0)
#define GRPC_TIMER_BEGIN(tag, id) \
- do {} while(0)
+ do { \
+ } while (0)
#define GRPC_TIMER_END(tag, id) \
- do {} while(0)
+ do { \
+ } while (0)
#else /* at least one profiler requested... */
/* ... hopefully only one. */
@@ -94,14 +97,14 @@ enum grpc_profiling_tags {
grpc_timer_add_mark(tag, ((void *)(gpr_intptr)(id)), __FILE__, __LINE__); \
}
-#define GRPC_TIMER_BEGIN(tag, id) \
- if (tag < GRPC_PTAG_IGNORE_THRESHOLD) { \
- grpc_timer_begin(tag, ((void *)(gpr_intptr)(id)), __FILE__, __LINE__); \
+#define GRPC_TIMER_BEGIN(tag, id) \
+ if (tag < GRPC_PTAG_IGNORE_THRESHOLD) { \
+ grpc_timer_begin(tag, ((void *)(gpr_intptr)(id)), __FILE__, __LINE__); \
}
-#define GRPC_TIMER_END(tag, id) \
- if (tag < GRPC_PTAG_IGNORE_THRESHOLD) { \
- grpc_timer_end(tag, ((void *)(gpr_intptr)(id)), __FILE__, __LINE__); \
+#define GRPC_TIMER_END(tag, id) \
+ if (tag < GRPC_PTAG_IGNORE_THRESHOLD) { \
+ grpc_timer_end(tag, ((void *)(gpr_intptr)(id)), __FILE__, __LINE__); \
}
#ifdef GRPC_STAP_PROFILER
diff --git a/src/core/support/cpu_windows.c b/src/core/support/cpu_windows.c
index f56bab3f8b..107a7b85f0 100644
--- a/src/core/support/cpu_windows.c
+++ b/src/core/support/cpu_windows.c
@@ -43,8 +43,6 @@ unsigned gpr_cpu_num_cores(void) {
return si.dwNumberOfProcessors;
}
-unsigned gpr_cpu_current_cpu(void) {
- return GetCurrentProcessorNumber();
-}
+unsigned gpr_cpu_current_cpu(void) { return GetCurrentProcessorNumber(); }
#endif /* GPR_WIN32 */
diff --git a/src/core/surface/call.c b/src/core/surface/call.c
index a09efe898e..eca102d970 100644
--- a/src/core/surface/call.c
+++ b/src/core/surface/call.c
@@ -246,10 +246,9 @@ static int fill_send_ops(grpc_call *call, grpc_transport_op *op);
static void execute_op(grpc_call *call, grpc_transport_op *op);
static void recv_metadata(grpc_call *call, grpc_metadata_batch *metadata);
static void finish_read_ops(grpc_call *call);
-static grpc_call_error grpc_call_cancel_with_status_internal(grpc_call *c,
- grpc_status_code status,
- const char *description,
- gpr_uint8 locked);
+static grpc_call_error grpc_call_cancel_with_status_internal(
+ grpc_call *c, grpc_status_code status, const char *description,
+ gpr_uint8 locked);
grpc_call *grpc_call_create(grpc_channel *channel, grpc_completion_queue *cq,
const void *server_transport_data,
@@ -631,7 +630,8 @@ static int begin_message(grpc_call *call, grpc_begin_message msg) {
gpr_asprintf(
&message, "Message terminated early; read %d bytes, expected %d",
(int)call->incoming_message.length, (int)call->incoming_message_length);
- grpc_call_cancel_with_status_internal(call, GRPC_STATUS_INVALID_ARGUMENT, message, 1);
+ grpc_call_cancel_with_status_internal(call, GRPC_STATUS_INVALID_ARGUMENT,
+ message, 1);
gpr_free(message);
return 0;
}
@@ -642,7 +642,8 @@ static int begin_message(grpc_call *call, grpc_begin_message msg) {
&message,
"Maximum message length of %d exceeded by a message of length %d",
grpc_channel_get_max_message_length(call->channel), msg.length);
- grpc_call_cancel_with_status_internal(call, GRPC_STATUS_INVALID_ARGUMENT, message, 1);
+ grpc_call_cancel_with_status_internal(call, GRPC_STATUS_INVALID_ARGUMENT,
+ message, 1);
gpr_free(message);
return 0;
} else if (msg.length > 0) {
@@ -675,7 +676,8 @@ static int add_slice_to_message(grpc_call *call, gpr_slice slice) {
gpr_asprintf(
&message, "Receiving message overflow; read %d bytes, expected %d",
(int)call->incoming_message.length, (int)call->incoming_message_length);
- grpc_call_cancel_with_status_internal(call, GRPC_STATUS_INVALID_ARGUMENT, message, 1);
+ grpc_call_cancel_with_status_internal(call, GRPC_STATUS_INVALID_ARGUMENT,
+ message, 1);
gpr_free(message);
return 0;
} else if (call->incoming_message.length == call->incoming_message_length) {
@@ -1003,10 +1005,9 @@ grpc_call_error grpc_call_cancel_with_status(grpc_call *c,
return grpc_call_cancel_with_status_internal(c, status, description, 0);
}
-static grpc_call_error grpc_call_cancel_with_status_internal(grpc_call *c,
- grpc_status_code status,
- const char *description,
- gpr_uint8 locked) {
+static grpc_call_error grpc_call_cancel_with_status_internal(
+ grpc_call *c, grpc_status_code status, const char *description,
+ gpr_uint8 locked) {
grpc_transport_op op;
grpc_mdstr *details =
description ? grpc_mdstr_from_string(c->metadata_context, description)
@@ -1043,7 +1044,7 @@ static void call_alarm(void *arg, int success) {
if (success) {
if (call->is_client) {
grpc_call_cancel_with_status_internal(call, GRPC_STATUS_DEADLINE_EXCEEDED,
- "Deadline Exceeded", 0);
+ "Deadline Exceeded", 0);
} else {
grpc_call_cancel(call);
}
diff --git a/src/cpp/common/call.cc b/src/cpp/common/call.cc
index 3374bef095..1068111e3f 100644
--- a/src/cpp/common/call.cc
+++ b/src/cpp/common/call.cc
@@ -312,7 +312,8 @@ bool CallOpBuffer::FinalizeResult(void** tag, bool* status) {
got_message = *status;
if (recv_message_) {
GRPC_TIMER_BEGIN(GRPC_PTAG_PROTO_DESERIALIZE, 0);
- *status = *status && DeserializeProto(recv_buf_, recv_message_, max_message_size_);
+ *status = *status &&
+ DeserializeProto(recv_buf_, recv_message_, max_message_size_);
grpc_byte_buffer_destroy(recv_buf_);
GRPC_TIMER_END(GRPC_PTAG_PROTO_DESERIALIZE, 0);
} else {
@@ -343,7 +344,9 @@ Call::Call(grpc_call* call, CallHook* call_hook, CompletionQueue* cq)
Call::Call(grpc_call* call, CallHook* call_hook, CompletionQueue* cq,
int max_message_size)
- : call_hook_(call_hook), cq_(cq), call_(call),
+ : call_hook_(call_hook),
+ cq_(cq),
+ call_(call),
max_message_size_(max_message_size) {}
void Call::PerformOps(CallOpBuffer* buffer) {
diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc
index 9338451630..08c956601c 100644
--- a/src/cpp/server/server.cc
+++ b/src/cpp/server/server.cc
@@ -126,7 +126,8 @@ class Server::SyncRequest GRPC_FINAL : public CompletionQueueTag {
if (has_request_payload_) {
GRPC_TIMER_BEGIN(GRPC_PTAG_PROTO_DESERIALIZE, call_.call());
req.reset(method_->AllocateRequestProto());
- if (!DeserializeProto(request_payload_, req.get(), call_.max_message_size())) {
+ if (!DeserializeProto(request_payload_, req.get(),
+ call_.max_message_size())) {
// FIXME(yangg) deal with deserialization failure
cq_.Shutdown();
return;
@@ -237,7 +238,7 @@ bool Server::RegisterAsyncService(AsynchronousService* service) {
GPR_ASSERT(service->dispatch_impl_ == nullptr &&
"Can only register an asynchronous service against one server.");
service->dispatch_impl_ = this;
- service->request_args_ = new void* [service->method_count_];
+ service->request_args_ = new void*[service->method_count_];
for (size_t i = 0; i < service->method_count_; ++i) {
void* tag =
grpc_server_register_method(server_, service->method_names_[i], nullptr,
@@ -364,8 +365,8 @@ class Server::AsyncRequest GRPC_FINAL : public CompletionQueueTag {
if (*status && request_) {
if (payload_) {
GRPC_TIMER_BEGIN(GRPC_PTAG_PROTO_DESERIALIZE, call_);
- *status = DeserializeProto(payload_, request_,
- server_->max_message_size_);
+ *status =
+ DeserializeProto(payload_, request_, server_->max_message_size_);
GRPC_TIMER_END(GRPC_PTAG_PROTO_DESERIALIZE, call_);
} else {
*status = false;
diff --git a/src/python/src/grpc/_adapter/_tag.h b/src/python/src/grpc/_adapter/_tag.h
index b18c44576d..64812aa7e7 100644
--- a/src/python/src/grpc/_adapter/_tag.h
+++ b/src/python/src/grpc/_adapter/_tag.h
@@ -44,14 +44,14 @@
replacement for its descriptive functionality until Python can move its whole
C and C adapter stack to more closely resemble the core batching API. */
typedef enum {
- PYGRPC_SERVER_RPC_NEW = 0,
- PYGRPC_INITIAL_METADATA = 1,
- PYGRPC_READ = 2,
- PYGRPC_WRITE_ACCEPTED = 3,
- PYGRPC_FINISH_ACCEPTED = 4,
+ PYGRPC_SERVER_RPC_NEW = 0,
+ PYGRPC_INITIAL_METADATA = 1,
+ PYGRPC_READ = 2,
+ PYGRPC_WRITE_ACCEPTED = 3,
+ PYGRPC_FINISH_ACCEPTED = 4,
PYGRPC_CLIENT_METADATA_READ = 5,
- PYGRPC_FINISHED_CLIENT = 6,
- PYGRPC_FINISHED_SERVER = 7
+ PYGRPC_FINISHED_CLIENT = 6,
+ PYGRPC_FINISHED_SERVER = 7
} pygrpc_tag_type;
typedef struct {
diff --git a/test/build/systemtap.c b/test/build/systemtap.c
index 66ff38ebd6..1997d5f17b 100644
--- a/test/build/systemtap.c
+++ b/test/build/systemtap.c
@@ -37,6 +37,4 @@
#error "_SYS_SDT_H not defined, despite <sys/sdt.h> being present."
#endif
-int main() {
- return 0;
-}
+int main() { return 0; }
diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc
index cbbd37096a..0945ed269d 100644
--- a/test/cpp/end2end/end2end_test.cc
+++ b/test/cpp/end2end/end2end_test.cc
@@ -182,7 +182,8 @@ class End2endTest : public ::testing::Test {
builder.AddListeningPort(server_address_.str(),
InsecureServerCredentials());
builder.RegisterService(&service_);
- builder.SetMaxMessageSize(kMaxMessageSize_); // For testing max message size.
+ builder.SetMaxMessageSize(
+ kMaxMessageSize_); // For testing max message size.
builder.RegisterService(&dup_pkg_service_);
builder.SetThreadPool(&thread_pool_);
server_ = builder.BuildAndStart();
@@ -428,8 +429,7 @@ TEST_F(End2endTest, DiffPackageServices) {
// rpc and stream should fail on bad credentials.
TEST_F(End2endTest, BadCredentials) {
- std::unique_ptr<Credentials> bad_creds =
- ServiceAccountCredentials("", "", 1);
+ std::unique_ptr<Credentials> bad_creds = ServiceAccountCredentials("", "", 1);
EXPECT_EQ(nullptr, bad_creds.get());
std::shared_ptr<ChannelInterface> channel =
CreateChannel(server_address_.str(), bad_creds, ChannelArguments());
@@ -503,14 +503,13 @@ TEST_F(End2endTest, ClientCancelsRequestStream) {
auto stream = stub_->RequestStream(&context, &response);
EXPECT_TRUE(stream->Write(request));
EXPECT_TRUE(stream->Write(request));
-
+
context.TryCancel();
Status s = stream->Finish();
EXPECT_EQ(grpc::StatusCode::CANCELLED, s.code());
-
- EXPECT_EQ(response.message(), "");
+ EXPECT_EQ(response.message(), "");
}
// Client cancels server stream after sending some messages
@@ -594,7 +593,7 @@ TEST_F(End2endTest, RpcMaxMessageSize) {
ResetStub();
EchoRequest request;
EchoResponse response;
- request.set_message(string(kMaxMessageSize_*2, 'a'));
+ request.set_message(string(kMaxMessageSize_ * 2, 'a'));
ClientContext context;
Status s = stub_->Echo(&context, request, &response);