Skip to content

Commit

Permalink
Merge pull request grpc#3556 from ctiller/clangf
Browse files Browse the repository at this point in the history
Fix clang-format script
  • Loading branch information
vjpai committed Oct 2, 2015
2 parents 8f64d5c + b7a5977 commit 7a94236
Show file tree
Hide file tree
Showing 88 changed files with 663 additions and 506 deletions.
13 changes: 3 additions & 10 deletions src/core/channel/client_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -692,16 +692,9 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
}

const grpc_channel_filter grpc_client_channel_filter = {
cc_start_transport_stream_op,
cc_start_transport_op,
sizeof(call_data),
init_call_elem,
destroy_call_elem,
sizeof(channel_data),
init_channel_elem,
destroy_channel_elem,
cc_get_peer,
"client-channel",
cc_start_transport_stream_op, cc_start_transport_op, sizeof(call_data),
init_call_elem, destroy_call_elem, sizeof(channel_data), init_channel_elem,
destroy_channel_elem, cc_get_peer, "client-channel",
};

void grpc_client_channel_set_resolver(grpc_exec_ctx *exec_ctx,
Expand Down
13 changes: 3 additions & 10 deletions src/core/channel/compress_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,13 +387,6 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
}

const grpc_channel_filter grpc_compress_filter = {
compress_start_transport_stream_op,
grpc_channel_next_op,
sizeof(call_data),
init_call_elem,
destroy_call_elem,
sizeof(channel_data),
init_channel_elem,
destroy_channel_elem,
grpc_call_next_get_peer,
"compress"};
compress_start_transport_stream_op, grpc_channel_next_op, sizeof(call_data),
init_call_elem, destroy_call_elem, sizeof(channel_data), init_channel_elem,
destroy_channel_elem, grpc_call_next_get_peer, "compress"};
13 changes: 3 additions & 10 deletions src/core/channel/connected_channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,9 @@ static char *con_get_peer(grpc_exec_ctx *exec_ctx, grpc_call_element *elem) {
}

const grpc_channel_filter grpc_connected_channel_filter = {
con_start_transport_stream_op,
con_start_transport_op,
sizeof(call_data),
init_call_elem,
destroy_call_elem,
sizeof(channel_data),
init_channel_elem,
destroy_channel_elem,
con_get_peer,
"connected",
con_start_transport_stream_op, con_start_transport_op, sizeof(call_data),
init_call_elem, destroy_call_elem, sizeof(channel_data), init_channel_elem,
destroy_channel_elem, con_get_peer, "connected",
};

void grpc_connected_channel_bind_transport(grpc_channel_stack *channel_stack,
Expand Down
14 changes: 4 additions & 10 deletions src/core/channel/noop_filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,7 @@ static void destroy_channel_elem(grpc_exec_ctx *exec_ctx,
ignore_unused(channeld);
}

const grpc_channel_filter grpc_no_op_filter = {noop_start_transport_stream_op,
grpc_channel_next_op,
sizeof(call_data),
init_call_elem,
destroy_call_elem,
sizeof(channel_data),
init_channel_elem,
destroy_channel_elem,
grpc_call_next_get_peer,
"no-op"};
const grpc_channel_filter grpc_no_op_filter = {
noop_start_transport_stream_op, grpc_channel_next_op, sizeof(call_data),
init_call_elem, destroy_call_elem, sizeof(channel_data), init_channel_elem,
destroy_channel_elem, grpc_call_next_get_peer, "no-op"};
9 changes: 2 additions & 7 deletions src/core/client_config/lb_policies/pick_first.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,8 @@ void pf_notify_on_state_change(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
}

static const grpc_lb_policy_vtable pick_first_lb_policy_vtable = {
pf_destroy,
pf_shutdown,
pf_pick,
pf_exit_idle,
pf_broadcast,
pf_check_connectivity,
pf_notify_on_state_change};
pf_destroy, pf_shutdown, pf_pick, pf_exit_idle, pf_broadcast,
pf_check_connectivity, pf_notify_on_state_change};

static void pick_first_factory_ref(grpc_lb_policy_factory *factory) {}

