Use clang-format-3.5

pull/104/head
Craig Tiller 10 years ago
parent cf1d6eb4ae
commit ecd49345b5
  1. 12
      .clang-format
  2. 3
      src/core/channel/channel_stack.c
  3. 5
      src/core/security/auth.c
  4. 8
      src/core/security/security_context.c
  5. 3
      src/core/statistics/census_rpc_stats.c
  6. 3
      src/core/statistics/census_tracing.c
  7. 8
      src/core/transport/chttp2_transport.c
  8. 13
      src/core/tsi/fake_transport_security.c
  9. 21
      src/core/tsi/ssl_transport_security.c
  10. 3
      src/core/tsi/ssl_transport_security.h
  11. 4
      src/cpp/server/completion_queue.cc
  12. 4
      src/cpp/stream/stream_context.h
  13. 15
      src/php/ext/grpc/call.c
  14. 12
      src/php/ext/grpc/completion_queue.c
  15. 7
      src/php/ext/grpc/credentials.c
  16. 3
      src/php/ext/grpc/php_grpc.c
  17. 14
      src/php/ext/grpc/timeval.c
  18. 1
      test/core/end2end/cq_verifier.c
  19. 18
      test/core/statistics/hash_table_test.c
  20. 4
      test/core/surface/completion_queue_benchmark.c
  21. 4
      test/core/surface/completion_queue_test.c
  22. 5
      tools/clang-format/clang-format-all.sh
  23. 1
      tools/clang-format/config.sh

@ -2,27 +2,22 @@
Language: Cpp Language: Cpp
# BasedOnStyle: Google # BasedOnStyle: Google
AccessModifierOffset: -1 AccessModifierOffset: -1
AlignAfterOpenBracket: true ConstructorInitializerIndentWidth: 4
AlignEscapedNewlinesLeft: true AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: true AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: true AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true AllowShortLoopsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All AllowShortFunctionsOnASingleLine: All
AlwaysBreakAfterDefinitionReturnType: false
AlwaysBreakTemplateDeclarations: true AlwaysBreakTemplateDeclarations: true
AlwaysBreakBeforeMultilineStrings: true AlwaysBreakBeforeMultilineStrings: true
BreakBeforeBinaryOperators: None BreakBeforeBinaryOperators: false
BreakBeforeTernaryOperators: true BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false BreakConstructorInitializersBeforeComma: false
BinPackParameters: true BinPackParameters: true
BinPackArguments: true
ColumnLimit: 80 ColumnLimit: 80
ConstructorInitializerAllOnOneLineOrOnePerLine: true ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
DerivePointerAlignment: true DerivePointerAlignment: true
ExperimentalAutoDetectBinPacking: false ExperimentalAutoDetectBinPacking: false
IndentCaseLabels: true IndentCaseLabels: true
@ -31,7 +26,6 @@ IndentFunctionDeclarationAfterType: false
MaxEmptyLinesToKeep: 1 MaxEmptyLinesToKeep: 1
KeepEmptyLinesAtTheStartOfBlocks: false KeepEmptyLinesAtTheStartOfBlocks: false
NamespaceIndentation: None NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false ObjCSpaceBeforeProtocolList: false
PenaltyBreakBeforeFirstCallParameter: 1 PenaltyBreakBeforeFirstCallParameter: 1
@ -49,11 +43,9 @@ TabWidth: 8
UseTab: Never UseTab: Never
BreakBeforeBraces: Attach BreakBeforeBraces: Attach
SpacesInParentheses: false SpacesInParentheses: false
SpacesInSquareBrackets: false
SpacesInAngles: false SpacesInAngles: false
SpaceInEmptyParentheses: false SpaceInEmptyParentheses: false
SpacesInCStyleCastParentheses: false SpacesInCStyleCastParentheses: false
SpaceAfterCStyleCast: false
SpacesInContainerLiterals: true SpacesInContainerLiterals: true
SpaceBeforeAssignmentOperators: true SpaceBeforeAssignmentOperators: true
ContinuationIndentWidth: 4 ContinuationIndentWidth: 4

