diff options
author | Craig Tiller <ctiller@google.com> | 2017-11-10 09:53:21 -0800 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2017-11-10 09:53:21 -0800 |
commit | 4782d92b2d4fab261b5520a29d79ba97fea9ce7b (patch) | |
tree | d060fc1c4093583abc9348cc69a64b52d065f6e3 /src/core/ext/transport/chttp2/client | |
parent | 1ef989cd50cdfb172e99c552a67e3ed5f350e5cc (diff) |
s/NULL/nullptr
Diffstat (limited to 'src/core/ext/transport/chttp2/client')
4 files changed, 46 insertions, 46 deletions
diff --git a/src/core/ext/transport/chttp2/client/chttp2_connector.cc b/src/core/ext/transport/chttp2/client/chttp2_connector.cc index 6cd476f4ca..77cc313480 100644 --- a/src/core/ext/transport/chttp2/client/chttp2_connector.cc +++ b/src/core/ext/transport/chttp2/client/chttp2_connector.cc @@ -68,7 +68,7 @@ static void chttp2_connector_unref(grpc_exec_ctx* exec_ctx, gpr_mu_destroy(&c->mu); // If handshaking is not yet in progress, destroy the endpoint. // Otherwise, the handshaker will do this for us. - if (c->endpoint != NULL) grpc_endpoint_destroy(exec_ctx, c->endpoint); + if (c->endpoint != nullptr) grpc_endpoint_destroy(exec_ctx, c->endpoint); gpr_free(c); } } @@ -78,13 +78,13 @@ static void chttp2_connector_shutdown(grpc_exec_ctx* exec_ctx, chttp2_connector* c = (chttp2_connector*)con; gpr_mu_lock(&c->mu); c->shutdown = true; - if (c->handshake_mgr != NULL) { + if (c->handshake_mgr != nullptr) { grpc_handshake_manager_shutdown(exec_ctx, c->handshake_mgr, GRPC_ERROR_REF(why)); } // If handshaking is not yet in progress, shutdown the endpoint. // Otherwise, the handshaker will do this for us. - if (!c->connecting && c->endpoint != NULL) { + if (!c->connecting && c->endpoint != nullptr) { grpc_endpoint_shutdown(exec_ctx, c->endpoint, GRPC_ERROR_REF(why)); } gpr_mu_unlock(&c->mu); @@ -125,10 +125,10 @@ static void on_handshake_done(grpc_exec_ctx* exec_ctx, void* arg, c->result->channel_args = args->args; } grpc_closure* notify = c->notify; - c->notify = NULL; + c->notify = nullptr; GRPC_CLOSURE_SCHED(exec_ctx, notify, error); grpc_handshake_manager_destroy(exec_ctx, c->handshake_mgr); - c->handshake_mgr = NULL; + c->handshake_mgr = nullptr; gpr_mu_unlock(&c->mu); chttp2_connector_unref(exec_ctx, (grpc_connector*)c); } @@ -142,8 +142,8 @@ static void start_handshake_locked(grpc_exec_ctx* exec_ctx, c->args.interested_parties); grpc_handshake_manager_do_handshake( exec_ctx, c->handshake_mgr, c->endpoint, c->args.channel_args, - c->args.deadline, NULL /* acceptor */, on_handshake_done, c); - c->endpoint = NULL; // Endpoint handed off to handshake manager. + c->args.deadline, nullptr /* acceptor */, on_handshake_done, c); + c->endpoint = nullptr; // Endpoint handed off to handshake manager. } static void connected(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) { @@ -159,15 +159,15 @@ static void connected(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) { } memset(c->result, 0, sizeof(*c->result)); grpc_closure* notify = c->notify; - c->notify = NULL; + c->notify = nullptr; GRPC_CLOSURE_SCHED(exec_ctx, notify, error); - if (c->endpoint != NULL) { + if (c->endpoint != nullptr) { grpc_endpoint_shutdown(exec_ctx, c->endpoint, GRPC_ERROR_REF(error)); } gpr_mu_unlock(&c->mu); chttp2_connector_unref(exec_ctx, (grpc_connector*)arg); } else { - GPR_ASSERT(c->endpoint != NULL); + GPR_ASSERT(c->endpoint != nullptr); start_handshake_locked(exec_ctx, c); gpr_mu_unlock(&c->mu); } @@ -182,11 +182,11 @@ static void chttp2_connector_connect(grpc_exec_ctx* exec_ctx, grpc_resolved_address addr; grpc_get_subchannel_address_arg(exec_ctx, args->channel_args, &addr); gpr_mu_lock(&c->mu); - GPR_ASSERT(c->notify == NULL); + GPR_ASSERT(c->notify == nullptr); c->notify = notify; c->args = *args; c->result = result; - GPR_ASSERT(c->endpoint == NULL); + GPR_ASSERT(c->endpoint == nullptr); chttp2_connector_ref(con); // Ref taken for callback. GRPC_CLOSURE_INIT(&c->connected, connected, c, grpc_schedule_on_exec_ctx); GPR_ASSERT(!c->connecting); diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create.cc b/src/core/ext/transport/chttp2/client/insecure/channel_create.cc index 26c7f0debf..a5cd5d5294 100644 --- a/src/core/ext/transport/chttp2/client/insecure/channel_create.cc +++ b/src/core/ext/transport/chttp2/client/insecure/channel_create.cc @@ -49,9 +49,9 @@ static grpc_channel* client_channel_factory_create_channel( grpc_exec_ctx* exec_ctx, grpc_client_channel_factory* cc_factory, const char* target, grpc_client_channel_type type, const grpc_channel_args* args) { - if (target == NULL) { + if (target == nullptr) { gpr_log(GPR_ERROR, "cannot create channel with NULL target name"); - return NULL; + return nullptr; } // Add channel arg containing the server URI. grpc_arg arg = grpc_channel_arg_string_create( @@ -62,7 +62,7 @@ static grpc_channel* client_channel_factory_create_channel( grpc_channel_args_copy_and_add_and_remove(args, to_remove, 1, &arg, 1); gpr_free(arg.value.string); grpc_channel* channel = grpc_channel_create(exec_ctx, target, new_args, - GRPC_CLIENT_CHANNEL, NULL); + GRPC_CLIENT_CHANNEL, nullptr); grpc_channel_args_destroy(exec_ctx, new_args); return channel; } @@ -86,7 +86,7 @@ grpc_channel* grpc_insecure_channel_create(const char* target, GRPC_API_TRACE( "grpc_insecure_channel_create(target=%s, args=%p, reserved=%p)", 3, (target, args, reserved)); - GPR_ASSERT(reserved == NULL); + GPR_ASSERT(reserved == nullptr); // Add channel arg containing the client channel factory. grpc_arg arg = grpc_client_channel_factory_create_channel_arg(&client_channel_factory); @@ -98,7 +98,7 @@ grpc_channel* grpc_insecure_channel_create(const char* target, // Clean up. grpc_channel_args_destroy(&exec_ctx, new_args); grpc_exec_ctx_finish(&exec_ctx); - return channel != NULL ? channel + return channel != nullptr ? channel : grpc_lame_client_channel_create( target, GRPC_STATUS_INTERNAL, "Failed to create client channel"); diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc b/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc index 0974a7c393..aa3d0d1404 100644 --- a/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc +++ b/src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc @@ -58,11 +58,11 @@ grpc_channel* grpc_insecure_channel_create_from_fd( grpc_channel* channel = grpc_channel_create( &exec_ctx, target, final_args, GRPC_CLIENT_DIRECT_CHANNEL, transport); grpc_channel_args_destroy(&exec_ctx, final_args); - grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL); + grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr); grpc_exec_ctx_finish(&exec_ctx); - return channel != NULL ? channel + return channel != nullptr ? channel : grpc_lame_client_channel_create( target, GRPC_STATUS_INTERNAL, "Failed to create client channel"); diff --git a/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc b/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc index 68c1e1868c..7e23c56643 100644 --- a/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc +++ b/src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc @@ -47,51 +47,51 @@ static grpc_subchannel_args* get_secure_naming_subchannel_args( grpc_exec_ctx* exec_ctx, const grpc_subchannel_args* args) { grpc_channel_credentials* channel_credentials = grpc_channel_credentials_find_in_args(args->args); - if (channel_credentials == NULL) { + if (channel_credentials == nullptr) { gpr_log(GPR_ERROR, "Can't create subchannel: channel credentials missing for secure " "channel."); - return NULL; + return nullptr; } // Make sure security connector does not already exist in args. - if (grpc_security_connector_find_in_args(args->args) != NULL) { + if (grpc_security_connector_find_in_args(args->args) != nullptr) { gpr_log(GPR_ERROR, "Can't create subchannel: security connector already present in " "channel args."); - return NULL; + return nullptr; } // To which address are we connecting? By default, use the server URI. const grpc_arg* server_uri_arg = grpc_channel_args_find(args->args, GRPC_ARG_SERVER_URI); - GPR_ASSERT(server_uri_arg != NULL); + GPR_ASSERT(server_uri_arg != nullptr); GPR_ASSERT(server_uri_arg->type == GRPC_ARG_STRING); const char* server_uri_str = server_uri_arg->value.string; - GPR_ASSERT(server_uri_str != NULL); + GPR_ASSERT(server_uri_str != nullptr); grpc_uri* server_uri = grpc_uri_parse(exec_ctx, server_uri_str, true /* supress errors */); - GPR_ASSERT(server_uri != NULL); + GPR_ASSERT(server_uri != nullptr); const char* server_uri_path; server_uri_path = server_uri->path[0] == '/' ? server_uri->path + 1 : server_uri->path; const grpc_slice_hash_table* targets_info = grpc_lb_targets_info_find_in_args(args->args); - char* target_name_to_check = NULL; - if (targets_info != NULL) { // LB channel + char* target_name_to_check = nullptr; + if (targets_info != nullptr) { // LB channel // Find the balancer name for the target. const char* target_uri_str = grpc_get_subchannel_address_uri_arg(args->args); grpc_uri* target_uri = grpc_uri_parse(exec_ctx, target_uri_str, false /* suppress errors */); - GPR_ASSERT(target_uri != NULL); + GPR_ASSERT(target_uri != nullptr); if (target_uri->path[0] != '\0') { // "path" may be empty const grpc_slice key = grpc_slice_from_static_string( target_uri->path[0] == '/' ? target_uri->path + 1 : target_uri->path); const char* value = (const char*)grpc_slice_hash_table_get(targets_info, key); - if (value != NULL) target_name_to_check = gpr_strdup(value); + if (value != nullptr) target_name_to_check = gpr_strdup(value); grpc_slice_unref_internal(exec_ctx, key); } - if (target_name_to_check == NULL) { + if (target_name_to_check == nullptr) { // If the target name to check hasn't already been set, fall back to using // SERVER_URI target_name_to_check = gpr_strdup(server_uri_path); @@ -101,10 +101,10 @@ static grpc_subchannel_args* get_secure_naming_subchannel_args( target_name_to_check = gpr_strdup(server_uri_path); } grpc_uri_destroy(server_uri); - GPR_ASSERT(target_name_to_check != NULL); - grpc_channel_security_connector* subchannel_security_connector = NULL; + GPR_ASSERT(target_name_to_check != nullptr); + grpc_channel_security_connector* subchannel_security_connector = nullptr; // Create the security connector using the credentials and target name. - grpc_channel_args* new_args_from_connector = NULL; + grpc_channel_args* new_args_from_connector = nullptr; const grpc_security_status security_status = grpc_channel_credentials_create_security_connector( exec_ctx, channel_credentials, target_name_to_check, args->args, @@ -114,18 +114,18 @@ static grpc_subchannel_args* get_secure_naming_subchannel_args( "Failed to create secure subchannel for secure name '%s'", target_name_to_check); gpr_free(target_name_to_check); - return NULL; + return nullptr; } gpr_free(target_name_to_check); grpc_arg new_security_connector_arg = grpc_security_connector_to_arg(&subchannel_security_connector->base); grpc_channel_args* new_args = grpc_channel_args_copy_and_add( - new_args_from_connector != NULL ? new_args_from_connector : args->args, + new_args_from_connector != nullptr ? new_args_from_connector : args->args, &new_security_connector_arg, 1); GRPC_SECURITY_CONNECTOR_UNREF(exec_ctx, &subchannel_security_connector->base, "lb_channel_create"); - if (new_args_from_connector != NULL) { + if (new_args_from_connector != nullptr) { grpc_channel_args_destroy(exec_ctx, new_args_from_connector); } grpc_subchannel_args* final_sc_args = @@ -140,11 +140,11 @@ static grpc_subchannel* client_channel_factory_create_subchannel( const grpc_subchannel_args* args) { grpc_subchannel_args* subchannel_args = get_secure_naming_subchannel_args(exec_ctx, args); - if (subchannel_args == NULL) { + if (subchannel_args == nullptr) { gpr_log( GPR_ERROR, "Failed to create subchannel arguments during subchannel creation."); - return NULL; + return nullptr; } grpc_connector* connector = grpc_chttp2_connector_create(); grpc_subchannel* s = @@ -160,9 +160,9 @@ static grpc_channel* client_channel_factory_create_channel( grpc_exec_ctx* exec_ctx, grpc_client_channel_factory* cc_factory, const char* target, grpc_client_channel_type type, const grpc_channel_args* args) { - if (target == NULL) { + if (target == nullptr) { gpr_log(GPR_ERROR, "cannot create channel with NULL target name"); - return NULL; + return nullptr; } // Add channel arg containing the server URI. grpc_arg arg = grpc_channel_arg_string_create( @@ -173,7 +173,7 @@ static grpc_channel* client_channel_factory_create_channel( grpc_channel_args_copy_and_add_and_remove(args, to_remove, 1, &arg, 1); gpr_free(arg.value.string); grpc_channel* channel = grpc_channel_create(exec_ctx, target, new_args, - GRPC_CLIENT_CHANNEL, NULL); + GRPC_CLIENT_CHANNEL, nullptr); grpc_channel_args_destroy(exec_ctx, new_args); return channel; } @@ -199,9 +199,9 @@ grpc_channel* grpc_secure_channel_create(grpc_channel_credentials* creds, "grpc_secure_channel_create(creds=%p, target=%s, args=%p, " "reserved=%p)", 4, ((void*)creds, target, (void*)args, (void*)reserved)); - GPR_ASSERT(reserved == NULL); - grpc_channel* channel = NULL; - if (creds != NULL) { + GPR_ASSERT(reserved == nullptr); + grpc_channel* channel = nullptr; + if (creds != nullptr) { // Add channel args containing the client channel factory and channel // credentials. grpc_arg args_to_add[] = { @@ -217,7 +217,7 @@ grpc_channel* grpc_secure_channel_create(grpc_channel_credentials* creds, grpc_channel_args_destroy(&exec_ctx, new_args); grpc_exec_ctx_finish(&exec_ctx); } - return channel != NULL ? channel + return channel != nullptr ? channel : grpc_lame_client_channel_create( target, GRPC_STATUS_INTERNAL, "Failed to create secure client channel"); |