diff options
author | ncteisen <ncteisen@gmail.com> | 2017-11-15 16:48:19 -0800 |
---|---|---|
committer | ncteisen <ncteisen@gmail.com> | 2017-11-15 16:48:19 -0800 |
commit | df817f3e1a78c2760798f27d2c285936d818f656 (patch) | |
tree | c7cb8b1c3057b7d1d7d00b0e606a804d63d35846 /src/core/lib/channel | |
parent | 1037216ca165a9da963d41af575c55ca1b677311 (diff) | |
parent | ff2edb3eba20b30f232ded7769cab8cd20ff5009 (diff) |
Merge branch 'master' of https://github.com/grpc/grpc into surfacing-error-details
Diffstat (limited to 'src/core/lib/channel')
-rw-r--r-- | src/core/lib/channel/channel_args.cc | 40 | ||||
-rw-r--r-- | src/core/lib/channel/channel_stack.cc | 2 | ||||
-rw-r--r-- | src/core/lib/channel/channel_stack_builder.cc | 22 | ||||
-rw-r--r-- | src/core/lib/channel/connected_channel.cc | 10 | ||||
-rw-r--r-- | src/core/lib/channel/handshaker.cc | 10 | ||||
-rw-r--r-- | src/core/lib/channel/handshaker_factory.cc | 8 |
6 files changed, 46 insertions, 46 deletions
diff --git a/src/core/lib/channel/channel_args.cc b/src/core/lib/channel/channel_args.cc index 23a604301e..735fcbe405 100644 --- a/src/core/lib/channel/channel_args.cc +++ b/src/core/lib/channel/channel_args.cc @@ -54,7 +54,7 @@ static grpc_arg copy_arg(const grpc_arg* src) { grpc_channel_args* grpc_channel_args_copy_and_add(const grpc_channel_args* src, const grpc_arg* to_add, size_t num_to_add) { - return grpc_channel_args_copy_and_add_and_remove(src, NULL, 0, to_add, + return grpc_channel_args_copy_and_add_and_remove(src, nullptr, 0, to_add, num_to_add); } @@ -62,7 +62,7 @@ grpc_channel_args* grpc_channel_args_copy_and_remove( const grpc_channel_args* src, const char** to_remove, size_t num_to_remove) { return grpc_channel_args_copy_and_add_and_remove(src, to_remove, - num_to_remove, NULL, 0); + num_to_remove, nullptr, 0); } static bool should_remove_arg(const grpc_arg* arg, const char** to_remove, @@ -78,7 +78,7 @@ grpc_channel_args* grpc_channel_args_copy_and_add_and_remove( const grpc_arg* to_add, size_t num_to_add) { // Figure out how many args we'll be copying. size_t num_args_to_copy = 0; - if (src != NULL) { + if (src != nullptr) { for (size_t i = 0; i < src->num_args; ++i) { if (!should_remove_arg(&src->args[i], to_remove, num_to_remove)) { ++num_args_to_copy; @@ -90,13 +90,13 @@ grpc_channel_args* grpc_channel_args_copy_and_add_and_remove( (grpc_channel_args*)gpr_malloc(sizeof(grpc_channel_args)); dst->num_args = num_args_to_copy + num_to_add; if (dst->num_args == 0) { - dst->args = NULL; + dst->args = nullptr; return dst; } dst->args = (grpc_arg*)gpr_malloc(sizeof(grpc_arg) * dst->num_args); // Copy args from src that are not being removed. size_t dst_idx = 0; - if (src != NULL) { + if (src != nullptr) { for (size_t i = 0; i < src->num_args; ++i) { if (!should_remove_arg(&src->args[i], to_remove, num_to_remove)) { dst->args[dst_idx++] = copy_arg(&src->args[i]); @@ -112,7 +112,7 @@ grpc_channel_args* grpc_channel_args_copy_and_add_and_remove( } grpc_channel_args* grpc_channel_args_copy(const grpc_channel_args* src) { - return grpc_channel_args_copy_and_add(src, NULL, 0); + return grpc_channel_args_copy_and_add(src, nullptr, 0); } grpc_channel_args* grpc_channel_args_union(const grpc_channel_args* a, @@ -124,12 +124,12 @@ grpc_channel_args* grpc_channel_args_union(const grpc_channel_args* a, size_t uniques_idx = a->num_args; for (size_t i = 0; i < b->num_args; ++i) { const char* b_key = b->args[i].key; - if (grpc_channel_args_find(a, b_key) == NULL) { // not found + if (grpc_channel_args_find(a, b_key) == nullptr) { // not found uniques[uniques_idx++] = b->args[i]; } } grpc_channel_args* result = - grpc_channel_args_copy_and_add(NULL, uniques, uniques_idx); + grpc_channel_args_copy_and_add(nullptr, uniques, uniques_idx); gpr_free(uniques); return result; } @@ -212,7 +212,7 @@ void grpc_channel_args_destroy(grpc_exec_ctx* exec_ctx, grpc_channel_args* a) { grpc_compression_algorithm grpc_channel_args_get_compression_algorithm( const grpc_channel_args* a) { size_t i; - if (a == NULL) return GRPC_COMPRESS_NONE; + if (a == nullptr) return GRPC_COMPRESS_NONE; for (i = 0; i < a->num_args; ++i) { if (a->args[i].type == GRPC_ARG_INTEGER && !strcmp(GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM, a->args[i].key)) { @@ -226,7 +226,7 @@ grpc_compression_algorithm grpc_channel_args_get_compression_algorithm( grpc_stream_compression_algorithm grpc_channel_args_get_stream_compression_algorithm(const grpc_channel_args* a) { size_t i; - if (a == NULL) return GRPC_STREAM_COMPRESS_NONE; + if (a == nullptr) return GRPC_STREAM_COMPRESS_NONE; for (i = 0; i < a->num_args; ++i) { if (a->args[i].type == GRPC_ARG_INTEGER && !strcmp(GRPC_STREAM_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM, @@ -263,7 +263,7 @@ grpc_channel_args* grpc_channel_args_set_stream_compression_algorithm( * 0. */ static int find_compression_algorithm_states_bitset(const grpc_channel_args* a, int** states_arg) { - if (a != NULL) { + if (a != nullptr) { size_t i; for (i = 0; i < a->num_args; ++i) { if (a->args[i].type == GRPC_ARG_INTEGER && @@ -283,7 +283,7 @@ static int find_compression_algorithm_states_bitset(const grpc_channel_args* a, * 0. */ static int find_stream_compression_algorithm_states_bitset( const grpc_channel_args* a, int** states_arg) { - if (a != NULL) { + if (a != nullptr) { size_t i; for (i = 0; i < a->num_args; ++i) { if (a->args[i].type == GRPC_ARG_INTEGER && @@ -301,14 +301,14 @@ static int find_stream_compression_algorithm_states_bitset( grpc_channel_args* grpc_channel_args_compression_algorithm_set_state( grpc_exec_ctx* exec_ctx, grpc_channel_args** a, grpc_compression_algorithm algorithm, int state) { - int* states_arg = NULL; + int* states_arg = nullptr; grpc_channel_args* result = *a; const int states_arg_found = find_compression_algorithm_states_bitset(*a, &states_arg); if (grpc_channel_args_get_compression_algorithm(*a) == algorithm && state == 0) { - const char* algo_name = NULL; + const char* algo_name = nullptr; GPR_ASSERT(grpc_compression_algorithm_name(algorithm, &algo_name) != 0); gpr_log(GPR_ERROR, "Tried to disable default compression algorithm '%s'. The " @@ -342,14 +342,14 @@ grpc_channel_args* grpc_channel_args_compression_algorithm_set_state( grpc_channel_args* grpc_channel_args_stream_compression_algorithm_set_state( grpc_exec_ctx* exec_ctx, grpc_channel_args** a, grpc_stream_compression_algorithm algorithm, int state) { - int* states_arg = NULL; + int* states_arg = nullptr; grpc_channel_args* result = *a; const int states_arg_found = find_stream_compression_algorithm_states_bitset(*a, &states_arg); if (grpc_channel_args_get_stream_compression_algorithm(*a) == algorithm && state == 0) { - const char* algo_name = NULL; + const char* algo_name = nullptr; GPR_ASSERT(grpc_stream_compression_algorithm_name(algorithm, &algo_name) != 0); gpr_log(GPR_ERROR, @@ -421,19 +421,19 @@ int grpc_channel_args_compare(const grpc_channel_args* a, const grpc_arg* grpc_channel_args_find(const grpc_channel_args* args, const char* name) { - if (args != NULL) { + if (args != nullptr) { for (size_t i = 0; i < args->num_args; ++i) { if (strcmp(args->args[i].key, name) == 0) { return &args->args[i]; } } } - return NULL; + return nullptr; } int grpc_channel_arg_get_integer(const grpc_arg* arg, const grpc_integer_options options) { - if (arg == NULL) return options.default_value; + if (arg == nullptr) return options.default_value; if (arg->type != GRPC_ARG_INTEGER) { gpr_log(GPR_ERROR, "%s ignored: it must be an integer", arg->key); return options.default_value; @@ -452,7 +452,7 @@ int grpc_channel_arg_get_integer(const grpc_arg* arg, } bool grpc_channel_arg_get_bool(const grpc_arg* arg, bool default_value) { - if (arg == NULL) return default_value; + if (arg == nullptr) return default_value; if (arg->type != GRPC_ARG_INTEGER) { gpr_log(GPR_ERROR, "%s ignored: it must be an integer", arg->key); return default_value; diff --git a/src/core/lib/channel/channel_stack.cc b/src/core/lib/channel/channel_stack.cc index 3ab2e33d6d..6e5080995e 100644 --- a/src/core/lib/channel/channel_stack.cc +++ b/src/core/lib/channel/channel_stack.cc @@ -225,7 +225,7 @@ void grpc_call_stack_destroy(grpc_exec_ctx* exec_ctx, grpc_call_stack* stack, for (i = 0; i < count; i++) { elems[i].filter->destroy_call_elem( exec_ctx, &elems[i], final_info, - i == count - 1 ? then_schedule_closure : NULL); + i == count - 1 ? then_schedule_closure : nullptr); } } diff --git a/src/core/lib/channel/channel_stack_builder.cc b/src/core/lib/channel/channel_stack_builder.cc index 83748db3c2..1e553bfb03 100644 --- a/src/core/lib/channel/channel_stack_builder.cc +++ b/src/core/lib/channel/channel_stack_builder.cc @@ -54,8 +54,8 @@ grpc_channel_stack_builder* grpc_channel_stack_builder_create(void) { grpc_channel_stack_builder* b = (grpc_channel_stack_builder*)gpr_zalloc(sizeof(*b)); - b->begin.filter = NULL; - b->end.filter = NULL; + b->begin.filter = nullptr; + b->end.filter = nullptr; b->begin.next = &b->end; b->begin.prev = &b->end; b->end.next = &b->begin; @@ -108,7 +108,7 @@ bool grpc_channel_stack_builder_iterator_is_end( const char* grpc_channel_stack_builder_iterator_filter_name( grpc_channel_stack_builder_iterator* iterator) { - if (iterator->node->filter == NULL) return NULL; + if (iterator->node->filter == nullptr) return nullptr; return iterator->node->filter->name; } @@ -128,7 +128,7 @@ bool grpc_channel_stack_builder_move_prev( grpc_channel_stack_builder_iterator* grpc_channel_stack_builder_iterator_find( grpc_channel_stack_builder* builder, const char* filter_name) { - GPR_ASSERT(filter_name != NULL); + GPR_ASSERT(filter_name != nullptr); grpc_channel_stack_builder_iterator* it = grpc_channel_stack_builder_create_iterator_at_first(builder); while (grpc_channel_stack_builder_move_next(it)) { @@ -145,14 +145,14 @@ bool grpc_channel_stack_builder_move_prev( void grpc_channel_stack_builder_set_name(grpc_channel_stack_builder* builder, const char* name) { - GPR_ASSERT(builder->name == NULL); + GPR_ASSERT(builder->name == nullptr); builder->name = name; } void grpc_channel_stack_builder_set_channel_arguments( grpc_exec_ctx* exec_ctx, grpc_channel_stack_builder* builder, const grpc_channel_args* args) { - if (builder->args != NULL) { + if (builder->args != nullptr) { grpc_channel_args_destroy(exec_ctx, builder->args); } builder->args = grpc_channel_args_copy(args); @@ -160,7 +160,7 @@ void grpc_channel_stack_builder_set_channel_arguments( void grpc_channel_stack_builder_set_transport( grpc_channel_stack_builder* builder, grpc_transport* transport) { - GPR_ASSERT(builder->transport == NULL); + GPR_ASSERT(builder->transport == nullptr); builder->transport = transport; } @@ -249,7 +249,7 @@ void grpc_channel_stack_builder_destroy(grpc_exec_ctx* exec_ctx, gpr_free(p); p = next; } - if (builder->args != NULL) { + if (builder->args != nullptr) { grpc_channel_args_destroy(exec_ctx, builder->args); } gpr_free(builder->target); @@ -285,19 +285,19 @@ grpc_error* grpc_channel_stack_builder_finish( // and initialize it grpc_error* error = grpc_channel_stack_init( exec_ctx, initial_refs, destroy, - destroy_arg == NULL ? *result : destroy_arg, filters, num_filters, + destroy_arg == nullptr ? *result : destroy_arg, filters, num_filters, builder->args, builder->transport, builder->name, channel_stack); if (error != GRPC_ERROR_NONE) { grpc_channel_stack_destroy(exec_ctx, channel_stack); gpr_free(*result); - *result = NULL; + *result = nullptr; } else { // run post-initialization functions i = 0; for (filter_node* p = builder->begin.next; p != &builder->end; p = p->next) { - if (p->init != NULL) { + if (p->init != nullptr) { p->init(channel_stack, grpc_channel_stack_element(channel_stack, i), p->init_arg); } diff --git a/src/core/lib/channel/connected_channel.cc b/src/core/lib/channel/connected_channel.cc index 49b9f140c0..af2f88ab2e 100644 --- a/src/core/lib/channel/connected_channel.cc +++ b/src/core/lib/channel/connected_channel.cc @@ -85,7 +85,7 @@ static callback_state* get_state_for_batch( if (batch->recv_initial_metadata) return &calld->on_complete[3]; if (batch->recv_message) return &calld->on_complete[4]; if (batch->recv_trailing_metadata) return &calld->on_complete[5]; - GPR_UNREACHABLE_CODE(return NULL); + GPR_UNREACHABLE_CODE(return nullptr); } /* We perform a small hack to locate transport data alongside the connected @@ -181,7 +181,7 @@ static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx, grpc_channel_element_args* args) { channel_data* cd = (channel_data*)elem->channel_data; GPR_ASSERT(args->is_last); - cd->transport = NULL; + cd->transport = nullptr; return GRPC_ERROR_NONE; } @@ -217,7 +217,7 @@ static void bind_transport(grpc_channel_stack* channel_stack, grpc_channel_element* elem, void* t) { channel_data* cd = (channel_data*)elem->channel_data; GPR_ASSERT(elem->filter == &grpc_connected_filter); - GPR_ASSERT(cd->transport == NULL); + GPR_ASSERT(cd->transport == nullptr); cd->transport = (grpc_transport*)t; /* HACK(ctiller): increase call stack size for the channel to make space @@ -233,9 +233,9 @@ static void bind_transport(grpc_channel_stack* channel_stack, bool grpc_add_connected_filter(grpc_exec_ctx* exec_ctx, grpc_channel_stack_builder* builder, void* arg_must_be_null) { - GPR_ASSERT(arg_must_be_null == NULL); + GPR_ASSERT(arg_must_be_null == nullptr); grpc_transport* t = grpc_channel_stack_builder_get_transport(builder); - GPR_ASSERT(t != NULL); + GPR_ASSERT(t != nullptr); return grpc_channel_stack_builder_append_filter( builder, &grpc_connected_filter, bind_transport, t); } diff --git a/src/core/lib/channel/handshaker.cc b/src/core/lib/channel/handshaker.cc index b27ee37e5b..aae1b35845 100644 --- a/src/core/lib/channel/handshaker.cc +++ b/src/core/lib/channel/handshaker.cc @@ -93,8 +93,8 @@ grpc_handshake_manager* grpc_handshake_manager_create() { void grpc_handshake_manager_pending_list_add(grpc_handshake_manager** head, grpc_handshake_manager* mgr) { - GPR_ASSERT(mgr->prev == NULL); - GPR_ASSERT(mgr->next == NULL); + GPR_ASSERT(mgr->prev == nullptr); + GPR_ASSERT(mgr->next == nullptr); mgr->next = *head; if (*head) { (*head)->prev = mgr; @@ -104,10 +104,10 @@ void grpc_handshake_manager_pending_list_add(grpc_handshake_manager** head, void grpc_handshake_manager_pending_list_remove(grpc_handshake_manager** head, grpc_handshake_manager* mgr) { - if (mgr->next != NULL) { + if (mgr->next != nullptr) { mgr->next->prev = mgr->prev; } - if (mgr->prev != NULL) { + if (mgr->prev != nullptr) { mgr->prev->next = mgr->next; } else { GPR_ASSERT(*head == mgr); @@ -117,7 +117,7 @@ void grpc_handshake_manager_pending_list_remove(grpc_handshake_manager** head, void grpc_handshake_manager_pending_list_shutdown_all( grpc_exec_ctx* exec_ctx, grpc_handshake_manager* head, grpc_error* why) { - while (head != NULL) { + while (head != nullptr) { grpc_handshake_manager_shutdown(exec_ctx, head, GRPC_ERROR_REF(why)); head = head->next; } diff --git a/src/core/lib/channel/handshaker_factory.cc b/src/core/lib/channel/handshaker_factory.cc index bf1188dbb9..015006ade0 100644 --- a/src/core/lib/channel/handshaker_factory.cc +++ b/src/core/lib/channel/handshaker_factory.cc @@ -23,8 +23,8 @@ void grpc_handshaker_factory_add_handshakers( grpc_exec_ctx* exec_ctx, grpc_handshaker_factory* handshaker_factory, const grpc_channel_args* args, grpc_handshake_manager* handshake_mgr) { - if (handshaker_factory != NULL) { - GPR_ASSERT(handshaker_factory->vtable != NULL); + if (handshaker_factory != nullptr) { + GPR_ASSERT(handshaker_factory->vtable != nullptr); handshaker_factory->vtable->add_handshakers(exec_ctx, handshaker_factory, args, handshake_mgr); } @@ -32,8 +32,8 @@ void grpc_handshaker_factory_add_handshakers( void grpc_handshaker_factory_destroy( grpc_exec_ctx* exec_ctx, grpc_handshaker_factory* handshaker_factory) { - if (handshaker_factory != NULL) { - GPR_ASSERT(handshaker_factory->vtable != NULL); + if (handshaker_factory != nullptr) { + GPR_ASSERT(handshaker_factory->vtable != nullptr); handshaker_factory->vtable->destroy(exec_ctx, handshaker_factory); } } |