@ -190,7 +190,8 @@ void grpc_channel_next_op(grpc_channel_element *elem, grpc_channel_op *op) {
grpc_channel_stack *grpc_channel_stack_from_top_element( grpc_channel_stack *grpc_channel_stack_from_top_element(
grpc_channel_element *elem) { grpc_channel_element *elem) {
return (grpc_channel_stack *)((char *)(elem)-ROUND_UP_TO_ALIGNMENT_SIZE( return (grpc_channel_stack *)((char *)(elem) -
ROUND_UP_TO_ALIGNMENT_SIZE(
sizeof(grpc_channel_stack))); sizeof(grpc_channel_stack)));
} }

@ -157,5 +157,6 @@ static void destroy_channel_elem(grpc_channel_element *elem) {
} }
const grpc_channel_filter grpc_client_auth_filter = { const grpc_channel_filter grpc_client_auth_filter = {
call_op, channel_op, sizeof(call_data), init_call_elem, destroy_call_elem, call_op, channel_op, sizeof(call_data),
sizeof(channel_data), init_channel_elem, destroy_channel_elem, "auth"}; init_call_elem, destroy_call_elem, sizeof(channel_data),
init_channel_elem, destroy_channel_elem, "auth"};

@ -413,10 +413,10 @@ grpc_security_status grpc_ssl_server_security_context_create(
(const unsigned char **)&config->pem_private_key, (const unsigned char **)&config->pem_private_key,
&config->pem_private_key_size, &config->pem_private_key_size,
(const unsigned char **)&config->pem_cert_chain, (const unsigned char **)&config->pem_cert_chain,
&config->pem_cert_chain_size, 1, &config->pem_cert_chain_size, 1, config->pem_root_certs,
config->pem_root_certs, config->pem_root_certs_size, config->pem_root_certs_size, GRPC_SSL_CIPHER_SUITES,
GRPC_SSL_CIPHER_SUITES, alpn_protocol_strings, alpn_protocol_strings, alpn_protocol_string_lengths, num_alpn_protocols,
alpn_protocol_string_lengths, num_alpn_protocols, &c->handshaker_factory); &c->handshaker_factory);
if (result != TSI_OK) { if (result != TSI_OK) {
gpr_log(GPR_ERROR, "Handshaker factory creation failed with %s.", gpr_log(GPR_ERROR, "Handshaker factory creation failed with %s.",
tsi_result_to_string(result)); tsi_result_to_string(result));

@ -86,7 +86,8 @@ static void delete_key(void* key) { gpr_free(key); }
static const census_ht_option ht_opt = { static const census_ht_option ht_opt = {
CENSUS_HT_POINTER /* key type */, 1999 /* n_of_buckets */, CENSUS_HT_POINTER /* key type */, 1999 /* n_of_buckets */,
simple_hash /* hash function */, cmp_str_keys /* key comparator */, simple_hash /* hash function */, cmp_str_keys /* key comparator */,
delete_stats /* data deleter */, delete_key /* key deleter */}; delete_stats /* data deleter */, delete_key /* key deleter */
};
static void init_rpc_stats(void* stats) { static void init_rpc_stats(void* stats) {
memset(stats, 0, sizeof(census_rpc_stats)); memset(stats, 0, sizeof(census_rpc_stats));

@ -76,7 +76,8 @@ static void delete_trace_obj(void* obj) { trace_obj_destroy((trace_obj*)obj); }
static const census_ht_option ht_opt = { static const census_ht_option ht_opt = {
CENSUS_HT_UINT64 /* key type*/, 571 /* n_of_buckets */, NULL /* hash */, CENSUS_HT_UINT64 /* key type*/, 571 /* n_of_buckets */, NULL /* hash */,
NULL /* compare_keys */, delete_trace_obj /* delete data */, NULL /* compare_keys */, delete_trace_obj /* delete data */,
NULL /* delete key */}; NULL /* delete key */
};
static gpr_once g_init_mutex_once = GPR_ONCE_INIT; static gpr_once g_init_mutex_once = GPR_ONCE_INIT;
static gpr_mu g_mu; /* Guards following two static variables. */ static gpr_mu g_mu; /* Guards following two static variables. */

@ -1503,8 +1503,8 @@ static int process_read(transport *t, gpr_slice slice) {
"Connect string mismatch: expected '%c' (%d) got '%c' (%d) " "Connect string mismatch: expected '%c' (%d) got '%c' (%d) "
"at byte %d", "at byte %d",
CLIENT_CONNECT_STRING[t->deframe_state], CLIENT_CONNECT_STRING[t->deframe_state],
(int)(gpr_uint8)CLIENT_CONNECT_STRING[t->deframe_state], *cur, (int)(gpr_uint8) CLIENT_CONNECT_STRING[t->deframe_state],
(int)*cur, t->deframe_state); *cur, (int)*cur, t->deframe_state);
return 0; return 0;
} }
++cur; ++cur;
@ -1738,8 +1738,8 @@ static void add_to_pollset(grpc_transport *gt, grpc_pollset *pollset) {
static const grpc_transport_vtable vtable = { static const grpc_transport_vtable vtable = {
sizeof(stream), init_stream, send_batch, set_allow_window_updates, sizeof(stream), init_stream, send_batch, set_allow_window_updates,
add_to_pollset, destroy_stream, abort_stream, goaway, close_transport, add_to_pollset, destroy_stream, abort_stream, goaway,
send_ping, destroy_transport}; close_transport, send_ping, destroy_transport};
void grpc_create_chttp2_transport(grpc_transport_setup_callback setup, void grpc_create_chttp2_transport(grpc_transport_setup_callback setup,
void *arg, void *arg,

@ -230,9 +230,10 @@ static void tsi_fake_frame_destruct(tsi_fake_frame* frame) {
/* --- tsi_frame_protector methods implementation. ---*/ /* --- tsi_frame_protector methods implementation. ---*/
static tsi_result fake_protector_protect( static tsi_result fake_protector_protect(tsi_frame_protector* self,
tsi_frame_protector* self, const unsigned char* unprotected_bytes, const unsigned char* unprotected_bytes,
size_t* unprotected_bytes_size, unsigned char* protected_output_frames, size_t* unprotected_bytes_size,
unsigned char* protected_output_frames,
size_t* protected_output_frames_size) { size_t* protected_output_frames_size) {
tsi_result result = TSI_OK; tsi_result result = TSI_OK;
tsi_fake_frame_protector* impl = (tsi_fake_frame_protector*)self; tsi_fake_frame_protector* impl = (tsi_fake_frame_protector*)self;
@ -480,8 +481,10 @@ static void fake_handshaker_destroy(tsi_handshaker* self) {
static const tsi_handshaker_vtable handshaker_vtable = { static const tsi_handshaker_vtable handshaker_vtable = {
fake_handshaker_get_bytes_to_send_to_peer, fake_handshaker_get_bytes_to_send_to_peer,
fake_handshaker_process_bytes_from_peer, fake_handshaker_get_result, fake_handshaker_process_bytes_from_peer,
fake_handshaker_extract_peer, fake_handshaker_create_frame_protector, fake_handshaker_get_result,
fake_handshaker_extract_peer,
fake_handshaker_create_frame_protector,
fake_handshaker_destroy, fake_handshaker_destroy,
}; };

@ -573,9 +573,10 @@ static tsi_result build_alpn_protocol_name_list(
/* --- tsi_frame_protector methods implementation. ---*/ /* --- tsi_frame_protector methods implementation. ---*/
static tsi_result ssl_protector_protect( static tsi_result ssl_protector_protect(tsi_frame_protector* self,
tsi_frame_protector* self, const unsigned char* unprotected_bytes, const unsigned char* unprotected_bytes,
size_t* unprotected_bytes_size, unsigned char* protected_output_frames, size_t* unprotected_bytes_size,
unsigned char* protected_output_frames,
size_t* protected_output_frames_size) { size_t* protected_output_frames_size) {
tsi_ssl_frame_protector* impl = (tsi_ssl_frame_protector*)self; tsi_ssl_frame_protector* impl = (tsi_ssl_frame_protector*)self;
int read_from_ssl; int read_from_ssl;
@ -707,8 +708,9 @@ static const tsi_frame_protector_vtable frame_protector_vtable = {
/* --- tsi_handshaker methods implementation. ---*/ /* --- tsi_handshaker methods implementation. ---*/
static tsi_result ssl_handshaker_get_bytes_to_send_to_peer( static tsi_result ssl_handshaker_get_bytes_to_send_to_peer(tsi_handshaker* self,
tsi_handshaker* self, unsigned char* bytes, size_t* bytes_size) { unsigned char* bytes,
size_t* bytes_size) {
tsi_ssl_handshaker* impl = (tsi_ssl_handshaker*)self; tsi_ssl_handshaker* impl = (tsi_ssl_handshaker*)self;
int bytes_read_from_ssl = 0; int bytes_read_from_ssl = 0;
if (bytes == NULL || bytes_size == NULL || *bytes_size == 0 || if (bytes == NULL || bytes_size == NULL || *bytes_size == 0 ||
@ -871,8 +873,10 @@ static void ssl_handshaker_destroy(tsi_handshaker* self) {
static const tsi_handshaker_vtable handshaker_vtable = { static const tsi_handshaker_vtable handshaker_vtable = {
ssl_handshaker_get_bytes_to_send_to_peer, ssl_handshaker_get_bytes_to_send_to_peer,
ssl_handshaker_process_bytes_from_peer, ssl_handshaker_get_result, ssl_handshaker_process_bytes_from_peer,
ssl_handshaker_extract_peer, ssl_handshaker_create_frame_protector, ssl_handshaker_get_result,
ssl_handshaker_extract_peer,
ssl_handshaker_create_frame_protector,
ssl_handshaker_destroy, ssl_handshaker_destroy,
}; };
@ -1157,8 +1161,7 @@ tsi_result tsi_create_ssl_client_handshaker_factory(
tsi_result tsi_create_ssl_server_handshaker_factory( tsi_result tsi_create_ssl_server_handshaker_factory(
const unsigned char** pem_private_keys, const unsigned char** pem_private_keys,
const size_t* pem_private_keys_sizes, const size_t* pem_private_keys_sizes, const unsigned char** pem_cert_chains,
const unsigned char** pem_cert_chains,
const size_t* pem_cert_chains_sizes, size_t key_cert_pair_count, const size_t* pem_cert_chains_sizes, size_t key_cert_pair_count,
const unsigned char* pem_client_root_certs, const unsigned char* pem_client_root_certs,
size_t pem_client_root_certs_size, const char* cipher_list, size_t pem_client_root_certs_size, const char* cipher_list,

@ -132,8 +132,7 @@ tsi_result tsi_create_ssl_client_handshaker_factory(
where a parameter is invalid. */ where a parameter is invalid. */
tsi_result tsi_create_ssl_server_handshaker_factory( tsi_result tsi_create_ssl_server_handshaker_factory(
const unsigned char** pem_private_keys, const unsigned char** pem_private_keys,
const size_t* pem_private_keys_sizes, const size_t* pem_private_keys_sizes, const unsigned char** pem_cert_chains,
const unsigned char** pem_cert_chains,
const size_t* pem_cert_chains_sizes, size_t key_cert_pair_count, const size_t* pem_cert_chains_sizes, size_t key_cert_pair_count,
const unsigned char* pem_client_root_certs, const unsigned char* pem_client_root_certs,
size_t pem_client_root_certs_size, const char* cipher_suites, size_t pem_client_root_certs_size, const char* cipher_suites,

@ -65,8 +65,8 @@ CompletionQueue::CompletionType CompletionQueue::Next(void** tag) {
case GRPC_READ: case GRPC_READ:
*tag = ev->tag; *tag = ev->tag;
if (ev->data.read) { if (ev->data.read) {
success = success = static_cast<AsyncServerContext *>(ev->tag)
static_cast<AsyncServerContext*>(ev->tag)->ParseRead(ev->data.read); ->ParseRead(ev->data.read);
return_type = success ? SERVER_READ_OK : SERVER_READ_ERROR; return_type = success ? SERVER_READ_OK : SERVER_READ_ERROR;
} else { } else {
return_type = SERVER_READ_ERROR; return_type = SERVER_READ_ERROR;

@ -77,7 +77,9 @@ class StreamContext final : public StreamContextInterface {
void *write_tag() { return reinterpret_cast<char *>(this) + 2; } void *write_tag() { return reinterpret_cast<char *>(this) + 2; }
void *halfclose_tag() { return reinterpret_cast<char *>(this) + 3; } void *halfclose_tag() { return reinterpret_cast<char *>(this) + 3; }
void *invoke_tag() { return reinterpret_cast<char *>(this) + 4; } void *invoke_tag() { return reinterpret_cast<char *>(this) + 4; }
void* client_metadata_read_tag() { return reinterpret_cast<char*>(this) + 5; } void *client_metadata_read_tag() {
return reinterpret_cast<char *>(this) + 5;
}
grpc_call *call() { return call_; } grpc_call *call() { return call_; }
grpc_completion_queue *cq() { return cq_; } grpc_completion_queue *cq() { return cq_; }

@ -425,14 +425,13 @@ static zend_function_entry call_methods[] = {
PHP_ME(Call, __construct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR) PHP_ME(Call, __construct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
PHP_ME(Call, server_accept, NULL, ZEND_ACC_PUBLIC) PHP_ME(Call, server_accept, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Call, server_end_initial_metadata, NULL, ZEND_ACC_PUBLIC) PHP_ME(Call, server_end_initial_metadata, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Call, add_metadata, NULL, ZEND_ACC_PUBLIC) PHP_ME( PHP_ME(Call, add_metadata, NULL, ZEND_ACC_PUBLIC)
Call, cancel, NULL, ZEND_ACC_PUBLIC) PHP_ME(Call, cancel, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Call, start_invoke, NULL, ZEND_ACC_PUBLIC) PHP_ME( PHP_ME(Call, start_invoke, NULL, ZEND_ACC_PUBLIC)
Call, start_read, NULL, ZEND_ACC_PUBLIC) PHP_ME(Call, start_read, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Call, start_write, NULL, ZEND_ACC_PUBLIC) PHP_ME( PHP_ME(Call, start_write, NULL, ZEND_ACC_PUBLIC)
Call, start_write_status, NULL, ZEND_ACC_PUBLIC) PHP_ME(Call, start_write_status, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Call, writes_done, NULL, ZEND_ACC_PUBLIC) PHP_ME(Call, writes_done, NULL, ZEND_ACC_PUBLIC) PHP_FE_END};
PHP_FE_END};
void grpc_init_call(TSRMLS_D) { void grpc_init_call(TSRMLS_D) {
zend_class_entry ce; zend_class_entry ce;

@ -63,8 +63,8 @@ zend_object_value create_wrapped_grpc_completion_queue(
*/ */
PHP_METHOD(CompletionQueue, __construct) { PHP_METHOD(CompletionQueue, __construct) {
wrapped_grpc_completion_queue *queue = wrapped_grpc_completion_queue *queue =
(wrapped_grpc_completion_queue *)zend_object_store_get_object( (wrapped_grpc_completion_queue *)zend_object_store_get_object(getThis()
getThis() TSRMLS_CC); TSRMLS_CC);
queue->wrapped = grpc_completion_queue_create(); queue->wrapped = grpc_completion_queue_create();
} }
@ -86,8 +86,8 @@ PHP_METHOD(CompletionQueue, next) {
return; return;
} }
wrapped_grpc_completion_queue *completion_queue = wrapped_grpc_completion_queue *completion_queue =
(wrapped_grpc_completion_queue *)zend_object_store_get_object( (wrapped_grpc_completion_queue *)zend_object_store_get_object(getThis()
getThis() TSRMLS_CC); TSRMLS_CC);
wrapped_grpc_timeval *wrapped_timeout = wrapped_grpc_timeval *wrapped_timeout =
(wrapped_grpc_timeval *)zend_object_store_get_object(timeout TSRMLS_CC); (wrapped_grpc_timeval *)zend_object_store_get_object(timeout TSRMLS_CC);
grpc_event *event = grpc_completion_queue_next(completion_queue->wrapped, grpc_event *event = grpc_completion_queue_next(completion_queue->wrapped,
@ -109,8 +109,8 @@ PHP_METHOD(CompletionQueue, pluck) {
"pluck needs a long and a Timeval", 1 TSRMLS_CC); "pluck needs a long and a Timeval", 1 TSRMLS_CC);
} }
wrapped_grpc_completion_queue *completion_queue = wrapped_grpc_completion_queue *completion_queue =
(wrapped_grpc_completion_queue *)zend_object_store_get_object( (wrapped_grpc_completion_queue *)zend_object_store_get_object(getThis()
getThis() TSRMLS_CC); TSRMLS_CC);
wrapped_grpc_timeval *wrapped_timeout = wrapped_grpc_timeval *wrapped_timeout =
(wrapped_grpc_timeval *)zend_object_store_get_object(timeout TSRMLS_CC); (wrapped_grpc_timeval *)zend_object_store_get_object(timeout TSRMLS_CC);
grpc_event *event = grpc_completion_queue_pluck( grpc_event *event = grpc_completion_queue_pluck(

@ -154,10 +154,9 @@ static zend_function_entry credentials_methods[] = {
PHP_ME(Credentials, createSsl, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME(Credentials, createSsl, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
PHP_ME(Credentials, createComposite, NULL, PHP_ME(Credentials, createComposite, NULL,
ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
PHP_ME(Credentials, createGce, NULL, PHP_ME(Credentials, createGce, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME(Credentials, createFake, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
PHP_ME(Credentials, createFake, NULL, PHP_FE_END};
ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_FE_END};
void grpc_init_credentials(TSRMLS_D) { void grpc_init_credentials(TSRMLS_D) {
zend_class_entry ce; zend_class_entry ce;

@ -33,7 +33,8 @@ zend_module_entry grpc_module_entry = {
#if ZEND_MODULE_API_NO >= 20010901 #if ZEND_MODULE_API_NO >= 20010901
STANDARD_MODULE_HEADER, STANDARD_MODULE_HEADER,
#endif #endif
"grpc", grpc_functions, PHP_MINIT(grpc), PHP_MSHUTDOWN(grpc), NULL, NULL, "grpc", grpc_functions, PHP_MINIT(grpc),
PHP_MSHUTDOWN(grpc), NULL, NULL,
PHP_MINFO(grpc), PHP_MINFO(grpc),
#if ZEND_MODULE_API_NO >= 20010901 #if ZEND_MODULE_API_NO >= 20010901
PHP_GRPC_VERSION, PHP_GRPC_VERSION,

@ -217,20 +217,16 @@ PHP_METHOD(Timeval, sleep_until) {
} }
static zend_function_entry timeval_methods[] = { static zend_function_entry timeval_methods[] = {
PHP_ME(Timeval, __construct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR) PHP_ME( PHP_ME(Timeval, __construct, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR)
Timeval, add, NULL, PHP_ME(Timeval, add, NULL, ZEND_ACC_PUBLIC)
ZEND_ACC_PUBLIC) PHP_ME(Timeval, compare, NULL, PHP_ME(Timeval, compare, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
PHP_ME(Timeval, inf_future, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME(Timeval, inf_future, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
PHP_ME(Timeval, inf_past, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME(Timeval, inf_past, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
PHP_ME(Timeval, now, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_ME(Timeval, now, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
PHP_ME(Timeval, similar, NULL, PHP_ME(Timeval, similar, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
PHP_ME(Timeval, sleep_until, NULL, ZEND_ACC_PUBLIC) PHP_ME(Timeval, sleep_until, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Timeval, subtract, NULL, ZEND_ACC_PUBLIC) PHP_ME(Timeval, subtract, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Timeval, zero, NULL, PHP_ME(Timeval, zero, NULL, ZEND_ACC_PUBLIC | ZEND_ACC_STATIC) PHP_FE_END};
ZEND_ACC_PUBLIC | ZEND_ACC_STATIC)
PHP_FE_END};
void grpc_init_timeval(TSRMLS_D) { void grpc_init_timeval(TSRMLS_D) {
zend_class_entry ce; zend_class_entry ce;

@ -495,4 +495,3 @@ void cq_expect_finished(cq_verifier *v, void *tag, ...) {
void cq_expect_server_shutdown(cq_verifier *v, void *tag) { void cq_expect_server_shutdown(cq_verifier *v, void *tag) {
add(v, GRPC_SERVER_SHUTDOWN, tag); add(v, GRPC_SERVER_SHUTDOWN, tag);
} }

@ -64,8 +64,8 @@ static void free_data(void* data) { gpr_free(data); }
static void test_create_table(void) { static void test_create_table(void) {
/* Create table with uint64 key type */ /* Create table with uint64 key type */
census_ht* ht = NULL; census_ht* ht = NULL;
census_ht_option ht_options = {CENSUS_HT_UINT64, 1999, NULL, NULL, NULL, census_ht_option ht_options = {CENSUS_HT_UINT64, 1999, NULL,
NULL}; NULL, NULL, NULL};
ht = census_ht_create(&ht_options); ht = census_ht_create(&ht_options);
GPR_ASSERT(ht != NULL); GPR_ASSERT(ht != NULL);
GPR_ASSERT(census_ht_get_size(ht) == 0); GPR_ASSERT(census_ht_get_size(ht) == 0);
@ -119,8 +119,8 @@ static void test_table_with_int_key(void) {
/* Test that there is no memory leak when keys and values are owned by table. */ /* Test that there is no memory leak when keys and values are owned by table. */
static void test_value_and_key_deleter(void) { static void test_value_and_key_deleter(void) {
census_ht_option opt = {CENSUS_HT_POINTER, 7, &hash64, &cmp_str_keys, census_ht_option opt = {CENSUS_HT_POINTER, 7, &hash64,
&free_data, &free_data}; &cmp_str_keys, &free_data, &free_data};
census_ht* ht = census_ht_create(&opt); census_ht* ht = census_ht_create(&opt);
census_ht_key key; census_ht_key key;
char* val = NULL; char* val = NULL;
@ -208,12 +208,12 @@ static void test_insertion_and_deletion_with_high_collision_rate(void) {
} }
static void test_table_with_string_key(void) { static void test_table_with_string_key(void) {
census_ht_option opt = {CENSUS_HT_POINTER, 7, &hash64, &cmp_str_keys, NULL, census_ht_option opt = {CENSUS_HT_POINTER, 7, &hash64,
NULL}; &cmp_str_keys, NULL, NULL};
census_ht* ht = census_ht_create(&opt); census_ht* ht = census_ht_create(&opt);
const char* keys[] = {"k1", "a", "000", "apple", const char* keys[] = {"k1", "a", "000",
"banana_a_long_long_long_banana", "%$", "111", "foo", "apple", "banana_a_long_long_long_banana", "%$",
"b"}; "111", "foo", "b"};
const int vals[] = {0, 1, 2, 3, 4, 5, 6, 7, 8}; const int vals[] = {0, 1, 2, 3, 4, 5, 6, 7, 8};
int i = 0; int i = 0;
GPR_ASSERT(ht != NULL); GPR_ASSERT(ht != NULL);

@ -58,8 +58,8 @@ static void producer_thread(void *arg) {
for (i = 0; i < opt->iterations; i++) { for (i = 0; i < opt->iterations; i++) {
grpc_cq_begin_op(opt->cc, NULL, GRPC_WRITE_ACCEPTED); grpc_cq_begin_op(opt->cc, NULL, GRPC_WRITE_ACCEPTED);
grpc_cq_end_write_accepted(opt->cc, (void *)(gpr_intptr)1, NULL, NULL, NULL, grpc_cq_end_write_accepted(opt->cc, (void *)(gpr_intptr) 1, NULL, NULL,
GRPC_OP_OK); NULL, GRPC_OP_OK);
} }
gpr_event_set(&opt->on_finished, (void *)(gpr_intptr) 1); gpr_event_set(&opt->on_finished, (void *)(gpr_intptr) 1);

@ -296,8 +296,8 @@ static void producer_thread(void *arg) {
gpr_log(GPR_INFO, "producer %d phase 2", opt->id); gpr_log(GPR_INFO, "producer %d phase 2", opt->id);
for (i = 0; i < TEST_THREAD_EVENTS; i++) { for (i = 0; i < TEST_THREAD_EVENTS; i++) {
grpc_cq_end_write_accepted(opt->cc, (void *)(gpr_intptr)1, NULL, NULL, NULL, grpc_cq_end_write_accepted(opt->cc, (void *)(gpr_intptr) 1, NULL, NULL,
GRPC_OP_OK); NULL, GRPC_OP_OK);
opt->events_triggered++; opt->events_triggered++;
} }

@ -1,8 +1,9 @@
#!/bin/bash #!/bin/bash
set -ex set -e
source $(dirname $0)/config.sh
cd $(dirname $0)/../.. cd $(dirname $0)/../..
for dir in src test include for dir in src test include
do do
find $dir -name '*.c' -or -name '*.cc' -or -name '*.h' | xargs clang-format -i find $dir -name '*.c' -or -name '*.cc' -or -name '*.h' | xargs $CLANG_FORMAT -i
done done

@ -0,0 +1 @@
CLANG_FORMAT=clang-format-3.5
Loading…
Cancel
Save