Expand Down
9 changes: 2 additions & 7 deletions src/core/client_config/lb_policies/round_robin.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,13 +487,8 @@ static void rr_notify_on_state_change(grpc_exec_ctx *exec_ctx,
}

static const grpc_lb_policy_vtable round_robin_lb_policy_vtable = {
rr_destroy,
rr_shutdown,
rr_pick,
rr_exit_idle,
rr_broadcast,
rr_check_connectivity,
rr_notify_on_state_change};
rr_destroy, rr_shutdown, rr_pick, rr_exit_idle, rr_broadcast,
rr_check_connectivity, rr_notify_on_state_change};

static void round_robin_factory_ref(grpc_lb_policy_factory *factory) {}

Expand Down
20 changes: 10 additions & 10 deletions src/core/client_config/subchannel.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ static gpr_timespec compute_connect_deadline(grpc_subchannel *c);
static void subchannel_connected(grpc_exec_ctx *exec_ctx, void *subchannel,
int iomgr_success);

static void subchannel_ref_locked(
grpc_subchannel *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
static void subchannel_ref_locked(grpc_subchannel *c
GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
static int subchannel_unref_locked(
grpc_subchannel *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) GRPC_MUST_USE_RESULT;
static void connection_ref_locked(connection *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
Expand Down Expand Up @@ -203,8 +203,8 @@ static void connection_destroy(grpc_exec_ctx *exec_ctx, connection *c) {
gpr_free(c);
}

static void connection_ref_locked(
connection *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
static void connection_ref_locked(connection *c
GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
REF_LOG("CONNECTION", c);
subchannel_ref_locked(c->subchannel REF_PASS_ARGS);
++c->refs;
Expand All @@ -227,14 +227,14 @@ static grpc_subchannel *connection_unref_locked(
* grpc_subchannel implementation
*/

static void subchannel_ref_locked(
grpc_subchannel *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
static void subchannel_ref_locked(grpc_subchannel *c
GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
REF_LOG("SUBCHANNEL", c);
++c->refs;
}

static int subchannel_unref_locked(
grpc_subchannel *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
static int subchannel_unref_locked(grpc_subchannel *c
GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
UNREF_LOG("SUBCHANNEL", c);
return --c->refs == 0;
}
Expand Down Expand Up @@ -709,8 +709,8 @@ static void connectivity_state_changed_locked(grpc_exec_ctx *exec_ctx,
* grpc_subchannel_call implementation
*/

void grpc_subchannel_call_ref(
grpc_subchannel_call *c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
void grpc_subchannel_call_ref(grpc_subchannel_call *c
GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
gpr_ref(&c->refs);
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/iomgr/exec_ctx.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct grpc_exec_ctx {
{ GRPC_CLOSURE_LIST_INIT }

/** Flush any work that has been enqueued onto this grpc_exec_ctx.
* Caller must guarantee that no interfering locks are held.
* Caller must guarantee that no interfering locks are held.
* Returns 1 if work was performed, 0 otherwise. */
int grpc_exec_ctx_flush(grpc_exec_ctx *exec_ctx);
/** Finish any pending work for a grpc_exec_ctx. Must be called before
Expand Down
13 changes: 7 additions & 6 deletions src/core/iomgr/iocp_windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ static DWORD deadline_to_millis_timeout(gpr_timespec deadline,
return INFINITE;
}
if (gpr_time_cmp(deadline, gpr_time_add(now, gpr_time_from_micros(
max_spin_polling_us,
GPR_TIMESPAN))) <= 0) {
max_spin_polling_us,
GPR_TIMESPAN))) <= 0) {
return 0;
}
timeout = gpr_time_sub(deadline, now);
return gpr_time_to_millis(gpr_time_add(
timeout, gpr_time_from_nanos(GPR_NS_PER_MS - 1, GPR_TIMESPAN)));
timeout, gpr_time_from_nanos(GPR_NS_PER_MS - 1, GPR_TIMESPAN)));
}

void grpc_iocp_work(grpc_exec_ctx *exec_ctx, gpr_timespec deadline) {
Expand All @@ -80,8 +80,9 @@ void grpc_iocp_work(grpc_exec_ctx *exec_ctx, gpr_timespec deadline) {
grpc_winsocket *socket;
grpc_winsocket_callback_info *info;
grpc_closure *closure = NULL;
success = GetQueuedCompletionStatus(g_iocp, &bytes, &completion_key,
&overlapped, deadline_to_millis_timeout(deadline, gpr_now(deadline.clock_type)));
success = GetQueuedCompletionStatus(
g_iocp, &bytes, &completion_key, &overlapped,
deadline_to_millis_timeout(deadline, gpr_now(deadline.clock_type)));
if (success == 0 && overlapped == NULL) {
return;
}
Expand Down Expand Up @@ -139,7 +140,7 @@ void grpc_iocp_kick(void) {

void grpc_iocp_flush(void) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;

do {
grpc_iocp_work(&exec_ctx, gpr_inf_past(GPR_CLOCK_MONOTONIC));
} while (grpc_exec_ctx_flush(&exec_ctx));
Expand Down
7 changes: 2 additions & 5 deletions src/core/iomgr/iomgr_posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,8 @@ void grpc_iomgr_platform_init(void) {
grpc_register_tracer("tcp", &grpc_tcp_trace);
}

void grpc_iomgr_platform_flush(void) {
}
void grpc_iomgr_platform_flush(void) {}

void grpc_iomgr_platform_shutdown(void) {
grpc_fd_global_shutdown();
}
void grpc_iomgr_platform_shutdown(void) { grpc_fd_global_shutdown(); }

#endif /* GRPC_POSIX_SOCKET */
4 changes: 1 addition & 3 deletions src/core/iomgr/iomgr_windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ void grpc_iomgr_platform_init(void) {
grpc_iocp_init();
}

void grpc_iomgr_platform_flush(void) {
grpc_iocp_flush();
}
void grpc_iomgr_platform_flush(void) { grpc_iocp_flush(); }

void grpc_iomgr_platform_shutdown(void) {
grpc_iocp_shutdown();
Expand Down
8 changes: 5 additions & 3 deletions src/core/iomgr/pollset_multipoller_with_epoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ static void multipoll_with_epoll_pollset_maybe_work_and_unlock(
}
if (pfds[1].revents) {
do {
/* The following epoll_wait never blocks; it has a timeout of 0 */
/* The following epoll_wait never blocks; it has a timeout of 0 */
ep_rv = epoll_wait(h->epoll_fd, ep_ev, GRPC_EPOLL_MAX_EVENTS, 0);
if (ep_rv < 0) {
if (errno != EINTR) {
Expand Down Expand Up @@ -264,9 +264,11 @@ static void epoll_become_multipoller(grpc_exec_ctx *exec_ctx,

ev.events = (uint32_t)(EPOLLIN | EPOLLET);
ev.data.ptr = NULL;
err = epoll_ctl(h->epoll_fd, EPOLL_CTL_ADD, GRPC_WAKEUP_FD_GET_READ_FD(&grpc_global_wakeup_fd), &ev);
err = epoll_ctl(h->epoll_fd, EPOLL_CTL_ADD,
GRPC_WAKEUP_FD_GET_READ_FD(&grpc_global_wakeup_fd), &ev);
if (err < 0) {
gpr_log(GPR_ERROR, "epoll_ctl add for %d failed: %s", GRPC_WAKEUP_FD_GET_READ_FD(&grpc_global_wakeup_fd),
gpr_log(GPR_ERROR, "epoll_ctl add for %d failed: %s",
GRPC_WAKEUP_FD_GET_READ_FD(&grpc_global_wakeup_fd),
strerror(errno));
}

Expand Down
4 changes: 1 addition & 3 deletions src/core/iomgr/pollset_posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,7 @@ void grpc_pollset_global_shutdown(void) {
gpr_tls_destroy(&g_current_thread_worker);
}

void grpc_kick_poller(void) {
grpc_wakeup_fd_wakeup(&grpc_global_wakeup_fd);
}
void grpc_kick_poller(void) { grpc_wakeup_fd_wakeup(&grpc_global_wakeup_fd); }

/* main interface */

Expand Down
Loading

0 comments on commit 7a94236

Please sign in to comment.