aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/ext
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/ext')
-rw-r--r--src/core/ext/census/grpc_context.cc4
-rw-r--r--src/core/ext/filters/client_channel/backup_poller.cc10
-rw-r--r--src/core/ext/filters/client_channel/channel_connectivity.cc6
-rw-r--r--src/core/ext/filters/client_channel/client_channel.cc228
-rw-r--r--src/core/ext/filters/client_channel/client_channel_plugin.cc6
-rw-r--r--src/core/ext/filters/client_channel/http_connect_handshaker.cc20
-rw-r--r--src/core/ext/filters/client_channel/http_proxy.cc28
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc4
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc220
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc6
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc6
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc14
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc71
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc58
-rw-r--r--src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc23
-rw-r--r--src/core/ext/filters/client_channel/lb_policy_factory.cc20
-rw-r--r--src/core/ext/filters/client_channel/lb_policy_registry.cc4
-rw-r--r--src/core/ext/filters/client_channel/parse_address.cc6
-rw-r--r--src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc79
-rw-r--r--src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h1
-rw-r--r--src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc20
-rw-r--r--src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc60
-rw-r--r--src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc36
-rw-r--r--src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc24
-rw-r--r--src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc18
-rw-r--r--src/core/ext/filters/client_channel/resolver_factory.cc4
-rw-r--r--src/core/ext/filters/client_channel/resolver_registry.cc26
-rw-r--r--src/core/ext/filters/client_channel/retry_throttle.cc20
-rw-r--r--src/core/ext/filters/client_channel/subchannel.cc54
-rw-r--r--src/core/ext/filters/client_channel/subchannel_index.cc10
-rw-r--r--src/core/ext/filters/client_channel/uri_parser.cc16
-rw-r--r--src/core/ext/filters/deadline/deadline_filter.cc6
-rw-r--r--src/core/ext/filters/http/client/http_client_filter.cc16
-rw-r--r--src/core/ext/filters/http/http_filters_plugin.cc6
-rw-r--r--src/core/ext/filters/http/message_compress/message_compress_filter.cc18
-rw-r--r--src/core/ext/filters/http/server/http_server_filter.cc24
-rw-r--r--src/core/ext/filters/load_reporting/server_load_reporting_filter.cc4
-rw-r--r--src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc4
-rw-r--r--src/core/ext/filters/max_age/max_age_filter.cc12
-rw-r--r--src/core/ext/filters/message_size/message_size_filter.cc38
-rw-r--r--src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc16
-rw-r--r--src/core/ext/filters/workarounds/workaround_utils.cc2
-rw-r--r--src/core/ext/transport/chttp2/client/chttp2_connector.cc24
-rw-r--r--src/core/ext/transport/chttp2/client/insecure/channel_create.cc16
-rw-r--r--src/core/ext/transport/chttp2/client/insecure/channel_create_posix.cc10
-rw-r--r--src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc60
-rw-r--r--src/core/ext/transport/chttp2/server/chttp2_server.cc16
-rw-r--r--src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc7
-rw-r--r--src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc8
-rw-r--r--src/core/ext/transport/chttp2/transport/chttp2_transport.cc184
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_data.cc26
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_goaway.cc4
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_window_update.cc4
-rw-r--r--src/core/ext/transport/chttp2/transport/hpack_encoder.cc6
-rw-r--r--src/core/ext/transport/chttp2/transport/hpack_parser.cc26
-rw-r--r--src/core/ext/transport/chttp2/transport/hpack_table.cc2
-rw-r--r--src/core/ext/transport/chttp2/transport/incoming_metadata.cc2
-rw-r--r--src/core/ext/transport/chttp2/transport/parsing.cc38
-rw-r--r--src/core/ext/transport/chttp2/transport/stream_lists.cc12
-rw-r--r--src/core/ext/transport/chttp2/transport/stream_map.cc21
-rw-r--r--src/core/ext/transport/chttp2/transport/writing.cc41
-rw-r--r--src/core/ext/transport/cronet/transport/cronet_api_dummy.cc2
-rw-r--r--src/core/ext/transport/cronet/transport/cronet_transport.cc54
-rw-r--r--src/core/ext/transport/inproc/inproc_transport.cc145
64 files changed, 985 insertions, 971 deletions
diff --git a/src/core/ext/census/grpc_context.cc b/src/core/ext/census/grpc_context.cc
index fb4fcb34a8..ffe7c51ff8 100644
--- a/src/core/ext/census/grpc_context.cc
+++ b/src/core/ext/census/grpc_context.cc
@@ -24,8 +24,8 @@
void grpc_census_call_set_context(grpc_call* call, census_context* context) {
GRPC_API_TRACE("grpc_census_call_set_context(call=%p, census_context=%p)", 2,
(call, context));
- if (context != NULL) {
- grpc_call_context_set(call, GRPC_CONTEXT_TRACING, context, NULL);
+ if (context != nullptr) {
+ grpc_call_context_set(call, GRPC_CONTEXT_TRACING, context, nullptr);
}
}
diff --git a/src/core/ext/filters/client_channel/backup_poller.cc b/src/core/ext/filters/client_channel/backup_poller.cc
index c3795c35c1..ed437d255c 100644
--- a/src/core/ext/filters/client_channel/backup_poller.cc
+++ b/src/core/ext/filters/client_channel/backup_poller.cc
@@ -46,7 +46,7 @@ typedef struct backup_poller {
static gpr_once g_once = GPR_ONCE_INIT;
static gpr_mu g_poller_mu;
-static backup_poller* g_poller = NULL; // guarded by g_poller_mu
+static backup_poller* g_poller = nullptr; // guarded by g_poller_mu
// g_poll_interval_ms is set only once at the first time
// grpc_client_channel_start_backup_polling() is called, after that it is
// treated as const.
@@ -55,7 +55,7 @@ static int g_poll_interval_ms = DEFAULT_POLL_INTERVAL_MS;
static void init_globals() {
gpr_mu_init(&g_poller_mu);
char* env = gpr_getenv("GRPC_CLIENT_CHANNEL_BACKUP_POLL_INTERVAL_MS");
- if (env != NULL) {
+ if (env != nullptr) {
int poll_interval_ms = gpr_parse_nonnegative_int(env);
if (poll_interval_ms == -1) {
gpr_log(GPR_ERROR,
@@ -86,7 +86,7 @@ static void g_poller_unref(grpc_exec_ctx* exec_ctx) {
if (gpr_unref(&g_poller->refs)) {
gpr_mu_lock(&g_poller_mu);
backup_poller* p = g_poller;
- g_poller = NULL;
+ g_poller = nullptr;
gpr_mu_unlock(&g_poller_mu);
gpr_mu_lock(p->pollset_mu);
p->shutting_down = true;
@@ -113,7 +113,7 @@ static void run_poller(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {
backup_poller_shutdown_unref(exec_ctx, p);
return;
}
- grpc_error* err = grpc_pollset_work(exec_ctx, p->pollset, NULL,
+ grpc_error* err = grpc_pollset_work(exec_ctx, p->pollset, nullptr,
grpc_exec_ctx_now(exec_ctx));
gpr_mu_unlock(p->pollset_mu);
GRPC_LOG_IF_ERROR("Run client channel backup poller", err);
@@ -129,7 +129,7 @@ void grpc_client_channel_start_backup_polling(
return;
}
gpr_mu_lock(&g_poller_mu);
- if (g_poller == NULL) {
+ if (g_poller == nullptr) {
g_poller = (backup_poller*)gpr_zalloc(sizeof(backup_poller));
g_poller->pollset = (grpc_pollset*)gpr_zalloc(grpc_pollset_size());
g_poller->shutting_down = false;
diff --git a/src/core/ext/filters/client_channel/channel_connectivity.cc b/src/core/ext/filters/client_channel/channel_connectivity.cc
index 82a5edca93..d3627a237f 100644
--- a/src/core/ext/filters/client_channel/channel_connectivity.cc
+++ b/src/core/ext/filters/client_channel/channel_connectivity.cc
@@ -115,8 +115,8 @@ static void partly_done(grpc_exec_ctx* exec_ctx, state_watcher* w,
grpc_channel_get_channel_stack(w->channel));
grpc_client_channel_watch_connectivity_state(
exec_ctx, client_channel_elem,
- grpc_polling_entity_create_from_pollset(grpc_cq_pollset(w->cq)), NULL,
- &w->on_complete, NULL);
+ grpc_polling_entity_create_from_pollset(grpc_cq_pollset(w->cq)),
+ nullptr, &w->on_complete, nullptr);
}
gpr_mu_lock(&w->mu);
@@ -229,7 +229,7 @@ void grpc_channel_watch_connectivity_state(
w->cq = cq;
w->tag = tag;
w->channel = channel;
- w->error = NULL;
+ w->error = nullptr;
watcher_timer_init_arg* wa =
(watcher_timer_init_arg*)gpr_malloc(sizeof(watcher_timer_init_arg));
diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc
index 584872bfc1..8b8d512432 100644
--- a/src/core/ext/filters/client_channel/client_channel.cc
+++ b/src/core/ext/filters/client_channel/client_channel.cc
@@ -115,7 +115,7 @@ static bool parse_timeout(grpc_json* field, grpc_millis* timeout) {
buf[len - 1] = '\0'; // Remove trailing 's'.
char* decimal_point = strchr(buf, '.');
int nanos = 0;
- if (decimal_point != NULL) {
+ if (decimal_point != nullptr) {
*decimal_point = '\0';
nanos = gpr_parse_nonnegative_int(decimal_point + 1);
if (nanos == -1) {
@@ -141,14 +141,14 @@ static bool parse_timeout(grpc_json* field, grpc_millis* timeout) {
static void* method_parameters_create_from_json(const grpc_json* json) {
wait_for_ready_value wait_for_ready = WAIT_FOR_READY_UNSET;
grpc_millis timeout = 0;
- for (grpc_json* field = json->child; field != NULL; field = field->next) {
- if (field->key == NULL) continue;
+ for (grpc_json* field = json->child; field != nullptr; field = field->next) {
+ if (field->key == nullptr) continue;
if (strcmp(field->key, "waitForReady") == 0) {
- if (wait_for_ready != WAIT_FOR_READY_UNSET) return NULL; // Duplicate.
- if (!parse_wait_for_ready(field, &wait_for_ready)) return NULL;
+ if (wait_for_ready != WAIT_FOR_READY_UNSET) return nullptr; // Duplicate.
+ if (!parse_wait_for_ready(field, &wait_for_ready)) return nullptr;
} else if (strcmp(field->key, "timeout") == 0) {
- if (timeout > 0) return NULL; // Duplicate.
- if (!parse_timeout(field, &timeout)) return NULL;
+ if (timeout > 0) return nullptr; // Duplicate.
+ if (!parse_timeout(field, &timeout)) return nullptr;
}
}
method_parameters* value =
@@ -234,7 +234,7 @@ static void set_channel_connectivity_state_locked(grpc_exec_ctx* exec_ctx,
* - Make it possible for policies to return GRPC_CHANNEL_TRANSIENT_FAILURE.
* - Hand over pending picks from old policies during the switch that happens
* when resolver provides an update. */
- if (chand->lb_policy != NULL) {
+ if (chand->lb_policy != nullptr) {
if (state == GRPC_CHANNEL_TRANSIENT_FAILURE) {
/* cancel picks with wait_for_ready=false */
grpc_lb_policy_cancel_picks_locked(
@@ -266,11 +266,12 @@ static void on_lb_policy_state_changed_locked(grpc_exec_ctx* exec_ctx,
gpr_log(GPR_DEBUG, "chand=%p: lb_policy=%p state changed to %s", w->chand,
w->lb_policy, grpc_connectivity_state_name(w->state));
}
- if (publish_state == GRPC_CHANNEL_SHUTDOWN && w->chand->resolver != NULL) {
+ if (publish_state == GRPC_CHANNEL_SHUTDOWN &&
+ w->chand->resolver != nullptr) {
publish_state = GRPC_CHANNEL_TRANSIENT_FAILURE;
grpc_resolver_channel_saw_error_locked(exec_ctx, w->chand->resolver);
GRPC_LB_POLICY_UNREF(exec_ctx, w->chand->lb_policy, "channel");
- w->chand->lb_policy = NULL;
+ w->chand->lb_policy = nullptr;
}
set_channel_connectivity_state_locked(exec_ctx, w->chand, publish_state,
GRPC_ERROR_REF(error), "lb_changed");
@@ -318,13 +319,13 @@ static void parse_retry_throttle_params(const grpc_json* field, void* arg) {
service_config_parsing_state* parsing_state =
(service_config_parsing_state*)arg;
if (strcmp(field->key, "retryThrottling") == 0) {
- if (parsing_state->retry_throttle_data != NULL) return; // Duplicate.
+ if (parsing_state->retry_throttle_data != nullptr) return; // Duplicate.
if (field->type != GRPC_JSON_OBJECT) return;
int max_milli_tokens = 0;
int milli_token_ratio = 0;
- for (grpc_json* sub_field = field->child; sub_field != NULL;
+ for (grpc_json* sub_field = field->child; sub_field != nullptr;
sub_field = sub_field->next) {
- if (sub_field->key == NULL) return;
+ if (sub_field->key == nullptr) return;
if (strcmp(sub_field->key, "maxTokens") == 0) {
if (max_milli_tokens != 0) return; // Duplicate.
if (sub_field->type != GRPC_JSON_NUMBER) return;
@@ -339,7 +340,7 @@ static void parse_retry_throttle_params(const grpc_json* field, void* arg) {
uint32_t multiplier = 1;
uint32_t decimal_value = 0;
const char* decimal_point = strchr(sub_field->value, '.');
- if (decimal_point != NULL) {
+ if (decimal_point != nullptr) {
whole_len = (size_t)(decimal_point - sub_field->value);
multiplier = 1000;
size_t decimal_len = strlen(decimal_point + 1);
@@ -378,18 +379,18 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx* exec_ctx,
}
// Extract the following fields from the resolver result, if non-NULL.
bool lb_policy_updated = false;
- char* lb_policy_name_dup = NULL;
+ char* lb_policy_name_dup = nullptr;
bool lb_policy_name_changed = false;
- grpc_lb_policy* new_lb_policy = NULL;
- char* service_config_json = NULL;
- grpc_server_retry_throttle_data* retry_throttle_data = NULL;
- grpc_slice_hash_table* method_params_table = NULL;
- if (chand->resolver_result != NULL) {
+ grpc_lb_policy* new_lb_policy = nullptr;
+ char* service_config_json = nullptr;
+ grpc_server_retry_throttle_data* retry_throttle_data = nullptr;
+ grpc_slice_hash_table* method_params_table = nullptr;
+ if (chand->resolver_result != nullptr) {
// Find LB policy name.
- const char* lb_policy_name = NULL;
+ const char* lb_policy_name = nullptr;
const grpc_arg* channel_arg =
grpc_channel_args_find(chand->resolver_result, GRPC_ARG_LB_POLICY_NAME);
- if (channel_arg != NULL) {
+ if (channel_arg != nullptr) {
GPR_ASSERT(channel_arg->type == GRPC_ARG_STRING);
lb_policy_name = channel_arg->value.string;
}
@@ -397,7 +398,7 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx* exec_ctx,
// the grpclb policy, regardless of what the resolver actually specified.
channel_arg =
grpc_channel_args_find(chand->resolver_result, GRPC_ARG_LB_ADDRESSES);
- if (channel_arg != NULL && channel_arg->type == GRPC_ARG_POINTER) {
+ if (channel_arg != nullptr && channel_arg->type == GRPC_ARG_POINTER) {
grpc_lb_addresses* addresses =
(grpc_lb_addresses*)channel_arg->value.pointer.p;
bool found_balancer_address = false;
@@ -408,7 +409,8 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx* exec_ctx,
}
}
if (found_balancer_address) {
- if (lb_policy_name != NULL && strcmp(lb_policy_name, "grpclb") != 0) {
+ if (lb_policy_name != nullptr &&
+ strcmp(lb_policy_name, "grpclb") != 0) {
gpr_log(GPR_INFO,
"resolver requested LB policy %s but provided at least one "
"balancer address -- forcing use of grpclb LB policy",
@@ -419,7 +421,7 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx* exec_ctx,
}
// Use pick_first if nothing was specified and we didn't select grpclb
// above.
- if (lb_policy_name == NULL) lb_policy_name = "pick_first";
+ if (lb_policy_name == nullptr) lb_policy_name = "pick_first";
grpc_lb_policy_args lb_policy_args;
lb_policy_args.args = chand->resolver_result;
lb_policy_args.client_channel_factory = chand->client_channel_factory;
@@ -430,9 +432,9 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx* exec_ctx,
// only thing that modifies its value, and it can only be invoked
// once at any given time.
lb_policy_name_changed =
- chand->info_lb_policy_name == NULL ||
+ chand->info_lb_policy_name == nullptr ||
strcmp(chand->info_lb_policy_name, lb_policy_name) != 0;
- if (chand->lb_policy != NULL && !lb_policy_name_changed) {
+ if (chand->lb_policy != nullptr && !lb_policy_name_changed) {
// Continue using the same LB policy. Update with new addresses.
lb_policy_updated = true;
grpc_lb_policy_update_locked(exec_ctx, chand->lb_policy, &lb_policy_args);
@@ -440,22 +442,22 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx* exec_ctx,
// Instantiate new LB policy.
new_lb_policy =
grpc_lb_policy_create(exec_ctx, lb_policy_name, &lb_policy_args);
- if (new_lb_policy == NULL) {
+ if (new_lb_policy == nullptr) {
gpr_log(GPR_ERROR, "could not create LB policy \"%s\"", lb_policy_name);
}
}
// Find service config.
channel_arg =
grpc_channel_args_find(chand->resolver_result, GRPC_ARG_SERVICE_CONFIG);
- if (channel_arg != NULL) {
+ if (channel_arg != nullptr) {
GPR_ASSERT(channel_arg->type == GRPC_ARG_STRING);
service_config_json = gpr_strdup(channel_arg->value.string);
grpc_service_config* service_config =
grpc_service_config_create(service_config_json);
- if (service_config != NULL) {
+ if (service_config != nullptr) {
channel_arg =
grpc_channel_args_find(chand->resolver_result, GRPC_ARG_SERVER_URI);
- GPR_ASSERT(channel_arg != NULL);
+ GPR_ASSERT(channel_arg != nullptr);
GPR_ASSERT(channel_arg->type == GRPC_ARG_STRING);
grpc_uri* uri =
grpc_uri_parse(exec_ctx, channel_arg->value.string, true);
@@ -479,7 +481,7 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx* exec_ctx,
// The copy will be saved in chand->lb_policy_name below.
lb_policy_name_dup = gpr_strdup(lb_policy_name);
grpc_channel_args_destroy(exec_ctx, chand->resolver_result);
- chand->resolver_result = NULL;
+ chand->resolver_result = nullptr;
}
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
gpr_log(GPR_DEBUG,
@@ -494,22 +496,22 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx* exec_ctx,
//
// First, swap out the data used by cc_get_channel_info().
gpr_mu_lock(&chand->info_mu);
- if (lb_policy_name_dup != NULL) {
+ if (lb_policy_name_dup != nullptr) {
gpr_free(chand->info_lb_policy_name);
chand->info_lb_policy_name = lb_policy_name_dup;
}
- if (service_config_json != NULL) {
+ if (service_config_json != nullptr) {
gpr_free(chand->info_service_config_json);
chand->info_service_config_json = service_config_json;
}
gpr_mu_unlock(&chand->info_mu);
// Swap out the retry throttle data.
- if (chand->retry_throttle_data != NULL) {
+ if (chand->retry_throttle_data != nullptr) {
grpc_server_retry_throttle_data_unref(chand->retry_throttle_data);
}
chand->retry_throttle_data = retry_throttle_data;
// Swap out the method params table.
- if (chand->method_params_table != NULL) {
+ if (chand->method_params_table != nullptr) {
grpc_slice_hash_table_unref(exec_ctx, chand->method_params_table);
}
chand->method_params_table = method_params_table;
@@ -519,9 +521,9 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx* exec_ctx,
// Note that we do NOT do this if either (a) we updated the existing
// LB policy above or (b) we failed to create the new LB policy (in
// which case we want to continue using the most recent one we had).
- if (new_lb_policy != NULL || error != GRPC_ERROR_NONE ||
- chand->resolver == NULL) {
- if (chand->lb_policy != NULL) {
+ if (new_lb_policy != nullptr || error != GRPC_ERROR_NONE ||
+ chand->resolver == nullptr) {
+ if (chand->lb_policy != nullptr) {
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
gpr_log(GPR_DEBUG, "chand=%p: unreffing lb_policy=%p", chand,
chand->lb_policy);
@@ -535,17 +537,17 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx* exec_ctx,
}
// Now that we've swapped out the relevant fields of chand, check for
// error or shutdown.
- if (error != GRPC_ERROR_NONE || chand->resolver == NULL) {
+ if (error != GRPC_ERROR_NONE || chand->resolver == nullptr) {
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
gpr_log(GPR_DEBUG, "chand=%p: shutting down", chand);
}
- if (chand->resolver != NULL) {
+ if (chand->resolver != nullptr) {
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
gpr_log(GPR_DEBUG, "chand=%p: shutting down resolver", chand);
}
grpc_resolver_shutdown_locked(exec_ctx, chand->resolver);
GRPC_RESOLVER_UNREF(exec_ctx, chand->resolver, "channel");
- chand->resolver = NULL;
+ chand->resolver = nullptr;
}
set_channel_connectivity_state_locked(
exec_ctx, chand, GRPC_CHANNEL_SHUTDOWN,
@@ -562,7 +564,7 @@ static void on_resolver_result_changed_locked(grpc_exec_ctx* exec_ctx,
grpc_connectivity_state state = GRPC_CHANNEL_TRANSIENT_FAILURE;
grpc_error* state_error =
GRPC_ERROR_CREATE_FROM_STATIC_STRING("No load balancing policy");
- if (new_lb_policy != NULL) {
+ if (new_lb_policy != nullptr) {
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
gpr_log(GPR_DEBUG, "chand=%p: initializing new LB policy", chand);
}
@@ -599,46 +601,46 @@ static void start_transport_op_locked(grpc_exec_ctx* exec_ctx, void* arg,
(grpc_channel_element*)op->handler_private.extra_arg;
channel_data* chand = (channel_data*)elem->channel_data;
- if (op->on_connectivity_state_change != NULL) {
+ if (op->on_connectivity_state_change != nullptr) {
grpc_connectivity_state_notify_on_state_change(
exec_ctx, &chand->state_tracker, op->connectivity_state,
op->on_connectivity_state_change);
- op->on_connectivity_state_change = NULL;
- op->connectivity_state = NULL;
+ op->on_connectivity_state_change = nullptr;
+ op->connectivity_state = nullptr;
}
- if (op->send_ping != NULL) {
- if (chand->lb_policy == NULL) {
+ if (op->send_ping != nullptr) {
+ if (chand->lb_policy == nullptr) {
GRPC_CLOSURE_SCHED(
exec_ctx, op->send_ping,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Ping with no load balancing"));
} else {
grpc_lb_policy_ping_one_locked(exec_ctx, chand->lb_policy, op->send_ping);
- op->bind_pollset = NULL;
+ op->bind_pollset = nullptr;
}
- op->send_ping = NULL;
+ op->send_ping = nullptr;
}
if (op->disconnect_with_error != GRPC_ERROR_NONE) {
- if (chand->resolver != NULL) {
+ if (chand->resolver != nullptr) {
set_channel_connectivity_state_locked(
exec_ctx, chand, GRPC_CHANNEL_SHUTDOWN,
GRPC_ERROR_REF(op->disconnect_with_error), "disconnect");
grpc_resolver_shutdown_locked(exec_ctx, chand->resolver);
GRPC_RESOLVER_UNREF(exec_ctx, chand->resolver, "channel");
- chand->resolver = NULL;
+ chand->resolver = nullptr;
if (!chand->started_resolving) {
grpc_closure_list_fail_all(&chand->waiting_for_resolver_result_closures,
GRPC_ERROR_REF(op->disconnect_with_error));
GRPC_CLOSURE_LIST_SCHED(exec_ctx,
&chand->waiting_for_resolver_result_closures);
}
- if (chand->lb_policy != NULL) {
+ if (chand->lb_policy != nullptr) {
grpc_pollset_set_del_pollset_set(exec_ctx,
chand->lb_policy->interested_parties,
chand->interested_parties);
GRPC_LB_POLICY_UNREF(exec_ctx, chand->lb_policy, "channel");
- chand->lb_policy = NULL;
+ chand->lb_policy = nullptr;
}
}
GRPC_ERROR_UNREF(op->disconnect_with_error);
@@ -654,7 +656,7 @@ static void cc_start_transport_op(grpc_exec_ctx* exec_ctx,
channel_data* chand = (channel_data*)elem->channel_data;
GPR_ASSERT(op->set_accept_stream == false);
- if (op->bind_pollset != NULL) {
+ if (op->bind_pollset != nullptr) {
grpc_pollset_set_add_pollset(exec_ctx, chand->interested_parties,
op->bind_pollset);
}
@@ -673,15 +675,15 @@ static void cc_get_channel_info(grpc_exec_ctx* exec_ctx,
const grpc_channel_info* info) {
channel_data* chand = (channel_data*)elem->channel_data;
gpr_mu_lock(&chand->info_mu);
- if (info->lb_policy_name != NULL) {
- *info->lb_policy_name = chand->info_lb_policy_name == NULL
- ? NULL
+ if (info->lb_policy_name != nullptr) {
+ *info->lb_policy_name = chand->info_lb_policy_name == nullptr
+ ? nullptr
: gpr_strdup(chand->info_lb_policy_name);
}
- if (info->service_config_json != NULL) {
+ if (info->service_config_json != nullptr) {
*info->service_config_json =
- chand->info_service_config_json == NULL
- ? NULL
+ chand->info_service_config_json == nullptr
+ ? nullptr
: gpr_strdup(chand->info_service_config_json);
}
gpr_mu_unlock(&chand->info_mu);
@@ -700,7 +702,7 @@ static grpc_error* cc_init_channel_elem(grpc_exec_ctx* exec_ctx,
gpr_mu_init(&chand->external_connectivity_watcher_list_mu);
gpr_mu_lock(&chand->external_connectivity_watcher_list_mu);
- chand->external_connectivity_watcher_list_head = NULL;
+ chand->external_connectivity_watcher_list_head = nullptr;
gpr_mu_unlock(&chand->external_connectivity_watcher_list_mu);
chand->owning_stack = args->channel_stack;
@@ -714,7 +716,7 @@ static grpc_error* cc_init_channel_elem(grpc_exec_ctx* exec_ctx,
// Record client channel factory.
const grpc_arg* arg = grpc_channel_args_find(args->channel_args,
GRPC_ARG_CLIENT_CHANNEL_FACTORY);
- if (arg == NULL) {
+ if (arg == nullptr) {
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"Missing client channel factory in args for client channel filter");
}
@@ -728,7 +730,7 @@ static grpc_error* cc_init_channel_elem(grpc_exec_ctx* exec_ctx,
(grpc_client_channel_factory*)arg->value.pointer.p;
// Get server name to resolve, using proxy mapper if needed.
arg = grpc_channel_args_find(args->channel_args, GRPC_ARG_SERVER_URI);
- if (arg == NULL) {
+ if (arg == nullptr) {
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"Missing server uri in args for client channel filter");
}
@@ -736,18 +738,18 @@ static grpc_error* cc_init_channel_elem(grpc_exec_ctx* exec_ctx,
return GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"server uri arg must be a string");
}
- char* proxy_name = NULL;
- grpc_channel_args* new_args = NULL;
+ char* proxy_name = nullptr;
+ grpc_channel_args* new_args = nullptr;
grpc_proxy_mappers_map_name(exec_ctx, arg->value.string, args->channel_args,
&proxy_name, &new_args);
// Instantiate resolver.
chand->resolver = grpc_resolver_create(
- exec_ctx, proxy_name != NULL ? proxy_name : arg->value.string,
- new_args != NULL ? new_args : args->channel_args,
+ exec_ctx, proxy_name != nullptr ? proxy_name : arg->value.string,
+ new_args != nullptr ? new_args : args->channel_args,
chand->interested_parties, chand->combiner);
- if (proxy_name != NULL) gpr_free(proxy_name);
- if (new_args != NULL) grpc_channel_args_destroy(exec_ctx, new_args);
- if (chand->resolver == NULL) {
+ if (proxy_name != nullptr) gpr_free(proxy_name);
+ if (new_args != nullptr) grpc_channel_args_destroy(exec_ctx, new_args);
+ if (chand->resolver == nullptr) {
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("resolver creation failed");
}
chand->deadline_checking_enabled =
@@ -766,17 +768,17 @@ static void shutdown_resolver_locked(grpc_exec_ctx* exec_ctx, void* arg,
static void cc_destroy_channel_elem(grpc_exec_ctx* exec_ctx,
grpc_channel_element* elem) {
channel_data* chand = (channel_data*)elem->channel_data;
- if (chand->resolver != NULL) {
+ if (chand->resolver != nullptr) {
GRPC_CLOSURE_SCHED(
exec_ctx,
GRPC_CLOSURE_CREATE(shutdown_resolver_locked, chand->resolver,
grpc_combiner_scheduler(chand->combiner)),
GRPC_ERROR_NONE);
}
- if (chand->client_channel_factory != NULL) {
+ if (chand->client_channel_factory != nullptr) {
grpc_client_channel_factory_unref(exec_ctx, chand->client_channel_factory);
}
- if (chand->lb_policy != NULL) {
+ if (chand->lb_policy != nullptr) {
grpc_pollset_set_del_pollset_set(exec_ctx,
chand->lb_policy->interested_parties,
chand->interested_parties);
@@ -784,10 +786,10 @@ static void cc_destroy_channel_elem(grpc_exec_ctx* exec_ctx,
}
gpr_free(chand->info_lb_policy_name);
gpr_free(chand->info_service_config_json);
- if (chand->retry_throttle_data != NULL) {
+ if (chand->retry_throttle_data != nullptr) {
grpc_server_retry_throttle_data_unref(chand->retry_throttle_data);
}
- if (chand->method_params_table != NULL) {
+ if (chand->method_params_table != nullptr) {
grpc_slice_hash_table_unref(exec_ctx, chand->method_params_table);
}
grpc_client_channel_stop_backup_polling(exec_ctx, chand->interested_parties);
@@ -870,7 +872,7 @@ grpc_subchannel_call* grpc_client_channel_get_subchannel_call(
static void waiting_for_pick_batches_add(
call_data* calld, grpc_transport_stream_op_batch* batch) {
if (batch->send_initial_metadata) {
- GPR_ASSERT(calld->initial_metadata_batch == NULL);
+ GPR_ASSERT(calld->initial_metadata_batch == nullptr);
calld->initial_metadata_batch = batch;
} else {
GPR_ASSERT(calld->waiting_for_pick_batches_count < MAX_WAITING_BATCHES);
@@ -912,7 +914,7 @@ static void waiting_for_pick_batches_fail(grpc_exec_ctx* exec_ctx,
GRPC_ERROR_REF(error),
"waiting_for_pick_batches_fail");
}
- if (calld->initial_metadata_batch != NULL) {
+ if (calld->initial_metadata_batch != nullptr) {
grpc_transport_stream_op_batch_finish_with_failure(
exec_ctx, calld->initial_metadata_batch, GRPC_ERROR_REF(error),
calld->call_combiner);
@@ -956,7 +958,7 @@ static void waiting_for_pick_batches_resume(grpc_exec_ctx* exec_ctx,
GRPC_ERROR_NONE,
"waiting_for_pick_batches_resume");
}
- GPR_ASSERT(calld->initial_metadata_batch != NULL);
+ GPR_ASSERT(calld->initial_metadata_batch != nullptr);
grpc_subchannel_call_process_op(exec_ctx, calld->subchannel_call,
calld->initial_metadata_batch);
}
@@ -971,14 +973,14 @@ static void apply_service_config_to_call_locked(grpc_exec_ctx* exec_ctx,
gpr_log(GPR_DEBUG, "chand=%p calld=%p: applying service config to call",
chand, calld);
}
- if (chand->retry_throttle_data != NULL) {
+ if (chand->retry_throttle_data != nullptr) {
calld->retry_throttle_data =
grpc_server_retry_throttle_data_ref(chand->retry_throttle_data);
}
- if (chand->method_params_table != NULL) {
+ if (chand->method_params_table != nullptr) {
calld->method_params = (method_parameters*)grpc_method_config_table_get(
exec_ctx, chand->method_params_table, calld->path);
- if (calld->method_params != NULL) {
+ if (calld->method_params != nullptr) {
method_parameters_ref(calld->method_params);
// If the deadline from the service config is shorter than the one
// from the client API, reset the deadline timer.
@@ -1031,7 +1033,7 @@ static void pick_done_locked(grpc_exec_ctx* exec_ctx, grpc_call_element* elem,
grpc_error* error) {
call_data* calld = (call_data*)elem->call_data;
channel_data* chand = (channel_data*)elem->channel_data;
- if (calld->connected_subchannel == NULL) {
+ if (calld->connected_subchannel == nullptr) {
// Failed to create subchannel.
GRPC_ERROR_UNREF(calld->error);
calld->error = error == GRPC_ERROR_NONE
@@ -1072,7 +1074,7 @@ static void pick_callback_cancel_locked(grpc_exec_ctx* exec_ctx, void* arg,
grpc_call_element* elem = (grpc_call_element*)arg;
channel_data* chand = (channel_data*)elem->channel_data;
call_data* calld = (call_data*)elem->call_data;
- if (calld->lb_policy != NULL) {
+ if (calld->lb_policy != nullptr) {
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
gpr_log(GPR_DEBUG, "chand=%p calld=%p: cancelling pick from LB policy %p",
chand, calld, calld->lb_policy);
@@ -1095,9 +1097,9 @@ static void pick_callback_done_locked(grpc_exec_ctx* exec_ctx, void* arg,
gpr_log(GPR_DEBUG, "chand=%p calld=%p: pick completed asynchronously",
chand, calld);
}
- GPR_ASSERT(calld->lb_policy != NULL);
+ GPR_ASSERT(calld->lb_policy != nullptr);
GRPC_LB_POLICY_UNREF(exec_ctx, calld->lb_policy, "pick_subchannel");
- calld->lb_policy = NULL;
+ calld->lb_policy = nullptr;
async_pick_done_locked(exec_ctx, elem, GRPC_ERROR_REF(error));
}
@@ -1123,7 +1125,7 @@ static bool pick_callback_start_locked(grpc_exec_ctx* exec_ctx,
initial_metadata_flags &
GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET;
const bool wait_for_ready_set_from_service_config =
- calld->method_params != NULL &&
+ calld->method_params != nullptr &&
calld->method_params->wait_for_ready != WAIT_FOR_READY_UNSET;
if (!wait_for_ready_set_from_api && wait_for_ready_set_from_service_config) {
if (calld->method_params->wait_for_ready == WAIT_FOR_READY_TRUE) {
@@ -1143,7 +1145,7 @@ static bool pick_callback_start_locked(grpc_exec_ctx* exec_ctx,
grpc_combiner_scheduler(chand->combiner));
const bool pick_done = grpc_lb_policy_pick_locked(
exec_ctx, chand->lb_policy, &inputs, &calld->connected_subchannel,
- calld->subchannel_call_context, NULL, &calld->lb_pick_closure);
+ calld->subchannel_call_context, nullptr, &calld->lb_pick_closure);
if (pick_done) {
/* synchronous grpc_lb_policy_pick call. Unref the LB policy. */
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
@@ -1151,7 +1153,7 @@ static bool pick_callback_start_locked(grpc_exec_ctx* exec_ctx,
chand, calld);
}
GRPC_LB_POLICY_UNREF(exec_ctx, calld->lb_policy, "pick_subchannel");
- calld->lb_policy = NULL;
+ calld->lb_policy = nullptr;
} else {
GRPC_CALL_STACK_REF(calld->owning_call, "pick_callback_cancel");
grpc_call_combiner_set_notify_on_cancel(
@@ -1231,7 +1233,7 @@ static void pick_after_resolver_result_done_locked(grpc_exec_ctx* exec_ctx,
chand, calld);
}
async_pick_done_locked(exec_ctx, elem, GRPC_ERROR_REF(error));
- } else if (chand->lb_policy != NULL) {
+ } else if (chand->lb_policy != nullptr) {
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
gpr_log(GPR_DEBUG, "chand=%p calld=%p: resolver returned, doing pick",
chand, calld);
@@ -1252,7 +1254,7 @@ static void pick_after_resolver_result_done_locked(grpc_exec_ctx* exec_ctx,
// removed in https://github.com/grpc/grpc/pull/12297. Need to figure
// out what is actually causing this to occur and then figure out the
// right way to deal with it.
- else if (chand->resolver != NULL) {
+ else if (chand->resolver != nullptr) {
// No LB policy, so try again.
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
gpr_log(GPR_DEBUG,
@@ -1299,8 +1301,8 @@ static void start_pick_locked(grpc_exec_ctx* exec_ctx, void* arg,
grpc_call_element* elem = (grpc_call_element*)arg;
call_data* calld = (call_data*)elem->call_data;
channel_data* chand = (channel_data*)elem->channel_data;
- GPR_ASSERT(calld->connected_subchannel == NULL);
- if (chand->lb_policy != NULL) {
+ GPR_ASSERT(calld->connected_subchannel == nullptr);
+ if (chand->lb_policy != nullptr) {
// We already have an LB policy, so ask it for a pick.
if (pick_callback_start_locked(exec_ctx, elem)) {
// Pick completed synchronously.
@@ -1309,7 +1311,7 @@ static void start_pick_locked(grpc_exec_ctx* exec_ctx, void* arg,
}
} else {
// We do not yet have an LB policy, so wait for a resolver result.
- if (chand->resolver == NULL) {
+ if (chand->resolver == nullptr) {
pick_done_locked(exec_ctx, elem,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Disconnected"));
return;
@@ -1331,7 +1333,7 @@ static void start_pick_locked(grpc_exec_ctx* exec_ctx, void* arg,
static void on_complete(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {
grpc_call_element* elem = (grpc_call_element*)arg;
call_data* calld = (call_data*)elem->call_data;
- if (calld->retry_throttle_data != NULL) {
+ if (calld->retry_throttle_data != nullptr) {
if (error == GRPC_ERROR_NONE) {
grpc_server_retry_throttle_data_record_success(
calld->retry_throttle_data);
@@ -1382,7 +1384,7 @@ static void cc_start_transport_stream_op_batch(
}
// If we have a subchannel call, send the cancellation batch down.
// Otherwise, fail all pending batches.
- if (calld->subchannel_call != NULL) {
+ if (calld->subchannel_call != nullptr) {
grpc_subchannel_call_process_op(exec_ctx, calld->subchannel_call, batch);
} else {
waiting_for_pick_batches_add(calld, batch);
@@ -1394,7 +1396,7 @@ static void cc_start_transport_stream_op_batch(
// Intercept on_complete for recv_trailing_metadata so that we can
// check retry throttle status.
if (batch->recv_trailing_metadata) {
- GPR_ASSERT(batch->on_complete != NULL);
+ GPR_ASSERT(batch->on_complete != nullptr);
calld->original_on_complete = batch->on_complete;
GRPC_CLOSURE_INIT(&calld->on_complete, on_complete, elem,
grpc_schedule_on_exec_ctx);
@@ -1404,7 +1406,7 @@ static void cc_start_transport_stream_op_batch(
// Note that once we have completed the pick, we do not need to enter
// the channel combiner, which is more efficient (especially for
// streaming calls).
- if (calld->subchannel_call != NULL) {
+ if (calld->subchannel_call != nullptr) {
if (GRPC_TRACER_ON(grpc_client_channel_trace)) {
gpr_log(GPR_DEBUG,
"chand=%p calld=%p: sending batch to subchannel_call=%p", chand,
@@ -1473,25 +1475,25 @@ static void cc_destroy_call_elem(grpc_exec_ctx* exec_ctx,
grpc_deadline_state_destroy(exec_ctx, elem);
}
grpc_slice_unref_internal(exec_ctx, calld->path);
- if (calld->method_params != NULL) {
+ if (calld->method_params != nullptr) {
method_parameters_unref(calld->method_params);
}
GRPC_ERROR_UNREF(calld->error);
- if (calld->subchannel_call != NULL) {
+ if (calld->subchannel_call != nullptr) {
grpc_subchannel_call_set_cleanup_closure(calld->subchannel_call,
then_schedule_closure);
- then_schedule_closure = NULL;
+ then_schedule_closure = nullptr;
GRPC_SUBCHANNEL_CALL_UNREF(exec_ctx, calld->subchannel_call,
"client_channel_destroy_call");
}
- GPR_ASSERT(calld->lb_policy == NULL);
+ GPR_ASSERT(calld->lb_policy == nullptr);
GPR_ASSERT(calld->waiting_for_pick_batches_count == 0);
- if (calld->connected_subchannel != NULL) {
+ if (calld->connected_subchannel != nullptr) {
GRPC_CONNECTED_SUBCHANNEL_UNREF(exec_ctx, calld->connected_subchannel,
"picked");
}
for (size_t i = 0; i < GRPC_CONTEXT_COUNT; ++i) {
- if (calld->subchannel_call_context[i].value != NULL) {
+ if (calld->subchannel_call_context[i].value != nullptr) {
calld->subchannel_call_context[i].destroy(
calld->subchannel_call_context[i].value);
}
@@ -1527,11 +1529,11 @@ const grpc_channel_filter grpc_client_channel_filter = {
static void try_to_connect_locked(grpc_exec_ctx* exec_ctx, void* arg,
grpc_error* error_ignored) {
channel_data* chand = (channel_data*)arg;
- if (chand->lb_policy != NULL) {
+ if (chand->lb_policy != nullptr) {
grpc_lb_policy_exit_idle_locked(exec_ctx, chand->lb_policy);
} else {
chand->exit_idle_when_lb_policy_arrives = true;
- if (!chand->started_resolving && chand->resolver != NULL) {
+ if (!chand->started_resolving && chand->resolver != nullptr) {
start_resolving_locked(exec_ctx, chand);
}
}
@@ -1569,7 +1571,7 @@ static external_connectivity_watcher* lookup_external_connectivity_watcher(
gpr_mu_lock(&chand->external_connectivity_watcher_list_mu);
external_connectivity_watcher* w =
chand->external_connectivity_watcher_list_head;
- while (w != NULL && w->on_complete != on_complete) {
+ while (w != nullptr && w->on_complete != on_complete) {
w = w->next;
}
gpr_mu_unlock(&chand->external_connectivity_watcher_list_mu);
@@ -1599,7 +1601,7 @@ static void external_connectivity_watcher_list_remove(
}
external_connectivity_watcher* w =
chand->external_connectivity_watcher_list_head;
- while (w != NULL) {
+ while (w != nullptr) {
if (w->next == too_remove) {
w->next = w->next->next;
gpr_mu_unlock(&chand->external_connectivity_watcher_list_mu);
@@ -1618,7 +1620,7 @@ int grpc_client_channel_num_external_connectivity_watchers(
gpr_mu_lock(&chand->external_connectivity_watcher_list_mu);
external_connectivity_watcher* w =
chand->external_connectivity_watcher_list_head;
- while (w != NULL) {
+ while (w != nullptr) {
count++;
w = w->next;
}
@@ -1643,8 +1645,8 @@ static void on_external_watch_complete_locked(grpc_exec_ctx* exec_ctx,
static void watch_connectivity_state_locked(grpc_exec_ctx* exec_ctx, void* arg,
grpc_error* error_ignored) {
external_connectivity_watcher* w = (external_connectivity_watcher*)arg;
- external_connectivity_watcher* found = NULL;
- if (w->state != NULL) {
+ external_connectivity_watcher* found = nullptr;
+ if (w->state != nullptr) {
external_connectivity_watcher_list_append(w->chand, w);
GRPC_CLOSURE_RUN(exec_ctx, w->watcher_timer_init, GRPC_ERROR_NONE);
GRPC_CLOSURE_INIT(&w->my_closure, on_external_watch_complete_locked, w,
@@ -1652,12 +1654,12 @@ static void watch_connectivity_state_locked(grpc_exec_ctx* exec_ctx, void* arg,
grpc_connectivity_state_notify_on_state_change(
exec_ctx, &w->chand->state_tracker, w->state, &w->my_closure);
} else {
- GPR_ASSERT(w->watcher_timer_init == NULL);
+ GPR_ASSERT(w->watcher_timer_init == nullptr);
found = lookup_external_connectivity_watcher(w->chand, w->on_complete);
if (found) {
GPR_ASSERT(found->on_complete == w->on_complete);
grpc_connectivity_state_notify_on_state_change(
- exec_ctx, &found->chand->state_tracker, NULL, &found->my_closure);
+ exec_ctx, &found->chand->state_tracker, nullptr, &found->my_closure);
}
grpc_polling_entity_del_from_pollset_set(exec_ctx, &w->pollent,
w->chand->interested_parties);
diff --git a/src/core/ext/filters/client_channel/client_channel_plugin.cc b/src/core/ext/filters/client_channel/client_channel_plugin.cc
index 0db894913c..eebef6827c 100644
--- a/src/core/ext/filters/client_channel/client_channel_plugin.cc
+++ b/src/core/ext/filters/client_channel/client_channel_plugin.cc
@@ -37,7 +37,7 @@
static bool append_filter(grpc_exec_ctx* exec_ctx,
grpc_channel_stack_builder* builder, void* arg) {
return grpc_channel_stack_builder_append_filter(
- builder, (const grpc_channel_filter*)arg, NULL, NULL);
+ builder, (const grpc_channel_filter*)arg, nullptr, nullptr);
}
static bool set_default_host_if_unset(grpc_exec_ctx* exec_ctx,
@@ -53,7 +53,7 @@ static bool set_default_host_if_unset(grpc_exec_ctx* exec_ctx,
}
char* default_authority = grpc_get_default_authority(
exec_ctx, grpc_channel_stack_builder_get_target(builder));
- if (default_authority != NULL) {
+ if (default_authority != nullptr) {
grpc_arg arg = grpc_channel_arg_string_create(
(char*)GRPC_ARG_DEFAULT_AUTHORITY, default_authority);
grpc_channel_args* new_args = grpc_channel_args_copy_and_add(args, &arg, 1);
@@ -73,7 +73,7 @@ extern "C" void grpc_client_channel_init(void) {
grpc_register_http_proxy_mapper();
grpc_subchannel_index_init();
grpc_channel_init_register_stage(GRPC_CLIENT_CHANNEL, INT_MIN,
- set_default_host_if_unset, NULL);
+ set_default_host_if_unset, nullptr);
grpc_channel_init_register_stage(
GRPC_CLIENT_CHANNEL, GRPC_CHANNEL_INIT_BUILTIN_PRIORITY, append_filter,
(void*)&grpc_client_channel_filter);
diff --git a/src/core/ext/filters/client_channel/http_connect_handshaker.cc b/src/core/ext/filters/client_channel/http_connect_handshaker.cc
index 418bb41ef6..b7cb2e3eba 100644
--- a/src/core/ext/filters/client_channel/http_connect_handshaker.cc
+++ b/src/core/ext/filters/client_channel/http_connect_handshaker.cc
@@ -65,10 +65,10 @@ static void http_connect_handshaker_unref(grpc_exec_ctx* exec_ctx,
http_connect_handshaker* handshaker) {
if (gpr_unref(&handshaker->refcount)) {
gpr_mu_destroy(&handshaker->mu);
- if (handshaker->endpoint_to_destroy != NULL) {
+ if (handshaker->endpoint_to_destroy != nullptr) {
grpc_endpoint_destroy(exec_ctx, handshaker->endpoint_to_destroy);
}
- if (handshaker->read_buffer_to_destroy != NULL) {
+ if (handshaker->read_buffer_to_destroy != nullptr) {
grpc_slice_buffer_destroy_internal(exec_ctx,
handshaker->read_buffer_to_destroy);
gpr_free(handshaker->read_buffer_to_destroy);
@@ -85,11 +85,11 @@ static void http_connect_handshaker_unref(grpc_exec_ctx* exec_ctx,
static void cleanup_args_for_failure_locked(
grpc_exec_ctx* exec_ctx, http_connect_handshaker* handshaker) {
handshaker->endpoint_to_destroy = handshaker->args->endpoint;
- handshaker->args->endpoint = NULL;
+ handshaker->args->endpoint = nullptr;
handshaker->read_buffer_to_destroy = handshaker->args->read_buffer;
- handshaker->args->read_buffer = NULL;
+ handshaker->args->read_buffer = nullptr;
grpc_channel_args_destroy(exec_ctx, handshaker->args->args);
- handshaker->args->args = NULL;
+ handshaker->args->args = nullptr;
}
// If the handshake failed or we're shutting down, clean up and invoke the
@@ -260,7 +260,7 @@ static void http_connect_handshaker_do_handshake(
// If not found, invoke on_handshake_done without doing anything.
const grpc_arg* arg =
grpc_channel_args_find(args->args, GRPC_ARG_HTTP_CONNECT_SERVER);
- if (arg == NULL) {
+ if (arg == nullptr) {
// Set shutdown to true so that subsequent calls to
// http_connect_handshaker_shutdown() do nothing.
gpr_mu_lock(&handshaker->mu);
@@ -273,11 +273,11 @@ static void http_connect_handshaker_do_handshake(
char* server_name = arg->value.string;
// Get headers from channel args.
arg = grpc_channel_args_find(args->args, GRPC_ARG_HTTP_CONNECT_HEADERS);
- grpc_http_header* headers = NULL;
+ grpc_http_header* headers = nullptr;
size_t num_headers = 0;
- char** header_strings = NULL;
+ char** header_strings = nullptr;
size_t num_header_strings = 0;
- if (arg != NULL) {
+ if (arg != nullptr) {
GPR_ASSERT(arg->type == GRPC_ARG_STRING);
gpr_string_split(arg->value.string, "\n", &header_strings,
&num_header_strings);
@@ -285,7 +285,7 @@ static void http_connect_handshaker_do_handshake(
num_header_strings);
for (size_t i = 0; i < num_header_strings; ++i) {
char* sep = strchr(header_strings[i], ':');
- if (sep == NULL) {
+ if (sep == nullptr) {
gpr_log(GPR_ERROR, "skipping unparseable HTTP CONNECT header: %s",
header_strings[i]);
continue;
diff --git a/src/core/ext/filters/client_channel/http_proxy.cc b/src/core/ext/filters/client_channel/http_proxy.cc
index a16b44d3dc..405d8c0e55 100644
--- a/src/core/ext/filters/client_channel/http_proxy.cc
+++ b/src/core/ext/filters/client_channel/http_proxy.cc
@@ -41,15 +41,15 @@
* responsibility to gpr_free user_cred.
*/
static char* get_http_proxy_server(grpc_exec_ctx* exec_ctx, char** user_cred) {
- GPR_ASSERT(user_cred != NULL);
- char* proxy_name = NULL;
+ GPR_ASSERT(user_cred != nullptr);
+ char* proxy_name = nullptr;
char* uri_str = gpr_getenv("http_proxy");
- char** authority_strs = NULL;
+ char** authority_strs = nullptr;
size_t authority_nstrs;
- if (uri_str == NULL) return NULL;
+ if (uri_str == nullptr) return nullptr;
grpc_uri* uri =
grpc_uri_parse(exec_ctx, uri_str, false /* suppress_errors */);
- if (uri == NULL || uri->authority == NULL) {
+ if (uri == nullptr || uri->authority == nullptr) {
gpr_log(GPR_ERROR, "cannot parse value of 'http_proxy' env var");
goto done;
}
@@ -73,7 +73,7 @@ static char* get_http_proxy_server(grpc_exec_ctx* exec_ctx, char** user_cred) {
for (size_t i = 0; i < authority_nstrs; i++) {
gpr_free(authority_strs[i]);
}
- proxy_name = NULL;
+ proxy_name = nullptr;
}
gpr_free(authority_strs);
done:
@@ -88,13 +88,13 @@ static bool proxy_mapper_map_name(grpc_exec_ctx* exec_ctx,
const grpc_channel_args* args,
char** name_to_resolve,
grpc_channel_args** new_args) {
- char* user_cred = NULL;
+ char* user_cred = nullptr;
*name_to_resolve = get_http_proxy_server(exec_ctx, &user_cred);
- if (*name_to_resolve == NULL) return false;
- char* no_proxy_str = NULL;
+ if (*name_to_resolve == nullptr) return false;
+ char* no_proxy_str = nullptr;
grpc_uri* uri =
grpc_uri_parse(exec_ctx, server_uri, false /* suppress_errors */);
- if (uri == NULL || uri->path[0] == '\0') {
+ if (uri == nullptr || uri->path[0] == '\0') {
gpr_log(GPR_ERROR,
"'http_proxy' environment variable set, but cannot "
"parse server URI '%s' -- not using proxy",
@@ -107,7 +107,7 @@ static bool proxy_mapper_map_name(grpc_exec_ctx* exec_ctx,
goto no_use_proxy;
}
no_proxy_str = gpr_getenv("no_proxy");
- if (no_proxy_str != NULL) {
+ if (no_proxy_str != nullptr) {
static const char* NO_PROXY_SEPARATOR = ",";
bool use_proxy = true;
char* server_host;
@@ -149,7 +149,7 @@ static bool proxy_mapper_map_name(grpc_exec_ctx* exec_ctx,
args_to_add[0] = grpc_channel_arg_string_create(
(char*)GRPC_ARG_HTTP_CONNECT_SERVER,
uri->path[0] == '/' ? uri->path + 1 : uri->path);
- if (user_cred != NULL) {
+ if (user_cred != nullptr) {
/* Use base64 encoding for user credentials as stated in RFC 7617 */
char* encoded_user_cred =
grpc_base64_encode(user_cred, strlen(user_cred), 0, 0);
@@ -167,9 +167,9 @@ static bool proxy_mapper_map_name(grpc_exec_ctx* exec_ctx,
gpr_free(user_cred);
return true;
no_use_proxy:
- if (uri != NULL) grpc_uri_destroy(uri);
+ if (uri != nullptr) grpc_uri_destroy(uri);
gpr_free(*name_to_resolve);
- *name_to_resolve = NULL;
+ *name_to_resolve = nullptr;
gpr_free(user_cred);
return false;
}
diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc
index d93a9c3710..6d9fadaf30 100644
--- a/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc
@@ -72,8 +72,8 @@ static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx,
const grpc_call_element_args* args) {
call_data* calld = (call_data*)elem->call_data;
// Get stats object from context and take a ref.
- GPR_ASSERT(args->context != NULL);
- GPR_ASSERT(args->context[GRPC_GRPCLB_CLIENT_STATS].value != NULL);
+ GPR_ASSERT(args->context != nullptr);
+ GPR_ASSERT(args->context[GRPC_GRPCLB_CLIENT_STATS].value != nullptr);
calld->client_stats = grpc_grpclb_client_stats_ref(
(grpc_grpclb_client_stats*)args->context[GRPC_GRPCLB_CLIENT_STATS].value);
// Record call started.
diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
index 6675cacc41..e9bef8a921 100644
--- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
@@ -133,7 +133,7 @@ grpc_tracer_flag grpc_lb_glb_trace = GRPC_TRACER_INITIALIZER(false, "glb");
static grpc_error* initial_metadata_add_lb_token(
grpc_exec_ctx* exec_ctx, grpc_metadata_batch* initial_metadata,
grpc_linked_mdelem* lb_token_mdelem_storage, grpc_mdelem lb_token) {
- GPR_ASSERT(lb_token_mdelem_storage != NULL);
+ GPR_ASSERT(lb_token_mdelem_storage != nullptr);
GPR_ASSERT(!GRPC_MDISNULL(lb_token));
return grpc_metadata_batch_add_tail(exec_ctx, initial_metadata,
lb_token_mdelem_storage, lb_token);
@@ -190,14 +190,14 @@ static void wrapped_rr_closure(grpc_exec_ctx* exec_ctx, void* arg,
grpc_error* error) {
wrapped_rr_closure_arg* wc_arg = (wrapped_rr_closure_arg*)arg;
- GPR_ASSERT(wc_arg->wrapped_closure != NULL);
+ GPR_ASSERT(wc_arg->wrapped_closure != nullptr);
GRPC_CLOSURE_SCHED(exec_ctx, wc_arg->wrapped_closure, GRPC_ERROR_REF(error));
- if (wc_arg->rr_policy != NULL) {
+ if (wc_arg->rr_policy != nullptr) {
/* if *target is NULL, no pick has been made by the RR policy (eg, all
* addresses failed to connect). There won't be any user_data/token
* available */
- if (*wc_arg->target != NULL) {
+ if (*wc_arg->target != nullptr) {
if (!GRPC_MDISNULL(wc_arg->lb_token)) {
initial_metadata_add_lb_token(exec_ctx, wc_arg->initial_metadata,
wc_arg->lb_token_mdelem_storage,
@@ -211,7 +211,7 @@ static void wrapped_rr_closure(grpc_exec_ctx* exec_ctx, void* arg,
abort();
}
// Pass on client stats via context. Passes ownership of the reference.
- GPR_ASSERT(wc_arg->client_stats != NULL);
+ GPR_ASSERT(wc_arg->client_stats != nullptr);
wc_arg->context[GRPC_GRPCLB_CLIENT_STATS].value = wc_arg->client_stats;
wc_arg->context[GRPC_GRPCLB_CLIENT_STATS].destroy = destroy_client_stats;
} else {
@@ -223,7 +223,7 @@ static void wrapped_rr_closure(grpc_exec_ctx* exec_ctx, void* arg,
}
GRPC_LB_POLICY_UNREF(exec_ctx, wc_arg->rr_policy, "wrapped_rr_closure");
}
- GPR_ASSERT(wc_arg->free_when_done != NULL);
+ GPR_ASSERT(wc_arg->free_when_done != nullptr);
gpr_free(wc_arg->free_when_done);
}
@@ -455,12 +455,12 @@ static bool is_server_valid(const grpc_grpclb_server* server, size_t idx,
/* vtable for LB tokens in grpc_lb_addresses. */
static void* lb_token_copy(void* token) {
- return token == NULL
- ? NULL
+ return token == nullptr
+ ? nullptr
: (void*)GRPC_MDELEM_REF(grpc_mdelem{(uintptr_t)token}).payload;
}
static void lb_token_destroy(grpc_exec_ctx* exec_ctx, void* token) {
- if (token != NULL) {
+ if (token != nullptr) {
GRPC_MDELEM_UNREF(exec_ctx, grpc_mdelem{(uintptr_t)token});
}
}
@@ -543,7 +543,7 @@ static grpc_lb_addresses* process_serverlist_locked(
grpc_lb_addresses_set_address(lb_addresses, addr_idx, &addr.addr, addr.len,
false /* is_balancer */,
- NULL /* balancer_name */, user_data);
+ nullptr /* balancer_name */, user_data);
++addr_idx;
}
GPR_ASSERT(addr_idx == num_valid);
@@ -569,7 +569,7 @@ static grpc_lb_addresses* extract_backend_addresses_locked(
const grpc_resolved_address* addr = &addresses->addresses[i].address;
grpc_lb_addresses_set_address(backend_addresses, num_copied, &addr->addr,
addr->len, false /* is_balancer */,
- NULL /* balancer_name */,
+ nullptr /* balancer_name */,
(void*)GRPC_MDELEM_LB_TOKEN_EMPTY.payload);
++num_copied;
}
@@ -645,7 +645,7 @@ static bool pick_from_internal_rr_locked(
const grpc_lb_policy_pick_args* pick_args, bool force_async,
grpc_connected_subchannel** target, wrapped_rr_closure_arg* wc_arg) {
// Check for drops if we are not using fallback backend addresses.
- if (glb_policy->serverlist != NULL) {
+ if (glb_policy->serverlist != nullptr) {
// Look at the index into the serverlist to see if we should drop this call.
grpc_grpclb_server* server =
glb_policy->serverlist->servers[glb_policy->serverlist_index++];
@@ -664,12 +664,12 @@ static bool pick_from_internal_rr_locked(
// the client_load_reporting filter, because we do not create a
// subchannel call (and therefore no client_load_reporting filter)
// for dropped calls.
- GPR_ASSERT(wc_arg->client_stats != NULL);
+ GPR_ASSERT(wc_arg->client_stats != nullptr);
grpc_grpclb_client_stats_add_call_dropped_locked(
server->load_balance_token, wc_arg->client_stats);
grpc_grpclb_client_stats_unref(wc_arg->client_stats);
if (force_async) {
- GPR_ASSERT(wc_arg->wrapped_closure != NULL);
+ GPR_ASSERT(wc_arg->wrapped_closure != nullptr);
GRPC_CLOSURE_SCHED(exec_ctx, wc_arg->wrapped_closure, GRPC_ERROR_NONE);
gpr_free(wc_arg->free_when_done);
return false;
@@ -694,11 +694,11 @@ static bool pick_from_internal_rr_locked(
pick_args->lb_token_mdelem_storage,
GRPC_MDELEM_REF(wc_arg->lb_token));
// Pass on client stats via context. Passes ownership of the reference.
- GPR_ASSERT(wc_arg->client_stats != NULL);
+ GPR_ASSERT(wc_arg->client_stats != nullptr);
wc_arg->context[GRPC_GRPCLB_CLIENT_STATS].value = wc_arg->client_stats;
wc_arg->context[GRPC_GRPCLB_CLIENT_STATS].destroy = destroy_client_stats;
if (force_async) {
- GPR_ASSERT(wc_arg->wrapped_closure != NULL);
+ GPR_ASSERT(wc_arg->wrapped_closure != nullptr);
GRPC_CLOSURE_SCHED(exec_ctx, wc_arg->wrapped_closure, GRPC_ERROR_NONE);
gpr_free(wc_arg->free_when_done);
return false;
@@ -715,7 +715,7 @@ static bool pick_from_internal_rr_locked(
static grpc_lb_policy_args* lb_policy_args_create(grpc_exec_ctx* exec_ctx,
glb_lb_policy* glb_policy) {
grpc_lb_addresses* addresses;
- if (glb_policy->serverlist != NULL) {
+ if (glb_policy->serverlist != nullptr) {
GPR_ASSERT(glb_policy->serverlist->num_servers > 0);
addresses = process_serverlist_locked(exec_ctx, glb_policy->serverlist);
} else {
@@ -723,10 +723,10 @@ static grpc_lb_policy_args* lb_policy_args_create(grpc_exec_ctx* exec_ctx,
// serverlist from the balancer, we use the fallback backends returned by
// the resolver. Note that the fallback backend list may be empty, in which
// case the new round_robin policy will keep the requested picks pending.
- GPR_ASSERT(glb_policy->fallback_backend_addresses != NULL);
+ GPR_ASSERT(glb_policy->fallback_backend_addresses != nullptr);
addresses = grpc_lb_addresses_copy(glb_policy->fallback_backend_addresses);
}
- GPR_ASSERT(addresses != NULL);
+ GPR_ASSERT(addresses != nullptr);
grpc_lb_policy_args* args = (grpc_lb_policy_args*)gpr_zalloc(sizeof(*args));
args->client_channel_factory = glb_policy->cc_factory;
args->combiner = glb_policy->base.combiner;
@@ -751,11 +751,11 @@ static void glb_rr_connectivity_changed_locked(grpc_exec_ctx* exec_ctx,
void* arg, grpc_error* error);
static void create_rr_locked(grpc_exec_ctx* exec_ctx, glb_lb_policy* glb_policy,
grpc_lb_policy_args* args) {
- GPR_ASSERT(glb_policy->rr_policy == NULL);
+ GPR_ASSERT(glb_policy->rr_policy == nullptr);
grpc_lb_policy* new_rr_policy =
grpc_lb_policy_create(exec_ctx, "round_robin", args);
- if (new_rr_policy == NULL) {
+ if (new_rr_policy == nullptr) {
gpr_log(GPR_ERROR,
"[grpclb %p] Failure creating a RoundRobin policy for serverlist "
"update with %" PRIuPTR
@@ -767,7 +767,7 @@ static void create_rr_locked(grpc_exec_ctx* exec_ctx, glb_lb_policy* glb_policy,
return;
}
glb_policy->rr_policy = new_rr_policy;
- grpc_error* rr_state_error = NULL;
+ grpc_error* rr_state_error = nullptr;
const grpc_connectivity_state rr_state =
grpc_lb_policy_check_connectivity_locked(exec_ctx, glb_policy->rr_policy,
&rr_state_error);
@@ -835,8 +835,8 @@ static void rr_handover_locked(grpc_exec_ctx* exec_ctx,
glb_lb_policy* glb_policy) {
if (glb_policy->shutting_down) return;
grpc_lb_policy_args* args = lb_policy_args_create(exec_ctx, glb_policy);
- GPR_ASSERT(args != NULL);
- if (glb_policy->rr_policy != NULL) {
+ GPR_ASSERT(args != nullptr);
+ if (glb_policy->rr_policy != nullptr) {
if (GRPC_TRACER_ON(grpc_lb_glb_trace)) {
gpr_log(GPR_DEBUG, "[grpclb %p] Updating RR policy %p", glb_policy,
glb_policy->rr_policy);
@@ -868,7 +868,7 @@ static void glb_rr_connectivity_changed_locked(grpc_exec_ctx* exec_ctx,
* sink, policies can't transition back from it. .*/
GRPC_LB_POLICY_UNREF(exec_ctx, glb_policy->rr_policy,
"rr_connectivity_shutdown");
- glb_policy->rr_policy = NULL;
+ glb_policy->rr_policy = nullptr;
GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, &glb_policy->base,
"glb_rr_connectivity_cb");
gpr_free(rr_connectivity);
@@ -923,7 +923,7 @@ static grpc_channel_args* build_lb_channel_args(
* instantiated and used in that case. Otherwise, something has gone wrong. */
GPR_ASSERT(num_grpclb_addrs > 0);
grpc_lb_addresses* lb_addresses =
- grpc_lb_addresses_create(num_grpclb_addrs, NULL);
+ grpc_lb_addresses_create(num_grpclb_addrs, nullptr);
grpc_slice_hash_table_entry* targets_info_entries =
(grpc_slice_hash_table_entry*)gpr_zalloc(sizeof(*targets_info_entries) *
num_grpclb_addrs);
@@ -931,7 +931,7 @@ static grpc_channel_args* build_lb_channel_args(
size_t lb_addresses_idx = 0;
for (size_t i = 0; i < addresses->num_addresses; ++i) {
if (!addresses->addresses[i].is_balancer) continue;
- if (addresses->addresses[i].user_data != NULL) {
+ if (addresses->addresses[i].user_data != nullptr) {
gpr_log(GPR_ERROR,
"This LB policy doesn't support user data. It will be ignored");
}
@@ -945,7 +945,7 @@ static grpc_channel_args* build_lb_channel_args(
grpc_lb_addresses_set_address(
lb_addresses, lb_addresses_idx++, addresses->addresses[i].address.addr,
addresses->addresses[i].address.len, false /* is balancer */,
- addresses->addresses[i].balancer_name, NULL /* user data */);
+ addresses->addresses[i].balancer_name, nullptr /* user data */);
}
GPR_ASSERT(num_grpclb_addrs == lb_addresses_idx);
grpc_slice_hash_table* targets_info =
@@ -970,18 +970,18 @@ static grpc_channel_args* build_lb_channel_args(
static void glb_destroy(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol) {
glb_lb_policy* glb_policy = (glb_lb_policy*)pol;
- GPR_ASSERT(glb_policy->pending_picks == NULL);
- GPR_ASSERT(glb_policy->pending_pings == NULL);
+ GPR_ASSERT(glb_policy->pending_picks == nullptr);
+ GPR_ASSERT(glb_policy->pending_pings == nullptr);
gpr_free((void*)glb_policy->server_name);
grpc_channel_args_destroy(exec_ctx, glb_policy->args);
- if (glb_policy->client_stats != NULL) {
+ if (glb_policy->client_stats != nullptr) {
grpc_grpclb_client_stats_unref(glb_policy->client_stats);
}
grpc_connectivity_state_destroy(exec_ctx, &glb_policy->state_tracker);
- if (glb_policy->serverlist != NULL) {
+ if (glb_policy->serverlist != nullptr) {
grpc_grpclb_destroy_serverlist(glb_policy->serverlist);
}
- if (glb_policy->fallback_backend_addresses != NULL) {
+ if (glb_policy->fallback_backend_addresses != nullptr) {
grpc_lb_addresses_destroy(exec_ctx, glb_policy->fallback_backend_addresses);
}
grpc_fake_resolver_response_generator_unref(glb_policy->response_generator);
@@ -1002,8 +1002,8 @@ static void glb_shutdown_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol) {
* because glb_policy->lb_call is only assigned in lb_call_init_locked as part
* of query_for_backends_locked, which can only be invoked while
* glb_policy->shutting_down is false. */
- if (lb_call != NULL) {
- grpc_call_cancel(lb_call, NULL);
+ if (lb_call != nullptr) {
+ grpc_call_cancel(lb_call, nullptr);
/* lb_on_server_status_received will pick up the cancel and clean up */
}
if (glb_policy->retry_timer_active) {
@@ -1016,27 +1016,27 @@ static void glb_shutdown_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol) {
}
pending_pick* pp = glb_policy->pending_picks;
- glb_policy->pending_picks = NULL;
+ glb_policy->pending_picks = nullptr;
pending_ping* pping = glb_policy->pending_pings;
- glb_policy->pending_pings = NULL;
- if (glb_policy->rr_policy != NULL) {
+ glb_policy->pending_pings = nullptr;
+ if (glb_policy->rr_policy != nullptr) {
GRPC_LB_POLICY_UNREF(exec_ctx, glb_policy->rr_policy, "glb_shutdown");
}
// We destroy the LB channel here because
// glb_lb_channel_on_connectivity_changed_cb needs a valid glb_policy
// instance. Destroying the lb channel in glb_destroy would likely result in
// a callback invocation without a valid glb_policy arg.
- if (glb_policy->lb_channel != NULL) {
+ if (glb_policy->lb_channel != nullptr) {
grpc_channel_destroy(glb_policy->lb_channel);
- glb_policy->lb_channel = NULL;
+ glb_policy->lb_channel = nullptr;
}
grpc_connectivity_state_set(
exec_ctx, &glb_policy->state_tracker, GRPC_CHANNEL_SHUTDOWN,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Channel Shutdown"), "glb_shutdown");
- while (pp != NULL) {
+ while (pp != nullptr) {
pending_pick* next = pp->next;
- *pp->target = NULL;
+ *pp->target = nullptr;
GRPC_CLOSURE_SCHED(
exec_ctx, &pp->wrapped_on_complete_arg.wrapper_closure,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Channel Shutdown"));
@@ -1044,7 +1044,7 @@ static void glb_shutdown_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol) {
pp = next;
}
- while (pping != NULL) {
+ while (pping != nullptr) {
pending_ping* next = pping->next;
GRPC_CLOSURE_SCHED(
exec_ctx, &pping->wrapped_notify_arg.wrapper_closure,
@@ -1069,11 +1069,11 @@ static void glb_cancel_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
grpc_error* error) {
glb_lb_policy* glb_policy = (glb_lb_policy*)pol;
pending_pick* pp = glb_policy->pending_picks;
- glb_policy->pending_picks = NULL;
- while (pp != NULL) {
+ glb_policy->pending_picks = nullptr;
+ while (pp != nullptr) {
pending_pick* next = pp->next;
if (pp->target == target) {
- *target = NULL;
+ *target = nullptr;
GRPC_CLOSURE_SCHED(exec_ctx, &pp->wrapped_on_complete_arg.wrapper_closure,
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
"Pick Cancelled", &error, 1));
@@ -1083,7 +1083,7 @@ static void glb_cancel_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
}
pp = next;
}
- if (glb_policy->rr_policy != NULL) {
+ if (glb_policy->rr_policy != nullptr) {
grpc_lb_policy_cancel_pick_locked(exec_ctx, glb_policy->rr_policy, target,
GRPC_ERROR_REF(error));
}
@@ -1107,8 +1107,8 @@ static void glb_cancel_picks_locked(grpc_exec_ctx* exec_ctx,
grpc_error* error) {
glb_lb_policy* glb_policy = (glb_lb_policy*)pol;
pending_pick* pp = glb_policy->pending_picks;
- glb_policy->pending_picks = NULL;
- while (pp != NULL) {
+ glb_policy->pending_picks = nullptr;
+ while (pp != nullptr) {
pending_pick* next = pp->next;
if ((pp->pick_args.initial_metadata_flags & initial_metadata_flags_mask) ==
initial_metadata_flags_eq) {
@@ -1121,7 +1121,7 @@ static void glb_cancel_picks_locked(grpc_exec_ctx* exec_ctx,
}
pp = next;
}
- if (glb_policy->rr_policy != NULL) {
+ if (glb_policy->rr_policy != nullptr) {
grpc_lb_policy_cancel_picks_locked(
exec_ctx, glb_policy->rr_policy, initial_metadata_flags_mask,
initial_metadata_flags_eq, GRPC_ERROR_REF(error));
@@ -1137,7 +1137,7 @@ static void start_picking_locked(grpc_exec_ctx* exec_ctx,
glb_lb_policy* glb_policy) {
/* start a timer to fall back */
if (glb_policy->lb_fallback_timeout_ms > 0 &&
- glb_policy->serverlist == NULL && !glb_policy->fallback_timer_active) {
+ glb_policy->serverlist == nullptr && !glb_policy->fallback_timer_active) {
grpc_millis deadline =
grpc_exec_ctx_now(exec_ctx) + glb_policy->lb_fallback_timeout_ms;
GRPC_LB_POLICY_WEAK_REF(&glb_policy->base, "grpclb_fallback_timer");
@@ -1166,8 +1166,8 @@ static int glb_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
grpc_connected_subchannel** target,
grpc_call_context_element* context, void** user_data,
grpc_closure* on_complete) {
- if (pick_args->lb_token_mdelem_storage == NULL) {
- *target = NULL;
+ if (pick_args->lb_token_mdelem_storage == nullptr) {
+ *target = nullptr;
GRPC_CLOSURE_SCHED(exec_ctx, on_complete,
GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"No mdelem storage for the LB token. Load reporting "
@@ -1176,10 +1176,10 @@ static int glb_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
}
glb_lb_policy* glb_policy = (glb_lb_policy*)pol;
bool pick_done = false;
- if (glb_policy->rr_policy != NULL) {
+ if (glb_policy->rr_policy != nullptr) {
const grpc_connectivity_state rr_connectivity_state =
- grpc_lb_policy_check_connectivity_locked(exec_ctx,
- glb_policy->rr_policy, NULL);
+ grpc_lb_policy_check_connectivity_locked(
+ exec_ctx, glb_policy->rr_policy, nullptr);
// The glb_policy->rr_policy may have transitioned to SHUTDOWN but the
// callback registered to capture this event
// (glb_rr_connectivity_changed_locked) may not have been invoked yet. We
@@ -1208,7 +1208,7 @@ static int glb_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
wc_arg->rr_policy = glb_policy->rr_policy;
wc_arg->target = target;
wc_arg->context = context;
- GPR_ASSERT(glb_policy->client_stats != NULL);
+ GPR_ASSERT(glb_policy->client_stats != nullptr);
wc_arg->client_stats =
grpc_grpclb_client_stats_ref(glb_policy->client_stats);
wc_arg->wrapped_closure = on_complete;
@@ -1270,7 +1270,7 @@ static void lb_call_on_retry_timer_locked(grpc_exec_ctx* exec_ctx, void* arg,
grpc_error* error) {
glb_lb_policy* glb_policy = (glb_lb_policy*)arg;
glb_policy->retry_timer_active = false;
- if (!glb_policy->shutting_down && glb_policy->lb_call == NULL &&
+ if (!glb_policy->shutting_down && glb_policy->lb_call == nullptr &&
error == GRPC_ERROR_NONE) {
if (GRPC_TRACER_ON(grpc_lb_glb_trace)) {
gpr_log(GPR_INFO, "[grpclb %p] Restarting call to LB server", glb_policy);
@@ -1337,8 +1337,8 @@ static void client_load_report_done_locked(grpc_exec_ctx* exec_ctx, void* arg,
grpc_error* error) {
glb_lb_policy* glb_policy = (glb_lb_policy*)arg;
grpc_byte_buffer_destroy(glb_policy->client_load_report_payload);
- glb_policy->client_load_report_payload = NULL;
- if (error != GRPC_ERROR_NONE || glb_policy->lb_call == NULL) {
+ glb_policy->client_load_report_payload = nullptr;
+ if (error != GRPC_ERROR_NONE || glb_policy->lb_call == nullptr) {
glb_policy->client_load_report_timer_pending = false;
GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, &glb_policy->base,
"client_load_report");
@@ -1356,23 +1356,23 @@ static bool load_report_counters_are_zero(grpc_grpclb_request* request) {
request->client_stats.num_calls_finished_with_client_failed_to_send ==
0 &&
request->client_stats.num_calls_finished_known_received == 0 &&
- (drop_entries == NULL || drop_entries->num_entries == 0);
+ (drop_entries == nullptr || drop_entries->num_entries == 0);
}
static void send_client_load_report_locked(grpc_exec_ctx* exec_ctx, void* arg,
grpc_error* error) {
glb_lb_policy* glb_policy = (glb_lb_policy*)arg;
- if (error == GRPC_ERROR_CANCELLED || glb_policy->lb_call == NULL) {
+ if (error == GRPC_ERROR_CANCELLED || glb_policy->lb_call == nullptr) {
glb_policy->client_load_report_timer_pending = false;
GRPC_LB_POLICY_WEAK_UNREF(exec_ctx, &glb_policy->base,
"client_load_report");
- if (glb_policy->lb_call == NULL) {
+ if (glb_policy->lb_call == nullptr) {
maybe_restart_lb_call(exec_ctx, glb_policy);
}
return;
}
// Construct message payload.
- GPR_ASSERT(glb_policy->client_load_report_payload == NULL);
+ GPR_ASSERT(glb_policy->client_load_report_payload == nullptr);
grpc_grpclb_request* request =
grpc_grpclb_load_report_request_create_locked(glb_policy->client_stats);
// Skip client load report if the counters were all zero in the last
@@ -1415,9 +1415,9 @@ static void lb_on_response_received_locked(grpc_exec_ctx* exec_ctx, void* arg,
grpc_error* error);
static void lb_call_init_locked(grpc_exec_ctx* exec_ctx,
glb_lb_policy* glb_policy) {
- GPR_ASSERT(glb_policy->server_name != NULL);
+ GPR_ASSERT(glb_policy->server_name != nullptr);
GPR_ASSERT(glb_policy->server_name[0] != '\0');
- GPR_ASSERT(glb_policy->lb_call == NULL);
+ GPR_ASSERT(glb_policy->lb_call == nullptr);
GPR_ASSERT(!glb_policy->shutting_down);
/* Note the following LB call progresses every time there's activity in \a
@@ -1429,13 +1429,13 @@ static void lb_call_init_locked(grpc_exec_ctx* exec_ctx,
? GRPC_MILLIS_INF_FUTURE
: grpc_exec_ctx_now(exec_ctx) + glb_policy->lb_call_timeout_ms;
glb_policy->lb_call = grpc_channel_create_pollset_set_call(
- exec_ctx, glb_policy->lb_channel, NULL, GRPC_PROPAGATE_DEFAULTS,
+ exec_ctx, glb_policy->lb_channel, nullptr, GRPC_PROPAGATE_DEFAULTS,
glb_policy->base.interested_parties,
GRPC_MDSTR_SLASH_GRPC_DOT_LB_DOT_V1_DOT_LOADBALANCER_SLASH_BALANCELOAD,
- &host, deadline, NULL);
+ &host, deadline, nullptr);
grpc_slice_unref_internal(exec_ctx, host);
- if (glb_policy->client_stats != NULL) {
+ if (glb_policy->client_stats != nullptr) {
grpc_grpclb_client_stats_unref(glb_policy->client_stats);
}
glb_policy->client_stats = grpc_grpclb_client_stats_create();
@@ -1471,9 +1471,9 @@ static void lb_call_init_locked(grpc_exec_ctx* exec_ctx,
static void lb_call_destroy_locked(grpc_exec_ctx* exec_ctx,
glb_lb_policy* glb_policy) {
- GPR_ASSERT(glb_policy->lb_call != NULL);
+ GPR_ASSERT(glb_policy->lb_call != nullptr);
grpc_call_unref(glb_policy->lb_call);
- glb_policy->lb_call = NULL;
+ glb_policy->lb_call = nullptr;
grpc_metadata_array_destroy(&glb_policy->lb_initial_metadata_recv);
grpc_metadata_array_destroy(&glb_policy->lb_trailing_metadata_recv);
@@ -1491,7 +1491,7 @@ static void lb_call_destroy_locked(grpc_exec_ctx* exec_ctx,
*/
static void query_for_backends_locked(grpc_exec_ctx* exec_ctx,
glb_lb_policy* glb_policy) {
- GPR_ASSERT(glb_policy->lb_channel != NULL);
+ GPR_ASSERT(glb_policy->lb_channel != nullptr);
if (glb_policy->shutting_down) return;
lb_call_init_locked(exec_ctx, glb_policy);
@@ -1501,7 +1501,7 @@ static void query_for_backends_locked(grpc_exec_ctx* exec_ctx,
"[grpclb %p] Query for backends (lb_channel: %p, lb_call: %p)",
glb_policy, glb_policy->lb_channel, glb_policy->lb_call);
}
- GPR_ASSERT(glb_policy->lb_call != NULL);
+ GPR_ASSERT(glb_policy->lb_call != nullptr);
grpc_call_error call_error;
grpc_op ops[3];
@@ -1511,22 +1511,22 @@ static void query_for_backends_locked(grpc_exec_ctx* exec_ctx,
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
op->flags = 0;
- op->reserved = NULL;
+ op->reserved = nullptr;
op++;
op->op = GRPC_OP_RECV_INITIAL_METADATA;
op->data.recv_initial_metadata.recv_initial_metadata =
&glb_policy->lb_initial_metadata_recv;
op->flags = 0;
- op->reserved = NULL;
+ op->reserved = nullptr;
op++;
- GPR_ASSERT(glb_policy->lb_request_payload != NULL);
+ GPR_ASSERT(glb_policy->lb_request_payload != nullptr);
op->op = GRPC_OP_SEND_MESSAGE;
op->data.send_message.send_message = glb_policy->lb_request_payload;
op->flags = 0;
- op->reserved = NULL;
+ op->reserved = nullptr;
op++;
- call_error = grpc_call_start_batch_and_execute(exec_ctx, glb_policy->lb_call,
- ops, (size_t)(op - ops), NULL);
+ call_error = grpc_call_start_batch_and_execute(
+ exec_ctx, glb_policy->lb_call, ops, (size_t)(op - ops), nullptr);
GPR_ASSERT(GRPC_CALL_OK == call_error);
op = ops;
@@ -1537,7 +1537,7 @@ static void query_for_backends_locked(grpc_exec_ctx* exec_ctx,
op->data.recv_status_on_client.status_details =
&glb_policy->lb_call_status_details;
op->flags = 0;
- op->reserved = NULL;
+ op->reserved = nullptr;
op++;
/* take a weak ref (won't prevent calling of \a glb_shutdown if the strong ref
* count goes to zero) to be unref'd in lb_on_server_status_received_locked */
@@ -1552,7 +1552,7 @@ static void query_for_backends_locked(grpc_exec_ctx* exec_ctx,
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message.recv_message = &glb_policy->lb_response_payload;
op->flags = 0;
- op->reserved = NULL;
+ op->reserved = nullptr;
op++;
/* take another weak ref to be unref'd/reused in
* lb_on_response_received_locked */
@@ -1569,7 +1569,7 @@ static void lb_on_response_received_locked(grpc_exec_ctx* exec_ctx, void* arg,
grpc_op ops[2];
memset(ops, 0, sizeof(ops));
grpc_op* op = ops;
- if (glb_policy->lb_response_payload != NULL) {
+ if (glb_policy->lb_response_payload != nullptr) {
grpc_backoff_reset(&glb_policy->lb_call_backoff_state);
/* Received data from the LB server. Look inside
* glb_policy->lb_response_payload, for a serverlist. */
@@ -1579,10 +1579,10 @@ static void lb_on_response_received_locked(grpc_exec_ctx* exec_ctx, void* arg,
grpc_byte_buffer_reader_destroy(&bbr);
grpc_byte_buffer_destroy(glb_policy->lb_response_payload);
- grpc_grpclb_initial_response* response = NULL;
+ grpc_grpclb_initial_response* response = nullptr;
if (!glb_policy->seen_initial_response &&
(response = grpc_grpclb_initial_response_parse(response_slice)) !=
- NULL) {
+ nullptr) {
if (response->has_client_stats_report_interval) {
glb_policy->client_stats_report_interval = GPR_MAX(
GPR_MS_PER_SEC, grpc_grpclb_duration_to_millis(
@@ -1610,8 +1610,8 @@ static void lb_on_response_received_locked(grpc_exec_ctx* exec_ctx, void* arg,
} else {
grpc_grpclb_serverlist* serverlist =
grpc_grpclb_response_parse_serverlist(response_slice);
- if (serverlist != NULL) {
- GPR_ASSERT(glb_policy->lb_call != NULL);
+ if (serverlist != nullptr) {
+ GPR_ASSERT(glb_policy->lb_call != nullptr);
if (GRPC_TRACER_ON(grpc_lb_glb_trace)) {
gpr_log(GPR_INFO,
"[grpclb %p] Serverlist with %" PRIuPTR " servers received",
@@ -1638,14 +1638,14 @@ static void lb_on_response_received_locked(grpc_exec_ctx* exec_ctx, void* arg,
}
grpc_grpclb_destroy_serverlist(serverlist);
} else { /* new serverlist */
- if (glb_policy->serverlist != NULL) {
+ if (glb_policy->serverlist != nullptr) {
/* dispose of the old serverlist */
grpc_grpclb_destroy_serverlist(glb_policy->serverlist);
} else {
/* or dispose of the fallback */
grpc_lb_addresses_destroy(exec_ctx,
glb_policy->fallback_backend_addresses);
- glb_policy->fallback_backend_addresses = NULL;
+ glb_policy->fallback_backend_addresses = nullptr;
if (glb_policy->fallback_timer_active) {
grpc_timer_cancel(exec_ctx, &glb_policy->lb_fallback_timer);
glb_policy->fallback_timer_active = false;
@@ -1679,7 +1679,7 @@ static void lb_on_response_received_locked(grpc_exec_ctx* exec_ctx, void* arg,
op->op = GRPC_OP_RECV_MESSAGE;
op->data.recv_message.recv_message = &glb_policy->lb_response_payload;
op->flags = 0;
- op->reserved = NULL;
+ op->reserved = nullptr;
op++;
/* reuse the "lb_on_response_received_locked" weak ref taken in
* query_for_backends_locked() */
@@ -1705,14 +1705,14 @@ static void lb_on_fallback_timer_locked(grpc_exec_ctx* exec_ctx, void* arg,
glb_policy->fallback_timer_active = false;
/* If we receive a serverlist after the timer fires but before this callback
* actually runs, don't fall back. */
- if (glb_policy->serverlist == NULL) {
+ if (glb_policy->serverlist == nullptr) {
if (!glb_policy->shutting_down && error == GRPC_ERROR_NONE) {
if (GRPC_TRACER_ON(grpc_lb_glb_trace)) {
gpr_log(GPR_INFO,
"[grpclb %p] Falling back to use backends from resolver",
glb_policy);
}
- GPR_ASSERT(glb_policy->fallback_backend_addresses != NULL);
+ GPR_ASSERT(glb_policy->fallback_backend_addresses != nullptr);
rr_handover_locked(exec_ctx, glb_policy);
}
}
@@ -1723,7 +1723,7 @@ static void lb_on_fallback_timer_locked(grpc_exec_ctx* exec_ctx, void* arg,
static void lb_on_server_status_received_locked(grpc_exec_ctx* exec_ctx,
void* arg, grpc_error* error) {
glb_lb_policy* glb_policy = (glb_lb_policy*)arg;
- GPR_ASSERT(glb_policy->lb_call != NULL);
+ GPR_ASSERT(glb_policy->lb_call != nullptr);
if (GRPC_TRACER_ON(grpc_lb_glb_trace)) {
char* status_details =
grpc_slice_to_c_string(glb_policy->lb_call_status_details);
@@ -1747,7 +1747,7 @@ static void lb_on_server_status_received_locked(grpc_exec_ctx* exec_ctx,
static void fallback_update_locked(grpc_exec_ctx* exec_ctx,
glb_lb_policy* glb_policy,
const grpc_lb_addresses* addresses) {
- GPR_ASSERT(glb_policy->fallback_backend_addresses != NULL);
+ GPR_ASSERT(glb_policy->fallback_backend_addresses != nullptr);
grpc_lb_addresses_destroy(exec_ctx, glb_policy->fallback_backend_addresses);
glb_policy->fallback_backend_addresses =
extract_backend_addresses_locked(exec_ctx, addresses);
@@ -1762,8 +1762,8 @@ static void glb_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
glb_lb_policy* glb_policy = (glb_lb_policy*)policy;
const grpc_arg* arg =
grpc_channel_args_find(args->args, GRPC_ARG_LB_ADDRESSES);
- if (arg == NULL || arg->type != GRPC_ARG_POINTER) {
- if (glb_policy->lb_channel == NULL) {
+ if (arg == nullptr || arg->type != GRPC_ARG_POINTER) {
+ if (glb_policy->lb_channel == nullptr) {
// If we don't have a current channel to the LB, go into TRANSIENT
// FAILURE.
grpc_connectivity_state_set(
@@ -1783,10 +1783,10 @@ static void glb_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
(const grpc_lb_addresses*)arg->value.pointer.p;
// If a non-empty serverlist hasn't been received from the balancer,
// propagate the update to fallback_backend_addresses.
- if (glb_policy->serverlist == NULL) {
+ if (glb_policy->serverlist == nullptr) {
fallback_update_locked(exec_ctx, glb_policy, addresses);
}
- GPR_ASSERT(glb_policy->lb_channel != NULL);
+ GPR_ASSERT(glb_policy->lb_channel != nullptr);
// Propagate updates to the LB channel (pick_first) through the fake
// resolver.
grpc_channel_args* lb_channel_args = build_lb_channel_args(
@@ -1809,7 +1809,7 @@ static void glb_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
grpc_polling_entity_create_from_pollset_set(
glb_policy->base.interested_parties),
&glb_policy->lb_channel_connectivity,
- &glb_policy->lb_channel_on_connectivity_changed, NULL);
+ &glb_policy->lb_channel_on_connectivity_changed, nullptr);
}
}
@@ -1837,7 +1837,7 @@ static void glb_lb_channel_on_connectivity_changed_cb(grpc_exec_ctx* exec_ctx,
grpc_polling_entity_create_from_pollset_set(
glb_policy->base.interested_parties),
&glb_policy->lb_channel_connectivity,
- &glb_policy->lb_channel_on_connectivity_changed, NULL);
+ &glb_policy->lb_channel_on_connectivity_changed, nullptr);
break;
}
case GRPC_CHANNEL_IDLE:
@@ -1845,9 +1845,9 @@ static void glb_lb_channel_on_connectivity_changed_cb(grpc_exec_ctx* exec_ctx,
// call to kick the lb channel into gear.
/* fallthrough */
case GRPC_CHANNEL_READY:
- if (glb_policy->lb_call != NULL) {
+ if (glb_policy->lb_call != nullptr) {
glb_policy->updating_lb_call = true;
- grpc_call_cancel(glb_policy->lb_call, NULL);
+ grpc_call_cancel(glb_policy->lb_call, nullptr);
// lb_on_server_status_received() will pick up the cancel and reinit
// lb_call.
} else if (glb_policy->started_picking && !glb_policy->shutting_down) {
@@ -1886,21 +1886,21 @@ static grpc_lb_policy* glb_create(grpc_exec_ctx* exec_ctx,
/* Count the number of gRPC-LB addresses. There must be at least one. */
const grpc_arg* arg =
grpc_channel_args_find(args->args, GRPC_ARG_LB_ADDRESSES);
- if (arg == NULL || arg->type != GRPC_ARG_POINTER) {
- return NULL;
+ if (arg == nullptr || arg->type != GRPC_ARG_POINTER) {
+ return nullptr;
}
grpc_lb_addresses* addresses = (grpc_lb_addresses*)arg->value.pointer.p;
size_t num_grpclb_addrs = 0;
for (size_t i = 0; i < addresses->num_addresses; ++i) {
if (addresses->addresses[i].is_balancer) ++num_grpclb_addrs;
}
- if (num_grpclb_addrs == 0) return NULL;
+ if (num_grpclb_addrs == 0) return nullptr;
glb_lb_policy* glb_policy = (glb_lb_policy*)gpr_zalloc(sizeof(*glb_policy));
/* Get server name. */
arg = grpc_channel_args_find(args->args, GRPC_ARG_SERVER_URI);
- GPR_ASSERT(arg != NULL);
+ GPR_ASSERT(arg != nullptr);
GPR_ASSERT(arg->type == GRPC_ARG_STRING);
grpc_uri* uri = grpc_uri_parse(exec_ctx, arg->value.string, true);
GPR_ASSERT(uri->path[0] != '\0');
@@ -1914,7 +1914,7 @@ static grpc_lb_policy* glb_create(grpc_exec_ctx* exec_ctx,
grpc_uri_destroy(uri);
glb_policy->cc_factory = args->client_channel_factory;
- GPR_ASSERT(glb_policy->cc_factory != NULL);
+ GPR_ASSERT(glb_policy->cc_factory != nullptr);
arg = grpc_channel_args_find(args->args, GRPC_ARG_GRPCLB_CALL_TIMEOUT_MS);
glb_policy->lb_call_timeout_ms =
@@ -1952,11 +1952,11 @@ static grpc_lb_policy* glb_create(grpc_exec_ctx* exec_ctx,
exec_ctx, glb_policy->response_generator, lb_channel_args);
grpc_channel_args_destroy(exec_ctx, lb_channel_args);
gpr_free(uri_str);
- if (glb_policy->lb_channel == NULL) {
+ if (glb_policy->lb_channel == nullptr) {
gpr_free((void*)glb_policy->server_name);
grpc_channel_args_destroy(exec_ctx, glb_policy->args);
gpr_free(glb_policy);
- return NULL;
+ return nullptr;
}
grpc_subchannel_index_ref();
GRPC_CLOSURE_INIT(&glb_policy->lb_channel_on_connectivity_changed,
@@ -1990,10 +1990,10 @@ static bool maybe_add_client_load_reporting_filter(
grpc_channel_stack_builder_get_channel_arguments(builder);
const grpc_arg* channel_arg =
grpc_channel_args_find(args, GRPC_ARG_LB_POLICY_NAME);
- if (channel_arg != NULL && channel_arg->type == GRPC_ARG_STRING &&
+ if (channel_arg != nullptr && channel_arg->type == GRPC_ARG_STRING &&
strcmp(channel_arg->value.string, "grpclb") == 0) {
return grpc_channel_stack_builder_append_filter(
- builder, (const grpc_channel_filter*)arg, NULL, NULL);
+ builder, (const grpc_channel_filter*)arg, nullptr, nullptr);
}
return true;
}
diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc
index 2dcf29fe0e..8eaa90e97b 100644
--- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc
@@ -35,7 +35,7 @@ grpc_channel* grpc_lb_policy_grpclb_create_lb_channel(
grpc_channel_args* new_args = args;
grpc_channel_credentials* channel_credentials =
grpc_channel_credentials_find_in_args(args);
- if (channel_credentials != NULL) {
+ if (channel_credentials != nullptr) {
/* Substitute the channel credentials with a version without call
* credentials: the load balancer is not necessarily trusted to handle
* bearer token credentials */
@@ -43,7 +43,7 @@ grpc_channel* grpc_lb_policy_grpclb_create_lb_channel(
grpc_channel_credentials* creds_sans_call_creds =
grpc_channel_credentials_duplicate_without_call_credentials(
channel_credentials);
- GPR_ASSERT(creds_sans_call_creds != NULL);
+ GPR_ASSERT(creds_sans_call_creds != nullptr);
grpc_arg args_to_add[] = {
grpc_channel_credentials_to_arg(creds_sans_call_creds)};
/* Create the new set of channel args */
@@ -55,7 +55,7 @@ grpc_channel* grpc_lb_policy_grpclb_create_lb_channel(
grpc_channel* lb_channel = grpc_client_channel_factory_create_channel(
exec_ctx, client_channel_factory, lb_service_target_addresses,
GRPC_CLIENT_CHANNEL_TYPE_LOAD_BALANCING, new_args);
- if (channel_credentials != NULL) {
+ if (channel_credentials != nullptr) {
grpc_channel_args_destroy(exec_ctx, new_args);
}
return lb_channel;
diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc
index 903120ca7d..e19a6a71aa 100644
--- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc
@@ -87,7 +87,7 @@ void grpc_grpclb_client_stats_add_call_dropped_locked(
gpr_atm_full_fetch_add(&client_stats->num_calls_started, (gpr_atm)1);
gpr_atm_full_fetch_add(&client_stats->num_calls_finished, (gpr_atm)1);
// Record the drop.
- if (client_stats->drop_token_counts == NULL) {
+ if (client_stats->drop_token_counts == nullptr) {
client_stats->drop_token_counts =
(grpc_grpclb_dropped_call_counts*)gpr_zalloc(
sizeof(grpc_grpclb_dropped_call_counts));
@@ -136,12 +136,12 @@ void grpc_grpclb_client_stats_get_locked(
num_calls_finished_known_received,
&client_stats->num_calls_finished_known_received);
*drop_token_counts = client_stats->drop_token_counts;
- client_stats->drop_token_counts = NULL;
+ client_stats->drop_token_counts = nullptr;
}
void grpc_grpclb_dropped_call_counts_destroy(
grpc_grpclb_dropped_call_counts* drop_entries) {
- if (drop_entries != NULL) {
+ if (drop_entries != nullptr) {
for (size_t i = 0; i < drop_entries->num_entries; ++i) {
gpr_free(drop_entries->token_counts[i].token);
}
diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc
index 87d7336b0c..2c8d7f4291 100644
--- a/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc
@@ -89,7 +89,7 @@ static bool encode_drops(pb_ostream_t* stream, const pb_field_t* field,
void* const* arg) {
grpc_grpclb_dropped_call_counts* drop_entries =
(grpc_grpclb_dropped_call_counts*)*arg;
- if (drop_entries == NULL) return true;
+ if (drop_entries == nullptr) return true;
for (size_t i = 0; i < drop_entries->num_entries; ++i) {
if (!pb_encode_tag_for_field(stream, field)) return false;
grpc_lb_v1_ClientStatsPerToken drop_message;
@@ -165,10 +165,10 @@ grpc_grpclb_initial_response* grpc_grpclb_initial_response_parse(
memset(&res, 0, sizeof(grpc_grpclb_response));
if (!pb_decode(&stream, grpc_lb_v1_LoadBalanceResponse_fields, &res)) {
gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&stream));
- return NULL;
+ return nullptr;
}
- if (!res.has_initial_response) return NULL;
+ if (!res.has_initial_response) return nullptr;
grpc_grpclb_initial_response* initial_res =
(grpc_grpclb_initial_response*)gpr_malloc(
@@ -196,7 +196,7 @@ grpc_grpclb_serverlist* grpc_grpclb_response_parse_serverlist(
if (!status) {
gpr_free(sl);
gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&stream));
- return NULL;
+ return nullptr;
}
// Second pass: populate servers.
if (sl->num_servers > 0) {
@@ -212,7 +212,7 @@ grpc_grpclb_serverlist* grpc_grpclb_response_parse_serverlist(
if (!status) {
grpc_grpclb_destroy_serverlist(sl);
gpr_log(GPR_ERROR, "nanopb error: %s", PB_GET_ERROR(&stream));
- return NULL;
+ return nullptr;
}
}
if (res.server_list.has_expiration_interval) {
@@ -222,7 +222,7 @@ grpc_grpclb_serverlist* grpc_grpclb_response_parse_serverlist(
}
void grpc_grpclb_destroy_serverlist(grpc_grpclb_serverlist* serverlist) {
- if (serverlist == NULL) {
+ if (serverlist == nullptr) {
return;
}
for (size_t i = 0; i < serverlist->num_servers; i++) {
@@ -251,7 +251,7 @@ grpc_grpclb_serverlist* grpc_grpclb_serverlist_copy(
bool grpc_grpclb_serverlist_equals(const grpc_grpclb_serverlist* lhs,
const grpc_grpclb_serverlist* rhs) {
- if (lhs == NULL || rhs == NULL) {
+ if (lhs == nullptr || rhs == nullptr) {
return false;
}
if (lhs->num_servers != rhs->num_servers) {
diff --git a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc
index c79ee5687d..caa6aee9a6 100644
--- a/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc
@@ -60,9 +60,9 @@ typedef struct {
static void pf_destroy(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol) {
pick_first_lb_policy* p = (pick_first_lb_policy*)pol;
- GPR_ASSERT(p->subchannel_list == NULL);
- GPR_ASSERT(p->latest_pending_subchannel_list == NULL);
- GPR_ASSERT(p->pending_picks == NULL);
+ GPR_ASSERT(p->subchannel_list == nullptr);
+ GPR_ASSERT(p->latest_pending_subchannel_list == nullptr);
+ GPR_ASSERT(p->pending_picks == nullptr);
grpc_connectivity_state_destroy(exec_ctx, &p->state_tracker);
gpr_free(p);
grpc_subchannel_index_unref();
@@ -78,24 +78,24 @@ static void shutdown_locked(grpc_exec_ctx* exec_ctx, pick_first_lb_policy* p,
}
p->shutdown = true;
pending_pick* pp;
- while ((pp = p->pending_picks) != NULL) {
+ while ((pp = p->pending_picks) != nullptr) {
p->pending_picks = pp->next;
- *pp->target = NULL;
+ *pp->target = nullptr;
GRPC_CLOSURE_SCHED(exec_ctx, pp->on_complete, GRPC_ERROR_REF(error));
gpr_free(pp);
}
grpc_connectivity_state_set(exec_ctx, &p->state_tracker,
GRPC_CHANNEL_SHUTDOWN, GRPC_ERROR_REF(error),
"shutdown");
- if (p->subchannel_list != NULL) {
+ if (p->subchannel_list != nullptr) {
grpc_lb_subchannel_list_shutdown_and_unref(exec_ctx, p->subchannel_list,
"pf_shutdown");
- p->subchannel_list = NULL;
+ p->subchannel_list = nullptr;
}
- if (p->latest_pending_subchannel_list != NULL) {
+ if (p->latest_pending_subchannel_list != nullptr) {
grpc_lb_subchannel_list_shutdown_and_unref(
exec_ctx, p->latest_pending_subchannel_list, "pf_shutdown");
- p->latest_pending_subchannel_list = NULL;
+ p->latest_pending_subchannel_list = nullptr;
}
GRPC_ERROR_UNREF(error);
}
@@ -110,11 +110,11 @@ static void pf_cancel_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
grpc_error* error) {
pick_first_lb_policy* p = (pick_first_lb_policy*)pol;
pending_pick* pp = p->pending_picks;
- p->pending_picks = NULL;
- while (pp != NULL) {
+ p->pending_picks = nullptr;
+ while (pp != nullptr) {
pending_pick* next = pp->next;
if (pp->target == target) {
- *target = NULL;
+ *target = nullptr;
GRPC_CLOSURE_SCHED(exec_ctx, pp->on_complete,
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
"Pick Cancelled", &error, 1));
@@ -134,8 +134,8 @@ static void pf_cancel_picks_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
grpc_error* error) {
pick_first_lb_policy* p = (pick_first_lb_policy*)pol;
pending_pick* pp = p->pending_picks;
- p->pending_picks = NULL;
- while (pp != NULL) {
+ p->pending_picks = nullptr;
+ while (pp != nullptr) {
pending_pick* next = pp->next;
if ((pp->initial_metadata_flags & initial_metadata_flags_mask) ==
initial_metadata_flags_eq) {
@@ -155,7 +155,8 @@ static void pf_cancel_picks_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
static void start_picking_locked(grpc_exec_ctx* exec_ctx,
pick_first_lb_policy* p) {
p->started_picking = true;
- if (p->subchannel_list != NULL && p->subchannel_list->num_subchannels > 0) {
+ if (p->subchannel_list != nullptr &&
+ p->subchannel_list->num_subchannels > 0) {
p->subchannel_list->checking_subchannel = 0;
grpc_lb_subchannel_list_ref_for_connectivity_watch(
p->subchannel_list, "connectivity_watch+start_picking");
@@ -178,7 +179,7 @@ static int pf_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
grpc_closure* on_complete) {
pick_first_lb_policy* p = (pick_first_lb_policy*)pol;
// If we have a selected subchannel already, return synchronously.
- if (p->selected != NULL) {
+ if (p->selected != nullptr) {
*target = GRPC_CONNECTED_SUBCHANNEL_REF(p->selected->connected_subchannel,
"picked");
return 1;
@@ -242,8 +243,8 @@ static void pf_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
pick_first_lb_policy* p = (pick_first_lb_policy*)policy;
const grpc_arg* arg =
grpc_channel_args_find(args->args, GRPC_ARG_LB_ADDRESSES);
- if (arg == NULL || arg->type != GRPC_ARG_POINTER) {
- if (p->subchannel_list == NULL) {
+ if (arg == nullptr || arg->type != GRPC_ARG_POINTER) {
+ if (p->subchannel_list == nullptr) {
// If we don't have a current subchannel list, go into TRANSIENT FAILURE.
grpc_connectivity_state_set(
exec_ctx, &p->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
@@ -274,18 +275,18 @@ static void pf_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
exec_ctx, &p->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Empty update"),
"pf_update_empty");
- if (p->subchannel_list != NULL) {
+ if (p->subchannel_list != nullptr) {
grpc_lb_subchannel_list_shutdown_and_unref(exec_ctx, p->subchannel_list,
"sl_shutdown_empty_update");
}
p->subchannel_list = subchannel_list; // Empty list.
- p->selected = NULL;
+ p->selected = nullptr;
return;
}
- if (p->selected == NULL) {
+ if (p->selected == nullptr) {
// We don't yet have a selected subchannel, so replace the current
// subchannel list immediately.
- if (p->subchannel_list != NULL) {
+ if (p->subchannel_list != nullptr) {
grpc_lb_subchannel_list_shutdown_and_unref(exec_ctx, p->subchannel_list,
"pf_update_before_selected");
}
@@ -307,12 +308,12 @@ static void pf_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
grpc_lb_subchannel_list_ref_for_connectivity_watch(
subchannel_list, "connectivity_watch+replace_selected");
grpc_lb_subchannel_data_start_connectivity_watch(exec_ctx, sd);
- if (p->subchannel_list != NULL) {
+ if (p->subchannel_list != nullptr) {
grpc_lb_subchannel_list_shutdown_and_unref(
exec_ctx, p->subchannel_list, "pf_update_includes_selected");
}
p->subchannel_list = subchannel_list;
- if (p->selected->connected_subchannel != NULL) {
+ if (p->selected->connected_subchannel != nullptr) {
sd->connected_subchannel = GRPC_CONNECTED_SUBCHANNEL_REF(
p->selected->connected_subchannel, "pf_update_includes_selected");
}
@@ -321,11 +322,11 @@ static void pf_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
// If there was a previously pending update (which may or may
// not have contained the currently selected subchannel), drop
// it, so that it doesn't override what we've done here.
- if (p->latest_pending_subchannel_list != NULL) {
+ if (p->latest_pending_subchannel_list != nullptr) {
grpc_lb_subchannel_list_shutdown_and_unref(
exec_ctx, p->latest_pending_subchannel_list,
"pf_update_includes_selected+outdated");
- p->latest_pending_subchannel_list = NULL;
+ p->latest_pending_subchannel_list = nullptr;
}
return;
}
@@ -334,7 +335,7 @@ static void pf_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
// pending subchannel list to the new subchannel list. We will wait
// for it to report READY before swapping it into the current
// subchannel list.
- if (p->latest_pending_subchannel_list != NULL) {
+ if (p->latest_pending_subchannel_list != nullptr) {
if (GRPC_TRACER_ON(grpc_lb_pick_first_trace)) {
gpr_log(GPR_DEBUG,
"Pick First %p Shutting down latest pending subchannel list "
@@ -402,12 +403,12 @@ static void pf_connectivity_changed_locked(grpc_exec_ctx* exec_ctx, void* arg,
// If the new state is anything other than READY and there is a
// pending update, switch to the pending update.
if (sd->curr_connectivity_state != GRPC_CHANNEL_READY &&
- p->latest_pending_subchannel_list != NULL) {
- p->selected = NULL;
+ p->latest_pending_subchannel_list != nullptr) {
+ p->selected = nullptr;
grpc_lb_subchannel_list_shutdown_and_unref(
exec_ctx, p->subchannel_list, "selected_not_ready+switch_to_update");
p->subchannel_list = p->latest_pending_subchannel_list;
- p->latest_pending_subchannel_list = NULL;
+ p->latest_pending_subchannel_list = nullptr;
grpc_connectivity_state_set(
exec_ctx, &p->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
GRPC_ERROR_REF(error), "selected_not_ready+switch_to_update");
@@ -445,11 +446,11 @@ static void pf_connectivity_changed_locked(grpc_exec_ctx* exec_ctx, void* arg,
// Case 2. Promote p->latest_pending_subchannel_list to
// p->subchannel_list.
if (sd->subchannel_list == p->latest_pending_subchannel_list) {
- GPR_ASSERT(p->subchannel_list != NULL);
+ GPR_ASSERT(p->subchannel_list != nullptr);
grpc_lb_subchannel_list_shutdown_and_unref(exec_ctx, p->subchannel_list,
"finish_update");
p->subchannel_list = p->latest_pending_subchannel_list;
- p->latest_pending_subchannel_list = NULL;
+ p->latest_pending_subchannel_list = nullptr;
}
// Cases 1 and 2.
grpc_connectivity_state_set(exec_ctx, &p->state_tracker,
@@ -491,7 +492,7 @@ static void pf_connectivity_changed_locked(grpc_exec_ctx* exec_ctx, void* arg,
sd->subchannel_list->num_subchannels;
sd = &sd->subchannel_list
->subchannels[sd->subchannel_list->checking_subchannel];
- } while (sd->subchannel == NULL);
+ } while (sd->subchannel == nullptr);
// Case 1: Only set state to TRANSIENT_FAILURE if we've tried
// all subchannels.
if (sd->subchannel_list->checking_subchannel == 0 &&
@@ -528,7 +529,7 @@ static void pf_connectivity_changed_locked(grpc_exec_ctx* exec_ctx, void* arg,
sd->subchannel_list->num_subchannels;
sd = &sd->subchannel_list
->subchannels[sd->subchannel_list->checking_subchannel];
- } while (sd->subchannel == NULL && sd != original_sd);
+ } while (sd->subchannel == nullptr && sd != original_sd);
if (sd == original_sd) {
grpc_lb_subchannel_list_unref_for_connectivity_watch(
exec_ctx, sd->subchannel_list, "pf_candidate_shutdown");
@@ -568,7 +569,7 @@ static void pick_first_factory_unref(grpc_lb_policy_factory* factory) {}
static grpc_lb_policy* create_pick_first(grpc_exec_ctx* exec_ctx,
grpc_lb_policy_factory* factory,
grpc_lb_policy_args* args) {
- GPR_ASSERT(args->client_channel_factory != NULL);
+ GPR_ASSERT(args->client_channel_factory != nullptr);
pick_first_lb_policy* p = (pick_first_lb_policy*)gpr_zalloc(sizeof(*p));
if (GRPC_TRACER_ON(grpc_lb_pick_first_trace)) {
gpr_log(GPR_DEBUG, "Pick First %p created.", (void*)p);
diff --git a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
index df235922c8..6ea1f025df 100644
--- a/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/round_robin/round_robin.cc
@@ -100,7 +100,7 @@ typedef struct round_robin_lb_policy {
* The caller must do that if it returns a pick. */
static size_t get_next_ready_subchannel_index_locked(
const round_robin_lb_policy* p) {
- GPR_ASSERT(p->subchannel_list != NULL);
+ GPR_ASSERT(p->subchannel_list != nullptr);
if (GRPC_TRACER_ON(grpc_lb_round_robin_trace)) {
gpr_log(GPR_INFO,
"[RR %p] getting next ready subchannel (out of %lu), "
@@ -161,8 +161,8 @@ static void rr_destroy(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol) {
gpr_log(GPR_DEBUG, "[RR %p] Destroying Round Robin policy at %p",
(void*)pol, (void*)pol);
}
- GPR_ASSERT(p->subchannel_list == NULL);
- GPR_ASSERT(p->latest_pending_subchannel_list == NULL);
+ GPR_ASSERT(p->subchannel_list == nullptr);
+ GPR_ASSERT(p->latest_pending_subchannel_list == nullptr);
grpc_connectivity_state_destroy(exec_ctx, &p->state_tracker);
grpc_subchannel_index_unref();
gpr_free(p);
@@ -175,25 +175,25 @@ static void shutdown_locked(grpc_exec_ctx* exec_ctx, round_robin_lb_policy* p,
}
p->shutdown = true;
pending_pick* pp;
- while ((pp = p->pending_picks) != NULL) {
+ while ((pp = p->pending_picks) != nullptr) {
p->pending_picks = pp->next;
- *pp->target = NULL;
+ *pp->target = nullptr;
GRPC_CLOSURE_SCHED(exec_ctx, pp->on_complete, GRPC_ERROR_REF(error));
gpr_free(pp);
}
grpc_connectivity_state_set(exec_ctx, &p->state_tracker,
GRPC_CHANNEL_SHUTDOWN, GRPC_ERROR_REF(error),
"rr_shutdown");
- if (p->subchannel_list != NULL) {
+ if (p->subchannel_list != nullptr) {
grpc_lb_subchannel_list_shutdown_and_unref(exec_ctx, p->subchannel_list,
"sl_shutdown_rr_shutdown");
- p->subchannel_list = NULL;
+ p->subchannel_list = nullptr;
}
- if (p->latest_pending_subchannel_list != NULL) {
+ if (p->latest_pending_subchannel_list != nullptr) {
grpc_lb_subchannel_list_shutdown_and_unref(
exec_ctx, p->latest_pending_subchannel_list,
"sl_shutdown_pending_rr_shutdown");
- p->latest_pending_subchannel_list = NULL;
+ p->latest_pending_subchannel_list = nullptr;
}
GRPC_ERROR_UNREF(error);
}
@@ -209,11 +209,11 @@ static void rr_cancel_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
grpc_error* error) {
round_robin_lb_policy* p = (round_robin_lb_policy*)pol;
pending_pick* pp = p->pending_picks;
- p->pending_picks = NULL;
- while (pp != NULL) {
+ p->pending_picks = nullptr;
+ while (pp != nullptr) {
pending_pick* next = pp->next;
if (pp->target == target) {
- *target = NULL;
+ *target = nullptr;
GRPC_CLOSURE_SCHED(exec_ctx, pp->on_complete,
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
"Pick cancelled", &error, 1));
@@ -233,12 +233,12 @@ static void rr_cancel_picks_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
grpc_error* error) {
round_robin_lb_policy* p = (round_robin_lb_policy*)pol;
pending_pick* pp = p->pending_picks;
- p->pending_picks = NULL;
- while (pp != NULL) {
+ p->pending_picks = nullptr;
+ while (pp != nullptr) {
pending_pick* next = pp->next;
if ((pp->initial_metadata_flags & initial_metadata_flags_mask) ==
initial_metadata_flags_eq) {
- *pp->target = NULL;
+ *pp->target = nullptr;
GRPC_CLOSURE_SCHED(exec_ctx, pp->on_complete,
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
"Pick cancelled", &error, 1));
@@ -281,7 +281,7 @@ static int rr_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
p->shutdown);
}
GPR_ASSERT(!p->shutdown);
- if (p->subchannel_list != NULL) {
+ if (p->subchannel_list != nullptr) {
const size_t next_ready_index = get_next_ready_subchannel_index_locked(p);
if (next_ready_index < p->subchannel_list->num_subchannels) {
/* readily available, report right away */
@@ -289,7 +289,7 @@ static int rr_pick_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* pol,
&p->subchannel_list->subchannels[next_ready_index];
*target =
GRPC_CONNECTED_SUBCHANNEL_REF(sd->connected_subchannel, "rr_picked");
- if (user_data != NULL) {
+ if (user_data != nullptr) {
*user_data = sd->user_data;
}
if (GRPC_TRACER_ON(grpc_lb_round_robin_trace)) {
@@ -472,7 +472,7 @@ static void rr_connectivity_changed_locked(grpc_exec_ctx* exec_ctx, void* arg,
}
} else { // sd not in SHUTDOWN
if (sd->curr_connectivity_state == GRPC_CHANNEL_READY) {
- if (sd->connected_subchannel == NULL) {
+ if (sd->connected_subchannel == nullptr) {
sd->connected_subchannel = GRPC_CONNECTED_SUBCHANNEL_REF(
grpc_subchannel_get_connected_subchannel(sd->subchannel),
"connected");
@@ -486,7 +486,7 @@ static void rr_connectivity_changed_locked(grpc_exec_ctx* exec_ctx, void* arg,
GPR_ASSERT(!sd->subchannel_list->shutting_down);
if (GRPC_TRACER_ON(grpc_lb_round_robin_trace)) {
const unsigned long num_subchannels =
- p->subchannel_list != NULL
+ p->subchannel_list != nullptr
? (unsigned long)p->subchannel_list->num_subchannels
: 0;
gpr_log(GPR_DEBUG,
@@ -495,13 +495,13 @@ static void rr_connectivity_changed_locked(grpc_exec_ctx* exec_ctx, void* arg,
(void*)p, (void*)p->subchannel_list, num_subchannels,
(void*)sd->subchannel_list, num_subchannels);
}
- if (p->subchannel_list != NULL) {
+ if (p->subchannel_list != nullptr) {
// dispose of the current subchannel_list
grpc_lb_subchannel_list_shutdown_and_unref(
exec_ctx, p->subchannel_list, "sl_phase_out_shutdown");
}
p->subchannel_list = p->latest_pending_subchannel_list;
- p->latest_pending_subchannel_list = NULL;
+ p->latest_pending_subchannel_list = nullptr;
}
/* at this point we know there's at least one suitable subchannel. Go
* ahead and pick one and notify the pending suitors in
@@ -510,7 +510,7 @@ static void rr_connectivity_changed_locked(grpc_exec_ctx* exec_ctx, void* arg,
GPR_ASSERT(next_ready_index < p->subchannel_list->num_subchannels);
grpc_lb_subchannel_data* selected =
&p->subchannel_list->subchannels[next_ready_index];
- if (p->pending_picks != NULL) {
+ if (p->pending_picks != nullptr) {
// if the selected subchannel is going to be used for the pending
// picks, update the last picked pointer
update_last_ready_subchannel_index_locked(p, next_ready_index);
@@ -520,7 +520,7 @@ static void rr_connectivity_changed_locked(grpc_exec_ctx* exec_ctx, void* arg,
p->pending_picks = pp->next;
*pp->target = GRPC_CONNECTED_SUBCHANNEL_REF(
selected->connected_subchannel, "rr_picked");
- if (pp->user_data != NULL) {
+ if (pp->user_data != nullptr) {
*pp->user_data = selected->user_data;
}
if (GRPC_TRACER_ON(grpc_lb_round_robin_trace)) {
@@ -577,11 +577,11 @@ static void rr_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
round_robin_lb_policy* p = (round_robin_lb_policy*)policy;
const grpc_arg* arg =
grpc_channel_args_find(args->args, GRPC_ARG_LB_ADDRESSES);
- if (arg == NULL || arg->type != GRPC_ARG_POINTER) {
+ if (arg == nullptr || arg->type != GRPC_ARG_POINTER) {
gpr_log(GPR_ERROR, "[RR %p] update provided no addresses; ignoring", p);
// If we don't have a current subchannel list, go into TRANSIENT_FAILURE.
// Otherwise, keep using the current subchannel list (ignore this update).
- if (p->subchannel_list == NULL) {
+ if (p->subchannel_list == nullptr) {
grpc_connectivity_state_set(
exec_ctx, &p->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Missing update in args"),
@@ -602,7 +602,7 @@ static void rr_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
exec_ctx, &p->state_tracker, GRPC_CHANNEL_TRANSIENT_FAILURE,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Empty update"),
"rr_update_empty");
- if (p->subchannel_list != NULL) {
+ if (p->subchannel_list != nullptr) {
grpc_lb_subchannel_list_shutdown_and_unref(exec_ctx, p->subchannel_list,
"sl_shutdown_empty_update");
}
@@ -610,7 +610,7 @@ static void rr_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
return;
}
if (p->started_picking) {
- if (p->latest_pending_subchannel_list != NULL) {
+ if (p->latest_pending_subchannel_list != nullptr) {
if (GRPC_TRACER_ON(grpc_lb_round_robin_trace)) {
gpr_log(GPR_DEBUG,
"[RR %p] Shutting down latest pending subchannel list %p, "
@@ -635,7 +635,7 @@ static void rr_update_locked(grpc_exec_ctx* exec_ctx, grpc_lb_policy* policy,
} else {
// The policy isn't picking yet. Save the update for later, disposing of
// previous version if any.
- if (p->subchannel_list != NULL) {
+ if (p->subchannel_list != nullptr) {
grpc_lb_subchannel_list_shutdown_and_unref(
exec_ctx, p->subchannel_list, "rr_update_before_started_picking");
}
@@ -662,7 +662,7 @@ static void round_robin_factory_unref(grpc_lb_policy_factory* factory) {}
static grpc_lb_policy* round_robin_create(grpc_exec_ctx* exec_ctx,
grpc_lb_policy_factory* factory,
grpc_lb_policy_args* args) {
- GPR_ASSERT(args->client_channel_factory != NULL);
+ GPR_ASSERT(args->client_channel_factory != nullptr);
round_robin_lb_policy* p = (round_robin_lb_policy*)gpr_zalloc(sizeof(*p));
grpc_lb_policy_init(&p->base, &round_robin_lb_policy_vtable, args->combiner);
grpc_subchannel_index_ref();
diff --git a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc
index db38ef5305..27d9598ac4 100644
--- a/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc
+++ b/src/core/ext/filters/client_channel/lb_policy/subchannel_list.cc
@@ -31,7 +31,7 @@
void grpc_lb_subchannel_data_unref_subchannel(grpc_exec_ctx* exec_ctx,
grpc_lb_subchannel_data* sd,
const char* reason) {
- if (sd->subchannel != NULL) {
+ if (sd->subchannel != nullptr) {
if (GRPC_TRACER_ON(*sd->subchannel_list->tracer)) {
gpr_log(GPR_DEBUG,
"[%s %p] subchannel list %p index %" PRIuPTR " of %" PRIuPTR
@@ -42,16 +42,16 @@ void grpc_lb_subchannel_data_unref_subchannel(grpc_exec_ctx* exec_ctx,
sd->subchannel_list->num_subchannels, sd->subchannel);
}
GRPC_SUBCHANNEL_UNREF(exec_ctx, sd->subchannel, reason);
- sd->subchannel = NULL;
- if (sd->connected_subchannel != NULL) {
+ sd->subchannel = nullptr;
+ if (sd->connected_subchannel != nullptr) {
GRPC_CONNECTED_SUBCHANNEL_UNREF(exec_ctx, sd->connected_subchannel,
reason);
- sd->connected_subchannel = NULL;
+ sd->connected_subchannel = nullptr;
}
- if (sd->user_data != NULL) {
- GPR_ASSERT(sd->user_data_vtable != NULL);
+ if (sd->user_data != nullptr) {
+ GPR_ASSERT(sd->user_data_vtable != nullptr);
sd->user_data_vtable->destroy(exec_ctx, sd->user_data);
- sd->user_data = NULL;
+ sd->user_data = nullptr;
}
}
}
@@ -126,7 +126,7 @@ grpc_lb_subchannel_list* grpc_lb_subchannel_list_create(
grpc_subchannel* subchannel = grpc_client_channel_factory_create_subchannel(
exec_ctx, args->client_channel_factory, &sc_args);
grpc_channel_args_destroy(exec_ctx, new_args);
- if (subchannel == NULL) {
+ if (subchannel == nullptr) {
// Subchannel could not be created.
if (GRPC_TRACER_ON(*tracer)) {
char* address_uri =
@@ -162,7 +162,7 @@ grpc_lb_subchannel_list* grpc_lb_subchannel_list_create(
sd->curr_connectivity_state = GRPC_CHANNEL_IDLE;
sd->pending_connectivity_state_unsafe = GRPC_CHANNEL_IDLE;
sd->user_data_vtable = addresses->user_data_vtable;
- if (sd->user_data_vtable != NULL) {
+ if (sd->user_data_vtable != nullptr) {
sd->user_data =
sd->user_data_vtable->copy(addresses->addresses[i].user_data);
}
@@ -240,7 +240,8 @@ static void subchannel_data_cancel_connectivity_watch(
(size_t)(sd - sd->subchannel_list->subchannels),
sd->subchannel_list->num_subchannels, sd->subchannel, reason);
}
- grpc_subchannel_notify_on_state_change(exec_ctx, sd->subchannel, NULL, NULL,
+ grpc_subchannel_notify_on_state_change(exec_ctx, sd->subchannel, nullptr,
+ nullptr,
&sd->connectivity_changed_closure);
}
@@ -261,7 +262,7 @@ void grpc_lb_subchannel_list_shutdown_and_unref(
// Otherwise, unref the subchannel directly.
if (sd->connectivity_notification_pending) {
subchannel_data_cancel_connectivity_watch(exec_ctx, sd, reason);
- } else if (sd->subchannel != NULL) {
+ } else if (sd->subchannel != nullptr) {
grpc_lb_subchannel_data_unref_subchannel(exec_ctx, sd, reason);
}
}
diff --git a/src/core/ext/filters/client_channel/lb_policy_factory.cc b/src/core/ext/filters/client_channel/lb_policy_factory.cc
index 05ab43d0b6..d43f9fd1b9 100644
--- a/src/core/ext/filters/client_channel/lb_policy_factory.cc
+++ b/src/core/ext/filters/client_channel/lb_policy_factory.cc
@@ -43,11 +43,11 @@ grpc_lb_addresses* grpc_lb_addresses_copy(const grpc_lb_addresses* addresses) {
memcpy(new_addresses->addresses, addresses->addresses,
sizeof(grpc_lb_address) * addresses->num_addresses);
for (size_t i = 0; i < addresses->num_addresses; ++i) {
- if (new_addresses->addresses[i].balancer_name != NULL) {
+ if (new_addresses->addresses[i].balancer_name != nullptr) {
new_addresses->addresses[i].balancer_name =
gpr_strdup(new_addresses->addresses[i].balancer_name);
}
- if (new_addresses->addresses[i].user_data != NULL) {
+ if (new_addresses->addresses[i].user_data != nullptr) {
new_addresses->addresses[i].user_data = addresses->user_data_vtable->copy(
new_addresses->addresses[i].user_data);
}
@@ -60,7 +60,7 @@ void grpc_lb_addresses_set_address(grpc_lb_addresses* addresses, size_t index,
bool is_balancer, const char* balancer_name,
void* user_data) {
GPR_ASSERT(index < addresses->num_addresses);
- if (user_data != NULL) GPR_ASSERT(addresses->user_data_vtable != NULL);
+ if (user_data != nullptr) GPR_ASSERT(addresses->user_data_vtable != nullptr);
grpc_lb_address* target = &addresses->addresses[index];
memcpy(target->address.addr, address, address_len);
target->address.len = address_len;
@@ -98,12 +98,12 @@ int grpc_lb_addresses_cmp(const grpc_lb_addresses* addresses1,
if (target1->is_balancer > target2->is_balancer) return 1;
if (target1->is_balancer < target2->is_balancer) return -1;
const char* balancer_name1 =
- target1->balancer_name != NULL ? target1->balancer_name : "";
+ target1->balancer_name != nullptr ? target1->balancer_name : "";
const char* balancer_name2 =
- target2->balancer_name != NULL ? target2->balancer_name : "";
+ target2->balancer_name != nullptr ? target2->balancer_name : "";
retval = strcmp(balancer_name1, balancer_name2);
if (retval != 0) return retval;
- if (addresses1->user_data_vtable != NULL) {
+ if (addresses1->user_data_vtable != nullptr) {
retval = addresses1->user_data_vtable->cmp(target1->user_data,
target2->user_data);
if (retval != 0) return retval;
@@ -116,7 +116,7 @@ void grpc_lb_addresses_destroy(grpc_exec_ctx* exec_ctx,
grpc_lb_addresses* addresses) {
for (size_t i = 0; i < addresses->num_addresses; ++i) {
gpr_free(addresses->addresses[i].balancer_name);
- if (addresses->addresses[i].user_data != NULL) {
+ if (addresses->addresses[i].user_data != nullptr) {
addresses->user_data_vtable->destroy(exec_ctx,
addresses->addresses[i].user_data);
}
@@ -148,8 +148,8 @@ grpc_lb_addresses* grpc_lb_addresses_find_channel_arg(
const grpc_channel_args* channel_args) {
const grpc_arg* lb_addresses_arg =
grpc_channel_args_find(channel_args, GRPC_ARG_LB_ADDRESSES);
- if (lb_addresses_arg == NULL || lb_addresses_arg->type != GRPC_ARG_POINTER)
- return NULL;
+ if (lb_addresses_arg == nullptr || lb_addresses_arg->type != GRPC_ARG_POINTER)
+ return nullptr;
return (grpc_lb_addresses*)lb_addresses_arg->value.pointer.p;
}
@@ -164,6 +164,6 @@ void grpc_lb_policy_factory_unref(grpc_lb_policy_factory* factory) {
grpc_lb_policy* grpc_lb_policy_factory_create_lb_policy(
grpc_exec_ctx* exec_ctx, grpc_lb_policy_factory* factory,
grpc_lb_policy_args* args) {
- if (factory == NULL) return NULL;
+ if (factory == nullptr) return nullptr;
return factory->vtable->create_lb_policy(exec_ctx, factory, args);
}
diff --git a/src/core/ext/filters/client_channel/lb_policy_registry.cc b/src/core/ext/filters/client_channel/lb_policy_registry.cc
index 7b0a926a1b..6e710e86d9 100644
--- a/src/core/ext/filters/client_channel/lb_policy_registry.cc
+++ b/src/core/ext/filters/client_channel/lb_policy_registry.cc
@@ -50,7 +50,7 @@ void grpc_register_lb_policy(grpc_lb_policy_factory* factory) {
static grpc_lb_policy_factory* lookup_factory(const char* name) {
int i;
- if (name == NULL) return NULL;
+ if (name == nullptr) return nullptr;
for (i = 0; i < g_number_of_lb_policies; i++) {
if (0 == gpr_stricmp(name, g_all_of_the_lb_policies[i]->vtable->name)) {
@@ -58,7 +58,7 @@ static grpc_lb_policy_factory* lookup_factory(const char* name) {
}
}
- return NULL;
+ return nullptr;
}
grpc_lb_policy* grpc_lb_policy_create(grpc_exec_ctx* exec_ctx, const char* name,
diff --git a/src/core/ext/filters/client_channel/parse_address.cc b/src/core/ext/filters/client_channel/parse_address.cc
index 6cf77f13bc..39b1237c77 100644
--- a/src/core/ext/filters/client_channel/parse_address.cc
+++ b/src/core/ext/filters/client_channel/parse_address.cc
@@ -75,7 +75,7 @@ bool grpc_parse_ipv4_hostport(const char* hostport, grpc_resolved_address* addr,
goto done;
}
// Parse port.
- if (port == NULL) {
+ if (port == nullptr) {
if (log_errors) gpr_log(GPR_ERROR, "no port given for ipv4 scheme");
goto done;
}
@@ -118,7 +118,7 @@ bool grpc_parse_ipv6_hostport(const char* hostport, grpc_resolved_address* addr,
in6->sin6_family = AF_INET6;
// Handle the RFC6874 syntax for IPv6 zone identifiers.
char* host_end = (char*)gpr_memrchr(host, '%', strlen(host));
- if (host_end != NULL) {
+ if (host_end != nullptr) {
GPR_ASSERT(host_end >= host);
char host_without_scope[INET6_ADDRSTRLEN];
size_t host_without_scope_len = (size_t)(host_end - host);
@@ -144,7 +144,7 @@ bool grpc_parse_ipv6_hostport(const char* hostport, grpc_resolved_address* addr,
}
}
// Parse port.
- if (port == NULL) {
+ if (port == nullptr) {
if (log_errors) gpr_log(GPR_ERROR, "no port given for ipv6 scheme");
goto done;
}
diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
index 76f08281f7..07737b19d2 100644
--- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
+++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
@@ -121,15 +121,15 @@ static void dns_ares_shutdown_locked(grpc_exec_ctx* exec_ctx,
if (r->have_retry_timer) {
grpc_timer_cancel(exec_ctx, &r->retry_timer);
}
- if (r->pending_request != NULL) {
+ if (r->pending_request != nullptr) {
grpc_cancel_ares_request(exec_ctx, r->pending_request);
}
- if (r->next_completion != NULL) {
- *r->target_result = NULL;
+ if (r->next_completion != nullptr) {
+ *r->target_result = nullptr;
GRPC_CLOSURE_SCHED(
exec_ctx, r->next_completion,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Resolver Shutdown"));
- r->next_completion = NULL;
+ r->next_completion = nullptr;
}
}
@@ -155,7 +155,7 @@ static void dns_ares_on_retry_timer_locked(grpc_exec_ctx* exec_ctx, void* arg,
}
static bool value_in_json_array(grpc_json* array, const char* value) {
- for (grpc_json* entry = array->child; entry != NULL; entry = entry->next) {
+ for (grpc_json* entry = array->child; entry != nullptr; entry = entry->next) {
if (entry->type == GRPC_JSON_STRING && strcmp(entry->value, value) == 0) {
return true;
}
@@ -165,47 +165,48 @@ static bool value_in_json_array(grpc_json* array, const char* value) {
static char* choose_service_config(char* service_config_choice_json) {
grpc_json* choices_json = grpc_json_parse_string(service_config_choice_json);
- if (choices_json == NULL || choices_json->type != GRPC_JSON_ARRAY) {
+ if (choices_json == nullptr || choices_json->type != GRPC_JSON_ARRAY) {
gpr_log(GPR_ERROR, "cannot parse service config JSON string");
- return NULL;
+ return nullptr;
}
- char* service_config = NULL;
- for (grpc_json* choice = choices_json->child; choice != NULL;
+ char* service_config = nullptr;
+ for (grpc_json* choice = choices_json->child; choice != nullptr;
choice = choice->next) {
if (choice->type != GRPC_JSON_OBJECT) {
gpr_log(GPR_ERROR, "cannot parse service config JSON string");
break;
}
- grpc_json* service_config_json = NULL;
- for (grpc_json* field = choice->child; field != NULL; field = field->next) {
+ grpc_json* service_config_json = nullptr;
+ for (grpc_json* field = choice->child; field != nullptr;
+ field = field->next) {
// Check client language, if specified.
if (strcmp(field->key, "clientLanguage") == 0) {
if (field->type != GRPC_JSON_ARRAY ||
!value_in_json_array(field, "c++")) {
- service_config_json = NULL;
+ service_config_json = nullptr;
break;
}
}
// Check client hostname, if specified.
if (strcmp(field->key, "clientHostname") == 0) {
char* hostname = grpc_gethostname();
- if (hostname == NULL || field->type != GRPC_JSON_ARRAY ||
+ if (hostname == nullptr || field->type != GRPC_JSON_ARRAY ||
!value_in_json_array(field, hostname)) {
- service_config_json = NULL;
+ service_config_json = nullptr;
break;
}
}
// Check percentage, if specified.
if (strcmp(field->key, "percentage") == 0) {
if (field->type != GRPC_JSON_NUMBER) {
- service_config_json = NULL;
+ service_config_json = nullptr;
break;
}
int random_pct = rand() % 100;
int percentage;
if (sscanf(field->value, "%d", &percentage) != 1 ||
random_pct > percentage || percentage == 0) {
- service_config_json = NULL;
+ service_config_json = nullptr;
break;
}
}
@@ -216,7 +217,7 @@ static char* choose_service_config(char* service_config_choice_json) {
}
}
}
- if (service_config_json != NULL) {
+ if (service_config_json != nullptr) {
service_config = grpc_json_dump_to_string(service_config_json, 0);
break;
}
@@ -228,33 +229,33 @@ static char* choose_service_config(char* service_config_choice_json) {
static void dns_ares_on_resolved_locked(grpc_exec_ctx* exec_ctx, void* arg,
grpc_error* error) {
ares_dns_resolver* r = (ares_dns_resolver*)arg;
- grpc_channel_args* result = NULL;
+ grpc_channel_args* result = nullptr;
GPR_ASSERT(r->resolving);
r->resolving = false;
- r->pending_request = NULL;
- if (r->lb_addresses != NULL) {
+ r->pending_request = nullptr;
+ if (r->lb_addresses != nullptr) {
static const char* args_to_remove[2];
size_t num_args_to_remove = 0;
grpc_arg new_args[3];
size_t num_args_to_add = 0;
new_args[num_args_to_add++] =
grpc_lb_addresses_create_channel_arg(r->lb_addresses);
- grpc_service_config* service_config = NULL;
- char* service_config_string = NULL;
- if (r->service_config_json != NULL) {
+ grpc_service_config* service_config = nullptr;
+ char* service_config_string = nullptr;
+ if (r->service_config_json != nullptr) {
service_config_string = choose_service_config(r->service_config_json);
gpr_free(r->service_config_json);
- if (service_config_string != NULL) {
+ if (service_config_string != nullptr) {
gpr_log(GPR_INFO, "selected service config choice: %s",
service_config_string);
args_to_remove[num_args_to_remove++] = GRPC_ARG_SERVICE_CONFIG;
new_args[num_args_to_add++] = grpc_channel_arg_string_create(
(char*)GRPC_ARG_SERVICE_CONFIG, service_config_string);
service_config = grpc_service_config_create(service_config_string);
- if (service_config != NULL) {
+ if (service_config != nullptr) {
const char* lb_policy_name =
grpc_service_config_get_lb_policy_name(service_config);
- if (lb_policy_name != NULL) {
+ if (lb_policy_name != nullptr) {
args_to_remove[num_args_to_remove++] = GRPC_ARG_LB_POLICY_NAME;
new_args[num_args_to_add++] = grpc_channel_arg_string_create(
(char*)GRPC_ARG_LB_POLICY_NAME, (char*)lb_policy_name);
@@ -265,7 +266,7 @@ static void dns_ares_on_resolved_locked(grpc_exec_ctx* exec_ctx, void* arg,
result = grpc_channel_args_copy_and_add_and_remove(
r->channel_args, args_to_remove, num_args_to_remove, new_args,
num_args_to_add);
- if (service_config != NULL) grpc_service_config_destroy(service_config);
+ if (service_config != nullptr) grpc_service_config_destroy(service_config);
gpr_free(service_config_string);
grpc_lb_addresses_destroy(exec_ctx, r->lb_addresses);
} else {
@@ -287,7 +288,7 @@ static void dns_ares_on_resolved_locked(grpc_exec_ctx* exec_ctx, void* arg,
grpc_timer_init(exec_ctx, &r->retry_timer, next_try,
&r->dns_ares_on_retry_timer_locked);
}
- if (r->resolved_result != NULL) {
+ if (r->resolved_result != nullptr) {
grpc_channel_args_destroy(exec_ctx, r->resolved_result);
}
r->resolved_result = result;
@@ -318,25 +319,25 @@ static void dns_ares_start_resolving_locked(grpc_exec_ctx* exec_ctx,
GRPC_RESOLVER_REF(&r->base, "dns-resolving");
GPR_ASSERT(!r->resolving);
r->resolving = true;
- r->lb_addresses = NULL;
- r->service_config_json = NULL;
+ r->lb_addresses = nullptr;
+ r->service_config_json = nullptr;
r->pending_request = grpc_dns_lookup_ares(
exec_ctx, r->dns_server, r->name_to_resolve, r->default_port,
r->interested_parties, &r->dns_ares_on_resolved_locked, &r->lb_addresses,
true /* check_grpclb */,
- r->request_service_config ? &r->service_config_json : NULL);
+ r->request_service_config ? &r->service_config_json : nullptr);
}
static void dns_ares_maybe_finish_next_locked(grpc_exec_ctx* exec_ctx,
ares_dns_resolver* r) {
- if (r->next_completion != NULL &&
+ if (r->next_completion != nullptr &&
r->resolved_version != r->published_version) {
- *r->target_result = r->resolved_result == NULL
- ? NULL
+ *r->target_result = r->resolved_result == nullptr
+ ? nullptr
: grpc_channel_args_copy(r->resolved_result);
gpr_log(GPR_DEBUG, "dns_ares_maybe_finish_next_locked");
GRPC_CLOSURE_SCHED(exec_ctx, r->next_completion, GRPC_ERROR_NONE);
- r->next_completion = NULL;
+ r->next_completion = nullptr;
r->published_version = r->resolved_version;
}
}
@@ -344,7 +345,7 @@ static void dns_ares_maybe_finish_next_locked(grpc_exec_ctx* exec_ctx,
static void dns_ares_destroy(grpc_exec_ctx* exec_ctx, grpc_resolver* gr) {
gpr_log(GPR_DEBUG, "dns_ares_destroy");
ares_dns_resolver* r = (ares_dns_resolver*)gr;
- if (r->resolved_result != NULL) {
+ if (r->resolved_result != nullptr) {
grpc_channel_args_destroy(exec_ctx, r->resolved_result);
}
grpc_pollset_set_destroy(exec_ctx, r->interested_parties);
@@ -376,7 +377,7 @@ static grpc_resolver* dns_ares_create(grpc_exec_ctx* exec_ctx,
r->request_service_config = !grpc_channel_arg_get_integer(
arg, (grpc_integer_options){false, false, true});
r->interested_parties = grpc_pollset_set_create();
- if (args->pollset_set != NULL) {
+ if (args->pollset_set != nullptr) {
grpc_pollset_set_add_pollset_set(exec_ctx, r->interested_parties,
args->pollset_set);
}
@@ -428,7 +429,7 @@ extern "C" void grpc_resolver_dns_ares_init(void) {
char* resolver = gpr_getenv("GRPC_DNS_RESOLVER");
/* TODO(zyc): Turn on c-ares based resolver by default after the address
sorter and the CNAME support are added. */
- if (resolver != NULL && gpr_stricmp(resolver, "ares") == 0) {
+ if (resolver != nullptr && gpr_stricmp(resolver, "ares") == 0) {
grpc_error* error = grpc_ares_init();
if (error != GRPC_ERROR_NONE) {
GRPC_LOG_IF_ERROR("ares_library_init() failed", error);
@@ -442,7 +443,7 @@ extern "C" void grpc_resolver_dns_ares_init(void) {
extern "C" void grpc_resolver_dns_ares_shutdown(void) {
char* resolver = gpr_getenv("GRPC_DNS_RESOLVER");
- if (resolver != NULL && gpr_stricmp(resolver, "ares") == 0) {
+ if (resolver != nullptr && gpr_stricmp(resolver, "ares") == 0) {
grpc_ares_cleanup();
}
gpr_free(resolver);
diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h
index a5fb1f10e1..0062aa561a 100644
--- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h
+++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h
@@ -19,6 +19,7 @@
#ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_DNS_C_ARES_GRPC_ARES_EV_DRIVER_H
#define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_RESOLVER_DNS_C_ARES_GRPC_ARES_EV_DRIVER_H
+#include <ares.h>
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/iomgr/pollset_set.h"
diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc
index 2bb98c1a3f..4cb068a41d 100644
--- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc
+++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc
@@ -91,7 +91,7 @@ static void grpc_ares_ev_driver_unref(grpc_ares_ev_driver* ev_driver) {
gpr_log(GPR_DEBUG, "Unref ev_driver %" PRIuPTR, (uintptr_t)ev_driver);
if (gpr_unref(&ev_driver->refs)) {
gpr_log(GPR_DEBUG, "destroy ev_driver %" PRIuPTR, (uintptr_t)ev_driver);
- GPR_ASSERT(ev_driver->fds == NULL);
+ GPR_ASSERT(ev_driver->fds == nullptr);
gpr_mu_destroy(&ev_driver->mu);
ares_destroy(ev_driver->channel);
gpr_free(ev_driver);
@@ -106,7 +106,7 @@ static void fd_node_destroy(grpc_exec_ctx* exec_ctx, fd_node* fdn) {
/* c-ares library has closed the fd inside grpc_fd. This fd may be picked up
immediately by another thread, and should not be closed by the following
grpc_fd_orphan. */
- grpc_fd_orphan(exec_ctx, fdn->fd, NULL, NULL, true /* already_closed */,
+ grpc_fd_orphan(exec_ctx, fdn->fd, nullptr, nullptr, true /* already_closed */,
"c-ares query finished");
gpr_free(fdn);
}
@@ -142,7 +142,7 @@ grpc_error* grpc_ares_ev_driver_create(grpc_ares_ev_driver** ev_driver,
gpr_mu_init(&(*ev_driver)->mu);
gpr_ref_init(&(*ev_driver)->refs, 1);
(*ev_driver)->pollset_set = pollset_set;
- (*ev_driver)->fds = NULL;
+ (*ev_driver)->fds = nullptr;
(*ev_driver)->working = false;
(*ev_driver)->shutting_down = false;
return GRPC_ERROR_NONE;
@@ -165,7 +165,7 @@ void grpc_ares_ev_driver_shutdown(grpc_exec_ctx* exec_ctx,
gpr_mu_lock(&ev_driver->mu);
ev_driver->shutting_down = true;
fd_node* fn = ev_driver->fds;
- while (fn != NULL) {
+ while (fn != nullptr) {
grpc_fd_shutdown(
exec_ctx, fn->fd,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("grpc_ares_ev_driver_shutdown"));
@@ -180,7 +180,7 @@ static fd_node* pop_fd_node(fd_node** head, int fd) {
fd_node dummy_head;
dummy_head.next = *head;
fd_node* node = &dummy_head;
- while (node->next != NULL) {
+ while (node->next != nullptr) {
if (grpc_fd_wrapped_fd(node->next->fd) == fd) {
fd_node* ret = node->next;
node->next = node->next->next;
@@ -189,7 +189,7 @@ static fd_node* pop_fd_node(fd_node** head, int fd) {
}
node = node->next;
}
- return NULL;
+ return nullptr;
}
/* Check if \a fd is still readable */
@@ -275,7 +275,7 @@ ares_channel* grpc_ares_ev_driver_get_channel(grpc_ares_ev_driver* ev_driver) {
// driver_closure with these filedescriptors.
static void grpc_ares_notify_on_event_locked(grpc_exec_ctx* exec_ctx,
grpc_ares_ev_driver* ev_driver) {
- fd_node* new_list = NULL;
+ fd_node* new_list = nullptr;
if (!ev_driver->shutting_down) {
ares_socket_t socks[ARES_GETSOCK_MAXNUM];
int socks_bitmask =
@@ -285,7 +285,7 @@ static void grpc_ares_notify_on_event_locked(grpc_exec_ctx* exec_ctx,
ARES_GETSOCK_WRITABLE(socks_bitmask, i)) {
fd_node* fdn = pop_fd_node(&ev_driver->fds, socks[i]);
// Create a new fd_node if sock[i] is not in the fd_node list.
- if (fdn == NULL) {
+ if (fdn == nullptr) {
char* fd_name;
gpr_asprintf(&fd_name, "ares_ev_driver-%" PRIuPTR, i);
fdn = (fd_node*)gpr_malloc(sizeof(fd_node));
@@ -332,14 +332,14 @@ static void grpc_ares_notify_on_event_locked(grpc_exec_ctx* exec_ctx,
// Any remaining fds in ev_driver->fds were not returned by ares_getsock() and
// are therefore no longer in use, so they can be shut down and removed from
// the list.
- while (ev_driver->fds != NULL) {
+ while (ev_driver->fds != nullptr) {
fd_node* cur = ev_driver->fds;
ev_driver->fds = ev_driver->fds->next;
fd_node_shutdown(exec_ctx, cur);
}
ev_driver->fds = new_list;
// If the ev driver has no working fd, all the tasks are done.
- if (new_list == NULL) {
+ if (new_list == nullptr) {
ev_driver->working = false;
gpr_log(GPR_DEBUG, "ev driver stop working");
}
diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
index 9408b9d81d..7271559432 100644
--- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
+++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
@@ -102,7 +102,7 @@ static void grpc_ares_request_unref(grpc_exec_ctx* exec_ctx,
request */
if (gpr_unref(&r->pending_queries)) {
/* TODO(zyc): Sort results with RFC6724 before invoking on_done. */
- if (exec_ctx == NULL) {
+ if (exec_ctx == nullptr) {
/* A new exec_ctx is created here, as the c-ares interface does not
provide one in ares_host_callback. It's safe to schedule on_done with
the newly created exec_ctx, since the caller has been warned not to
@@ -150,12 +150,12 @@ static void on_hostbyname_done_cb(void* arg, int status, int timeouts,
r->error = GRPC_ERROR_NONE;
r->success = true;
grpc_lb_addresses** lb_addresses = r->lb_addrs_out;
- if (*lb_addresses == NULL) {
- *lb_addresses = grpc_lb_addresses_create(0, NULL);
+ if (*lb_addresses == nullptr) {
+ *lb_addresses = grpc_lb_addresses_create(0, nullptr);
}
size_t prev_naddr = (*lb_addresses)->num_addresses;
size_t i;
- for (i = 0; hostent->h_addr_list[i] != NULL; i++) {
+ for (i = 0; hostent->h_addr_list[i] != nullptr; i++) {
}
(*lb_addresses)->num_addresses += i;
(*lb_addresses)->addresses = (grpc_lb_address*)gpr_realloc(
@@ -174,8 +174,8 @@ static void on_hostbyname_done_cb(void* arg, int status, int timeouts,
grpc_lb_addresses_set_address(
*lb_addresses, i, &addr, addr_len,
hr->is_balancer /* is_balancer */,
- hr->is_balancer ? hr->host : NULL /* balancer_name */,
- NULL /* user_data */);
+ hr->is_balancer ? hr->host : nullptr /* balancer_name */,
+ nullptr /* user_data */);
char output[INET6_ADDRSTRLEN];
ares_inet_ntop(AF_INET6, &addr.sin6_addr, output, INET6_ADDRSTRLEN);
gpr_log(GPR_DEBUG,
@@ -195,8 +195,8 @@ static void on_hostbyname_done_cb(void* arg, int status, int timeouts,
grpc_lb_addresses_set_address(
*lb_addresses, i, &addr, addr_len,
hr->is_balancer /* is_balancer */,
- hr->is_balancer ? hr->host : NULL /* balancer_name */,
- NULL /* user_data */);
+ hr->is_balancer ? hr->host : nullptr /* balancer_name */,
+ nullptr /* user_data */);
char output[INET_ADDRSTRLEN];
ares_inet_ntop(AF_INET, &addr.sin_addr, output, INET_ADDRSTRLEN);
gpr_log(GPR_DEBUG,
@@ -220,7 +220,7 @@ static void on_hostbyname_done_cb(void* arg, int status, int timeouts,
}
}
gpr_mu_unlock(&r->mu);
- destroy_hostbyname_request(NULL, hr);
+ destroy_hostbyname_request(nullptr, hr);
}
static void on_srv_query_done_cb(void* arg, int status, int timeouts,
@@ -234,7 +234,7 @@ static void on_srv_query_done_cb(void* arg, int status, int timeouts,
const int parse_status = ares_parse_srv_reply(abuf, alen, &reply);
if (parse_status == ARES_SUCCESS) {
ares_channel* channel = grpc_ares_ev_driver_get_channel(r->ev_driver);
- for (struct ares_srv_reply* srv_it = reply; srv_it != NULL;
+ for (struct ares_srv_reply* srv_it = reply; srv_it != nullptr;
srv_it = srv_it->next) {
if (grpc_ipv6_loopback_available()) {
grpc_ares_hostbyname_request* hr = create_hostbyname_request(
@@ -249,7 +249,7 @@ static void on_srv_query_done_cb(void* arg, int status, int timeouts,
grpc_ares_ev_driver_start(&exec_ctx, r->ev_driver);
}
}
- if (reply != NULL) {
+ if (reply != nullptr) {
ares_free_data(reply);
}
} else if (!r->success) {
@@ -276,15 +276,15 @@ static void on_txt_done_cb(void* arg, int status, int timeouts,
char* error_msg;
grpc_ares_request* r = (grpc_ares_request*)arg;
const size_t prefix_len = sizeof(g_service_config_attribute_prefix) - 1;
- struct ares_txt_ext* result = NULL;
- struct ares_txt_ext* reply = NULL;
+ struct ares_txt_ext* result = nullptr;
+ struct ares_txt_ext* reply = nullptr;
grpc_error* error = GRPC_ERROR_NONE;
gpr_mu_lock(&r->mu);
if (status != ARES_SUCCESS) goto fail;
status = ares_parse_txt_reply_ext(buf, len, &reply);
if (status != ARES_SUCCESS) goto fail;
// Find service config in TXT record.
- for (result = reply; result != NULL; result = result->next) {
+ for (result = reply; result != nullptr; result = result->next) {
if (result->record_start &&
memcmp(result->txt, g_service_config_attribute_prefix, prefix_len) ==
0) {
@@ -292,12 +292,12 @@ static void on_txt_done_cb(void* arg, int status, int timeouts,
}
}
// Found a service config record.
- if (result != NULL) {
+ if (result != nullptr) {
size_t service_config_len = result->length - prefix_len;
*r->service_config_json_out = (char*)gpr_malloc(service_config_len + 1);
memcpy(*r->service_config_json_out, result->txt + prefix_len,
service_config_len);
- for (result = result->next; result != NULL && !result->record_start;
+ for (result = result->next; result != nullptr && !result->record_start;
result = result->next) {
*r->service_config_json_out = (char*)gpr_realloc(
*r->service_config_json_out, service_config_len + result->length + 1);
@@ -323,7 +323,7 @@ fail:
}
done:
gpr_mu_unlock(&r->mu);
- grpc_ares_request_unref(NULL, r);
+ grpc_ares_request_unref(nullptr, r);
}
static grpc_ares_request* grpc_dns_lookup_ares_impl(
@@ -332,9 +332,9 @@ static grpc_ares_request* grpc_dns_lookup_ares_impl(
grpc_closure* on_done, grpc_lb_addresses** addrs, bool check_grpclb,
char** service_config_json) {
grpc_error* error = GRPC_ERROR_NONE;
- grpc_ares_hostbyname_request* hr = NULL;
- grpc_ares_request* r = NULL;
- ares_channel* channel = NULL;
+ grpc_ares_hostbyname_request* hr = nullptr;
+ grpc_ares_request* r = nullptr;
+ ares_channel* channel = nullptr;
/* TODO(zyc): Enable tracing after #9603 is checked in */
/* if (grpc_dns_trace) {
gpr_log(GPR_DEBUG, "resolve_address (blocking): name=%s, default_port=%s",
@@ -345,13 +345,13 @@ static grpc_ares_request* grpc_dns_lookup_ares_impl(
char* host;
char* port;
gpr_split_host_port(name, &host, &port);
- if (host == NULL) {
+ if (host == nullptr) {
error = grpc_error_set_str(
GRPC_ERROR_CREATE_FROM_STATIC_STRING("unparseable host:port"),
GRPC_ERROR_STR_TARGET_ADDRESS, grpc_slice_from_copied_string(name));
goto error_cleanup;
- } else if (port == NULL) {
- if (default_port == NULL) {
+ } else if (port == nullptr) {
+ if (default_port == nullptr) {
error = grpc_error_set_str(
GRPC_ERROR_CREATE_FROM_STATIC_STRING("no port in name"),
GRPC_ERROR_STR_TARGET_ADDRESS, grpc_slice_from_copied_string(name));
@@ -375,7 +375,7 @@ static grpc_ares_request* grpc_dns_lookup_ares_impl(
channel = grpc_ares_ev_driver_get_channel(r->ev_driver);
// If dns_server is specified, use it.
- if (dns_server != NULL) {
+ if (dns_server != nullptr) {
gpr_log(GPR_INFO, "Using DNS server %s", dns_server);
grpc_resolved_address addr;
if (grpc_parse_ipv4_hostport(dns_server, &addr, false /* log_errors */)) {
@@ -429,7 +429,7 @@ static grpc_ares_request* grpc_dns_lookup_ares_impl(
r);
gpr_free(service_name);
}
- if (service_config_json != NULL) {
+ if (service_config_json != nullptr) {
grpc_ares_request_ref(r);
ares_search(*channel, hr->host, ns_c_in, ns_t_txt, on_txt_done_cb, r);
}
@@ -444,7 +444,7 @@ error_cleanup:
GRPC_CLOSURE_SCHED(exec_ctx, on_done, error);
gpr_free(host);
gpr_free(port);
- return NULL;
+ return nullptr;
}
grpc_ares_request* (*grpc_dns_lookup_ares)(
@@ -503,8 +503,8 @@ static void on_dns_lookup_done_cb(grpc_exec_ctx* exec_ctx, void* arg,
grpc_resolve_address_ares_request* r =
(grpc_resolve_address_ares_request*)arg;
grpc_resolved_addresses** resolved_addresses = r->addrs_out;
- if (r->lb_addrs == NULL || r->lb_addrs->num_addresses == 0) {
- *resolved_addresses = NULL;
+ if (r->lb_addrs == nullptr || r->lb_addrs->num_addresses == 0) {
+ *resolved_addresses = nullptr;
} else {
*resolved_addresses =
(grpc_resolved_addresses*)gpr_zalloc(sizeof(grpc_resolved_addresses));
@@ -536,10 +536,10 @@ static void grpc_resolve_address_ares_impl(grpc_exec_ctx* exec_ctx,
r->on_resolve_address_done = on_done;
GRPC_CLOSURE_INIT(&r->on_dns_lookup_done, on_dns_lookup_done_cb, r,
grpc_schedule_on_exec_ctx);
- grpc_dns_lookup_ares(exec_ctx, NULL /* dns_server */, name, default_port,
+ grpc_dns_lookup_ares(exec_ctx, nullptr /* dns_server */, name, default_port,
interested_parties, &r->on_dns_lookup_done, &r->lb_addrs,
false /* check_grpclb */,
- NULL /* service_config_json */);
+ nullptr /* service_config_json */);
}
void (*grpc_resolve_address_ares)(
diff --git a/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc b/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc
index a57ab66118..589c74807f 100644
--- a/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc
+++ b/src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc
@@ -100,12 +100,12 @@ static void dns_shutdown_locked(grpc_exec_ctx* exec_ctx,
if (r->have_retry_timer) {
grpc_timer_cancel(exec_ctx, &r->retry_timer);
}
- if (r->next_completion != NULL) {
- *r->target_result = NULL;
+ if (r->next_completion != nullptr) {
+ *r->target_result = nullptr;
GRPC_CLOSURE_SCHED(
exec_ctx, r->next_completion,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Resolver Shutdown"));
- r->next_completion = NULL;
+ r->next_completion = nullptr;
}
}
@@ -150,20 +150,20 @@ static void dns_on_retry_timer_locked(grpc_exec_ctx* exec_ctx, void* arg,
static void dns_on_resolved_locked(grpc_exec_ctx* exec_ctx, void* arg,
grpc_error* error) {
dns_resolver* r = (dns_resolver*)arg;
- grpc_channel_args* result = NULL;
+ grpc_channel_args* result = nullptr;
GPR_ASSERT(r->resolving);
r->resolving = false;
GRPC_ERROR_REF(error);
error = grpc_error_set_str(error, GRPC_ERROR_STR_TARGET_ADDRESS,
grpc_slice_from_copied_string(r->name_to_resolve));
- if (r->addresses != NULL) {
+ if (r->addresses != nullptr) {
grpc_lb_addresses* addresses = grpc_lb_addresses_create(
- r->addresses->naddrs, NULL /* user_data_vtable */);
+ r->addresses->naddrs, nullptr /* user_data_vtable */);
for (size_t i = 0; i < r->addresses->naddrs; ++i) {
grpc_lb_addresses_set_address(
addresses, i, &r->addresses->addrs[i].addr,
r->addresses->addrs[i].len, false /* is_balancer */,
- NULL /* balancer_name */, NULL /* user_data */);
+ nullptr /* balancer_name */, nullptr /* user_data */);
}
grpc_arg new_arg = grpc_lb_addresses_create_channel_arg(addresses);
result = grpc_channel_args_copy_and_add(r->channel_args, &new_arg, 1);
@@ -187,7 +187,7 @@ static void dns_on_resolved_locked(grpc_exec_ctx* exec_ctx, void* arg,
grpc_combiner_scheduler(r->base.combiner));
grpc_timer_init(exec_ctx, &r->retry_timer, next_try, &r->on_retry);
}
- if (r->resolved_result != NULL) {
+ if (r->resolved_result != nullptr) {
grpc_channel_args_destroy(exec_ctx, r->resolved_result);
}
r->resolved_result = result;
@@ -203,7 +203,7 @@ static void dns_start_resolving_locked(grpc_exec_ctx* exec_ctx,
GRPC_RESOLVER_REF(&r->base, "dns-resolving");
GPR_ASSERT(!r->resolving);
r->resolving = true;
- r->addresses = NULL;
+ r->addresses = nullptr;
grpc_resolve_address(
exec_ctx, r->name_to_resolve, r->default_port, r->interested_parties,
GRPC_CLOSURE_CREATE(dns_on_resolved_locked, r,
@@ -213,20 +213,20 @@ static void dns_start_resolving_locked(grpc_exec_ctx* exec_ctx,
static void dns_maybe_finish_next_locked(grpc_exec_ctx* exec_ctx,
dns_resolver* r) {
- if (r->next_completion != NULL &&
+ if (r->next_completion != nullptr &&
r->resolved_version != r->published_version) {
- *r->target_result = r->resolved_result == NULL
- ? NULL
+ *r->target_result = r->resolved_result == nullptr
+ ? nullptr
: grpc_channel_args_copy(r->resolved_result);
GRPC_CLOSURE_SCHED(exec_ctx, r->next_completion, GRPC_ERROR_NONE);
- r->next_completion = NULL;
+ r->next_completion = nullptr;
r->published_version = r->resolved_version;
}
}
static void dns_destroy(grpc_exec_ctx* exec_ctx, grpc_resolver* gr) {
dns_resolver* r = (dns_resolver*)gr;
- if (r->resolved_result != NULL) {
+ if (r->resolved_result != nullptr) {
grpc_channel_args_destroy(exec_ctx, r->resolved_result);
}
grpc_pollset_set_destroy(exec_ctx, r->interested_parties);
@@ -241,7 +241,7 @@ static grpc_resolver* dns_create(grpc_exec_ctx* exec_ctx,
const char* default_port) {
if (0 != strcmp(args->uri->authority, "")) {
gpr_log(GPR_ERROR, "authority based dns uri's not supported");
- return NULL;
+ return nullptr;
}
// Get name from args.
char* path = args->uri->path;
@@ -253,7 +253,7 @@ static grpc_resolver* dns_create(grpc_exec_ctx* exec_ctx,
r->default_port = gpr_strdup(default_port);
r->channel_args = grpc_channel_args_copy(args->args);
r->interested_parties = grpc_pollset_set_create();
- if (args->pollset_set != NULL) {
+ if (args->pollset_set != nullptr) {
grpc_pollset_set_add_pollset_set(exec_ctx, r->interested_parties,
args->pollset_set);
}
@@ -297,13 +297,13 @@ static grpc_resolver_factory* dns_resolver_factory_create() {
extern "C" void grpc_resolver_dns_native_init(void) {
char* resolver = gpr_getenv("GRPC_DNS_RESOLVER");
- if (resolver != NULL && gpr_stricmp(resolver, "native") == 0) {
+ if (resolver != nullptr && gpr_stricmp(resolver, "native") == 0) {
gpr_log(GPR_DEBUG, "Using native dns resolver");
grpc_register_resolver_type(dns_resolver_factory_create());
} else {
grpc_resolver_factory* existing_factory =
grpc_resolver_factory_lookup("dns");
- if (existing_factory == NULL) {
+ if (existing_factory == nullptr) {
gpr_log(GPR_DEBUG, "Using native dns resolver");
grpc_register_resolver_type(dns_resolver_factory_create());
} else {
diff --git a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc
index ed5b1011fb..85d7090144 100644
--- a/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc
+++ b/src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc
@@ -78,31 +78,31 @@ static void fake_resolver_destroy(grpc_exec_ctx* exec_ctx, grpc_resolver* gr) {
static void fake_resolver_shutdown_locked(grpc_exec_ctx* exec_ctx,
grpc_resolver* resolver) {
fake_resolver* r = (fake_resolver*)resolver;
- if (r->next_completion != NULL) {
- *r->target_result = NULL;
+ if (r->next_completion != nullptr) {
+ *r->target_result = nullptr;
GRPC_CLOSURE_SCHED(
exec_ctx, r->next_completion,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Resolver Shutdown"));
- r->next_completion = NULL;
+ r->next_completion = nullptr;
}
}
static void fake_resolver_maybe_finish_next_locked(grpc_exec_ctx* exec_ctx,
fake_resolver* r) {
- if (r->next_completion != NULL && r->next_results != NULL) {
+ if (r->next_completion != nullptr && r->next_results != nullptr) {
*r->target_result =
grpc_channel_args_union(r->next_results, r->channel_args);
grpc_channel_args_destroy(exec_ctx, r->next_results);
- r->next_results = NULL;
+ r->next_results = nullptr;
GRPC_CLOSURE_SCHED(exec_ctx, r->next_completion, GRPC_ERROR_NONE);
- r->next_completion = NULL;
+ r->next_completion = nullptr;
}
}
static void fake_resolver_channel_saw_error_locked(grpc_exec_ctx* exec_ctx,
grpc_resolver* resolver) {
fake_resolver* r = (fake_resolver*)resolver;
- if (r->next_results == NULL && r->results_upon_error != NULL) {
+ if (r->next_results == nullptr && r->results_upon_error != nullptr) {
// Pretend we re-resolved.
r->next_results = grpc_channel_args_copy(r->results_upon_error);
}
@@ -162,11 +162,11 @@ static void set_response_closure_fn(grpc_exec_ctx* exec_ctx, void* arg,
set_response_closure_arg* closure_arg = (set_response_closure_arg*)arg;
grpc_fake_resolver_response_generator* generator = closure_arg->generator;
fake_resolver* r = generator->resolver;
- if (r->next_results != NULL) {
+ if (r->next_results != nullptr) {
grpc_channel_args_destroy(exec_ctx, r->next_results);
}
r->next_results = closure_arg->next_response;
- if (r->results_upon_error != NULL) {
+ if (r->results_upon_error != nullptr) {
grpc_channel_args_destroy(exec_ctx, r->results_upon_error);
}
r->results_upon_error = grpc_channel_args_copy(closure_arg->next_response);
@@ -177,7 +177,7 @@ static void set_response_closure_fn(grpc_exec_ctx* exec_ctx, void* arg,
void grpc_fake_resolver_response_generator_set_response(
grpc_exec_ctx* exec_ctx, grpc_fake_resolver_response_generator* generator,
grpc_channel_args* next_response) {
- GPR_ASSERT(generator->resolver != NULL);
+ GPR_ASSERT(generator->resolver != nullptr);
set_response_closure_arg* closure_arg =
(set_response_closure_arg*)gpr_zalloc(sizeof(*closure_arg));
closure_arg->generator = generator;
@@ -220,7 +220,7 @@ grpc_fake_resolver_response_generator*
grpc_fake_resolver_get_response_generator(const grpc_channel_args* args) {
const grpc_arg* arg =
grpc_channel_args_find(args, GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR);
- if (arg == NULL || arg->type != GRPC_ARG_POINTER) return NULL;
+ if (arg == nullptr || arg->type != GRPC_ARG_POINTER) return nullptr;
return (grpc_fake_resolver_response_generator*)arg->value.pointer.p;
}
@@ -240,7 +240,7 @@ static grpc_resolver* fake_resolver_create(grpc_exec_ctx* exec_ctx,
grpc_resolver_init(&r->base, &fake_resolver_vtable, args->combiner);
grpc_fake_resolver_response_generator* response_generator =
grpc_fake_resolver_get_response_generator(args->args);
- if (response_generator != NULL) response_generator->resolver = r;
+ if (response_generator != nullptr) response_generator->resolver = r;
return &r->base;
}
diff --git a/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc b/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc
index 9fc8dffea3..1da8ab9161 100644
--- a/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc
+++ b/src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc
@@ -71,12 +71,12 @@ static const grpc_resolver_vtable sockaddr_resolver_vtable = {
static void sockaddr_shutdown_locked(grpc_exec_ctx* exec_ctx,
grpc_resolver* resolver) {
sockaddr_resolver* r = (sockaddr_resolver*)resolver;
- if (r->next_completion != NULL) {
- *r->target_result = NULL;
+ if (r->next_completion != nullptr) {
+ *r->target_result = nullptr;
GRPC_CLOSURE_SCHED(
exec_ctx, r->next_completion,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Resolver Shutdown"));
- r->next_completion = NULL;
+ r->next_completion = nullptr;
}
}
@@ -100,13 +100,13 @@ static void sockaddr_next_locked(grpc_exec_ctx* exec_ctx,
static void sockaddr_maybe_finish_next_locked(grpc_exec_ctx* exec_ctx,
sockaddr_resolver* r) {
- if (r->next_completion != NULL && !r->published) {
+ if (r->next_completion != nullptr && !r->published) {
r->published = true;
grpc_arg arg = grpc_lb_addresses_create_channel_arg(r->addresses);
*r->target_result =
grpc_channel_args_copy_and_add(r->channel_args, &arg, 1);
GRPC_CLOSURE_SCHED(exec_ctx, r->next_completion, GRPC_ERROR_NONE);
- r->next_completion = NULL;
+ r->next_completion = nullptr;
}
}
@@ -149,7 +149,7 @@ static grpc_resolver* sockaddr_create(grpc_exec_ctx* exec_ctx,
if (0 != strcmp(args->uri->authority, "")) {
gpr_log(GPR_ERROR, "authority based uri's not supported by the %s scheme",
args->uri->scheme);
- return NULL;
+ return nullptr;
}
/* Construct addresses. */
grpc_slice path_slice =
@@ -157,8 +157,8 @@ static grpc_resolver* sockaddr_create(grpc_exec_ctx* exec_ctx,
grpc_slice_buffer path_parts;
grpc_slice_buffer_init(&path_parts);
grpc_slice_split(path_slice, ",", &path_parts);
- grpc_lb_addresses* addresses =
- grpc_lb_addresses_create(path_parts.count, NULL /* user_data_vtable */);
+ grpc_lb_addresses* addresses = grpc_lb_addresses_create(
+ path_parts.count, nullptr /* user_data_vtable */);
bool errors_found = false;
for (size_t i = 0; i < addresses->num_addresses; i++) {
grpc_uri ith_uri = *args->uri;
@@ -174,7 +174,7 @@ static grpc_resolver* sockaddr_create(grpc_exec_ctx* exec_ctx,
grpc_slice_unref_internal(exec_ctx, path_slice);
if (errors_found) {
grpc_lb_addresses_destroy(exec_ctx, addresses);
- return NULL;
+ return nullptr;
}
/* Instantiate resolver. */
sockaddr_resolver* r =
diff --git a/src/core/ext/filters/client_channel/resolver_factory.cc b/src/core/ext/filters/client_channel/resolver_factory.cc
index 6f0a7c1e36..1a289d9771 100644
--- a/src/core/ext/filters/client_channel/resolver_factory.cc
+++ b/src/core/ext/filters/client_channel/resolver_factory.cc
@@ -30,12 +30,12 @@ void grpc_resolver_factory_unref(grpc_resolver_factory* factory) {
grpc_resolver* grpc_resolver_factory_create_resolver(
grpc_exec_ctx* exec_ctx, grpc_resolver_factory* factory,
grpc_resolver_args* args) {
- if (factory == NULL) return NULL;
+ if (factory == nullptr) return nullptr;
return factory->vtable->create_resolver(exec_ctx, factory, args);
}
char* grpc_resolver_factory_get_default_authority(
grpc_resolver_factory* factory, grpc_uri* uri) {
- if (factory == NULL) return NULL;
+ if (factory == nullptr) return nullptr;
return factory->vtable->get_default_authority(factory, uri);
}
diff --git a/src/core/ext/filters/client_channel/resolver_registry.cc b/src/core/ext/filters/client_channel/resolver_registry.cc
index 9e45887f35..5da6114a3d 100644
--- a/src/core/ext/filters/client_channel/resolver_registry.cc
+++ b/src/core/ext/filters/client_channel/resolver_registry.cc
@@ -78,7 +78,7 @@ static grpc_resolver_factory* lookup_factory(const char* name) {
return g_all_of_the_resolvers[i];
}
}
- return NULL;
+ return nullptr;
}
grpc_resolver_factory* grpc_resolver_factory_lookup(const char* name) {
@@ -88,7 +88,7 @@ grpc_resolver_factory* grpc_resolver_factory_lookup(const char* name) {
}
static grpc_resolver_factory* lookup_factory_by_uri(grpc_uri* uri) {
- if (!uri) return NULL;
+ if (!uri) return nullptr;
return lookup_factory(uri->scheme);
}
@@ -96,17 +96,17 @@ static grpc_resolver_factory* resolve_factory(grpc_exec_ctx* exec_ctx,
const char* target,
grpc_uri** uri,
char** canonical_target) {
- grpc_resolver_factory* factory = NULL;
+ grpc_resolver_factory* factory = nullptr;
- GPR_ASSERT(uri != NULL);
+ GPR_ASSERT(uri != nullptr);
*uri = grpc_uri_parse(exec_ctx, target, 1);
factory = lookup_factory_by_uri(*uri);
- if (factory == NULL) {
+ if (factory == nullptr) {
grpc_uri_destroy(*uri);
gpr_asprintf(canonical_target, "%s%s", g_default_resolver_prefix, target);
*uri = grpc_uri_parse(exec_ctx, *canonical_target, 1);
factory = lookup_factory_by_uri(*uri);
- if (factory == NULL) {
+ if (factory == nullptr) {
grpc_uri_destroy(grpc_uri_parse(exec_ctx, target, 0));
grpc_uri_destroy(grpc_uri_parse(exec_ctx, *canonical_target, 0));
gpr_log(GPR_ERROR, "don't know how to resolve '%s' or '%s'", target,
@@ -120,8 +120,8 @@ grpc_resolver* grpc_resolver_create(grpc_exec_ctx* exec_ctx, const char* target,
const grpc_channel_args* args,
grpc_pollset_set* pollset_set,
grpc_combiner* combiner) {
- grpc_uri* uri = NULL;
- char* canonical_target = NULL;
+ grpc_uri* uri = nullptr;
+ char* canonical_target = nullptr;
grpc_resolver_factory* factory =
resolve_factory(exec_ctx, target, &uri, &canonical_target);
grpc_resolver* resolver;
@@ -139,8 +139,8 @@ grpc_resolver* grpc_resolver_create(grpc_exec_ctx* exec_ctx, const char* target,
}
char* grpc_get_default_authority(grpc_exec_ctx* exec_ctx, const char* target) {
- grpc_uri* uri = NULL;
- char* canonical_target = NULL;
+ grpc_uri* uri = nullptr;
+ char* canonical_target = nullptr;
grpc_resolver_factory* factory =
resolve_factory(exec_ctx, target, &uri, &canonical_target);
char* authority = grpc_resolver_factory_get_default_authority(factory, uri);
@@ -151,9 +151,9 @@ char* grpc_get_default_authority(grpc_exec_ctx* exec_ctx, const char* target) {
char* grpc_resolver_factory_add_default_prefix_if_needed(
grpc_exec_ctx* exec_ctx, const char* target) {
- grpc_uri* uri = NULL;
- char* canonical_target = NULL;
+ grpc_uri* uri = nullptr;
+ char* canonical_target = nullptr;
resolve_factory(exec_ctx, target, &uri, &canonical_target);
grpc_uri_destroy(uri);
- return canonical_target == NULL ? gpr_strdup(target) : canonical_target;
+ return canonical_target == nullptr ? gpr_strdup(target) : canonical_target;
}
diff --git a/src/core/ext/filters/client_channel/retry_throttle.cc b/src/core/ext/filters/client_channel/retry_throttle.cc
index 09dcade089..867d775151 100644
--- a/src/core/ext/filters/client_channel/retry_throttle.cc
+++ b/src/core/ext/filters/client_channel/retry_throttle.cc
@@ -48,7 +48,7 @@ static void get_replacement_throttle_data_if_needed(
grpc_server_retry_throttle_data* new_throttle_data =
(grpc_server_retry_throttle_data*)gpr_atm_acq_load(
&(*throttle_data)->replacement);
- if (new_throttle_data == NULL) return;
+ if (new_throttle_data == nullptr) return;
*throttle_data = new_throttle_data;
}
}
@@ -88,7 +88,7 @@ void grpc_server_retry_throttle_data_unref(
grpc_server_retry_throttle_data* replacement =
(grpc_server_retry_throttle_data*)gpr_atm_acq_load(
&throttle_data->replacement);
- if (replacement != NULL) {
+ if (replacement != nullptr) {
grpc_server_retry_throttle_data_unref(replacement);
}
gpr_free(throttle_data);
@@ -109,7 +109,7 @@ static grpc_server_retry_throttle_data* grpc_server_retry_throttle_data_create(
// the token count by scaling proportionately to the old data. This
// ensures that if we're already throttling retries on the old scale,
// we will start out doing the same thing on the new one.
- if (old_throttle_data != NULL) {
+ if (old_throttle_data != nullptr) {
double token_fraction =
(int)gpr_atm_acq_load(&old_throttle_data->milli_tokens) /
(double)old_throttle_data->max_milli_tokens;
@@ -119,7 +119,7 @@ static grpc_server_retry_throttle_data* grpc_server_retry_throttle_data_create(
(gpr_atm)initial_milli_tokens);
// If there was a pre-existing entry, mark it as stale and give it a
// pointer to the new entry, which is its replacement.
- if (old_throttle_data != NULL) {
+ if (old_throttle_data != nullptr) {
grpc_server_retry_throttle_data_ref(throttle_data);
gpr_atm_rel_store(&old_throttle_data->replacement, (gpr_atm)throttle_data);
}
@@ -170,7 +170,7 @@ void grpc_retry_throttle_map_init() {
void grpc_retry_throttle_map_shutdown() {
gpr_mu_destroy(&g_mu);
- gpr_avl_unref(g_avl, NULL);
+ gpr_avl_unref(g_avl, nullptr);
}
grpc_server_retry_throttle_data* grpc_retry_throttle_map_get_data_for_server(
@@ -178,12 +178,12 @@ grpc_server_retry_throttle_data* grpc_retry_throttle_map_get_data_for_server(
gpr_mu_lock(&g_mu);
grpc_server_retry_throttle_data* throttle_data =
(grpc_server_retry_throttle_data*)gpr_avl_get(g_avl, (char*)server_name,
- NULL);
- if (throttle_data == NULL) {
+ nullptr);
+ if (throttle_data == nullptr) {
// Entry not found. Create a new one.
throttle_data = grpc_server_retry_throttle_data_create(
- max_milli_tokens, milli_token_ratio, NULL);
- g_avl = gpr_avl_add(g_avl, (char*)server_name, throttle_data, NULL);
+ max_milli_tokens, milli_token_ratio, nullptr);
+ g_avl = gpr_avl_add(g_avl, (char*)server_name, throttle_data, nullptr);
} else {
if (throttle_data->max_milli_tokens != max_milli_tokens ||
throttle_data->milli_token_ratio != milli_token_ratio) {
@@ -191,7 +191,7 @@ grpc_server_retry_throttle_data* grpc_retry_throttle_map_get_data_for_server(
// the original one.
throttle_data = grpc_server_retry_throttle_data_create(
max_milli_tokens, milli_token_ratio, throttle_data);
- g_avl = gpr_avl_add(g_avl, (char*)server_name, throttle_data, NULL);
+ g_avl = gpr_avl_add(g_avl, (char*)server_name, throttle_data, nullptr);
} else {
// Entry found. Increase refcount.
grpc_server_retry_throttle_data_ref(throttle_data);
diff --git a/src/core/ext/filters/client_channel/subchannel.cc b/src/core/ext/filters/client_channel/subchannel.cc
index 427df743d6..2720e68040 100644
--- a/src/core/ext/filters/client_channel/subchannel.cc
+++ b/src/core/ext/filters/client_channel/subchannel.cc
@@ -227,7 +227,7 @@ grpc_subchannel* grpc_subchannel_weak_ref(
grpc_subchannel* grpc_subchannel_ref_from_weak_ref(
grpc_subchannel* c GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
- if (!c) return NULL;
+ if (!c) return nullptr;
for (;;) {
gpr_atm old_refs = gpr_atm_acq_load(&c->ref_pair);
if (old_refs >= (1 << INTERNAL_REF_BITS)) {
@@ -236,7 +236,7 @@ grpc_subchannel* grpc_subchannel_ref_from_weak_ref(
return c;
}
} else {
- return NULL;
+ return nullptr;
}
}
}
@@ -251,7 +251,7 @@ static void disconnect(grpc_exec_ctx* exec_ctx, grpc_subchannel* c) {
exec_ctx, c->connector,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Subchannel disconnected"));
con = GET_CONNECTED_SUBCHANNEL(c, no_barrier);
- if (con != NULL) {
+ if (con != nullptr) {
GRPC_CONNECTED_SUBCHANNEL_UNREF(exec_ctx, con, "connection");
gpr_atm_no_barrier_store(&c->connected_subchannel, (gpr_atm)0xdeadbeef);
}
@@ -306,17 +306,17 @@ grpc_subchannel* grpc_subchannel_create(grpc_exec_ctx* exec_ctx,
memcpy((void*)c->filters, args->filters,
sizeof(grpc_channel_filter*) * c->num_filters);
} else {
- c->filters = NULL;
+ c->filters = nullptr;
}
c->pollset_set = grpc_pollset_set_create();
grpc_resolved_address* addr =
(grpc_resolved_address*)gpr_malloc(sizeof(*addr));
grpc_get_subchannel_address_arg(exec_ctx, args->args, addr);
- grpc_resolved_address* new_address = NULL;
- grpc_channel_args* new_args = NULL;
+ grpc_resolved_address* new_address = nullptr;
+ grpc_channel_args* new_args = nullptr;
if (grpc_proxy_mappers_map_address(exec_ctx, addr, args->args, &new_address,
&new_args)) {
- GPR_ASSERT(new_address != NULL);
+ GPR_ASSERT(new_address != nullptr);
gpr_free(addr);
addr = new_address;
}
@@ -324,10 +324,10 @@ grpc_subchannel* grpc_subchannel_create(grpc_exec_ctx* exec_ctx,
grpc_arg new_arg = grpc_create_subchannel_address_arg(addr);
gpr_free(addr);
c->args = grpc_channel_args_copy_and_add_and_remove(
- new_args != NULL ? new_args : args->args, keys_to_remove,
+ new_args != nullptr ? new_args : args->args, keys_to_remove,
GPR_ARRAY_SIZE(keys_to_remove), &new_arg, 1);
gpr_free(new_arg.value.string);
- if (new_args != NULL) grpc_channel_args_destroy(exec_ctx, new_args);
+ if (new_args != nullptr) grpc_channel_args_destroy(exec_ctx, new_args);
c->root_external_state_watcher.next = c->root_external_state_watcher.prev =
&c->root_external_state_watcher;
GRPC_CLOSURE_INIT(&c->connected, subchannel_connected, c,
@@ -404,7 +404,7 @@ static void on_external_state_watcher_done(grpc_exec_ctx* exec_ctx, void* arg,
grpc_error* error) {
external_state_watcher* w = (external_state_watcher*)arg;
grpc_closure* follow_up = w->notify;
- if (w->pollset_set != NULL) {
+ if (w->pollset_set != nullptr) {
grpc_pollset_set_del_pollset_set(exec_ctx, w->subchannel->pollset_set,
w->pollset_set);
}
@@ -451,7 +451,7 @@ static void maybe_start_connecting_locked(grpc_exec_ctx* exec_ctx,
return;
}
- if (GET_CONNECTED_SUBCHANNEL(c, no_barrier) != NULL) {
+ if (GET_CONNECTED_SUBCHANNEL(c, no_barrier) != nullptr) {
/* Already connected: don't restart */
return;
}
@@ -490,13 +490,13 @@ void grpc_subchannel_notify_on_state_change(
grpc_closure* notify) {
external_state_watcher* w;
- if (state == NULL) {
+ if (state == nullptr) {
gpr_mu_lock(&c->mu);
for (w = c->root_external_state_watcher.next;
w != &c->root_external_state_watcher; w = w->next) {
if (w->notify == notify) {
grpc_connectivity_state_notify_on_state_change(
- exec_ctx, &c->state_tracker, NULL, &w->closure);
+ exec_ctx, &c->state_tracker, nullptr, &w->closure);
}
}
gpr_mu_unlock(&c->mu);
@@ -507,7 +507,7 @@ void grpc_subchannel_notify_on_state_change(
w->notify = notify;
GRPC_CLOSURE_INIT(&w->closure, on_external_state_watcher_done, w,
grpc_schedule_on_exec_ctx);
- if (interested_parties != NULL) {
+ if (interested_parties != nullptr) {
grpc_pollset_set_add_pollset_set(exec_ctx, c->pollset_set,
interested_parties);
}
@@ -549,10 +549,10 @@ static void subchannel_on_child_state_changed(grpc_exec_ctx* exec_ctx, void* p,
"reflect_child");
if (sw->connectivity_state != GRPC_CHANNEL_SHUTDOWN) {
grpc_connected_subchannel_notify_on_state_change(
- exec_ctx, GET_CONNECTED_SUBCHANNEL(c, no_barrier), NULL,
+ exec_ctx, GET_CONNECTED_SUBCHANNEL(c, no_barrier), nullptr,
&sw->connectivity_state, &sw->closure);
GRPC_SUBCHANNEL_WEAK_REF(c, "state_watcher");
- sw = NULL;
+ sw = nullptr;
}
gpr_mu_unlock(mu);
@@ -565,7 +565,7 @@ static void connected_subchannel_state_op(grpc_exec_ctx* exec_ctx,
grpc_pollset_set* interested_parties,
grpc_connectivity_state* state,
grpc_closure* closure) {
- grpc_transport_op* op = grpc_make_transport_op(NULL);
+ grpc_transport_op* op = grpc_make_transport_op(nullptr);
grpc_channel_element* elem;
op->connectivity_state = state;
op->on_connectivity_state_change = closure;
@@ -585,7 +585,7 @@ void grpc_connected_subchannel_notify_on_state_change(
void grpc_connected_subchannel_ping(grpc_exec_ctx* exec_ctx,
grpc_connected_subchannel* con,
grpc_closure* closure) {
- grpc_transport_op* op = grpc_make_transport_op(NULL);
+ grpc_transport_op* op = grpc_make_transport_op(nullptr);
grpc_channel_element* elem;
op->send_ping = closure;
elem = grpc_channel_stack_element(CHANNEL_STACK_FROM_CONNECTION(con), 0);
@@ -611,7 +611,7 @@ static bool publish_transport_locked(grpc_exec_ctx* exec_ctx,
return false;
}
grpc_error* error = grpc_channel_stack_builder_finish(
- exec_ctx, builder, 0, 1, connection_destroy, NULL, (void**)&con);
+ exec_ctx, builder, 0, 1, connection_destroy, nullptr, (void**)&con);
if (error != GRPC_ERROR_NONE) {
grpc_transport_destroy(exec_ctx, c->connecting_result.transport);
gpr_log(GPR_ERROR, "error initializing subchannel stack: %s",
@@ -666,7 +666,7 @@ static void subchannel_connected(grpc_exec_ctx* exec_ctx, void* arg,
GRPC_SUBCHANNEL_WEAK_REF(c, "connected");
gpr_mu_lock(&c->mu);
c->connecting = false;
- if (c->connecting_result.transport != NULL &&
+ if (c->connecting_result.transport != nullptr &&
publish_transport_locked(exec_ctx, c)) {
/* do nothing, transport was published */
} else if (c->disconnected) {
@@ -697,10 +697,10 @@ static void subchannel_connected(grpc_exec_ctx* exec_ctx, void* arg,
static void subchannel_call_destroy(grpc_exec_ctx* exec_ctx, void* call,
grpc_error* error) {
grpc_subchannel_call* c = (grpc_subchannel_call*)call;
- GPR_ASSERT(c->schedule_closure_after_destroy != NULL);
+ GPR_ASSERT(c->schedule_closure_after_destroy != nullptr);
GPR_TIMER_BEGIN("grpc_subchannel_call_unref.destroy", 0);
grpc_connected_subchannel* connection = c->connection;
- grpc_call_stack_destroy(exec_ctx, SUBCHANNEL_CALL_TO_CALL_STACK(c), NULL,
+ grpc_call_stack_destroy(exec_ctx, SUBCHANNEL_CALL_TO_CALL_STACK(c), nullptr,
c->schedule_closure_after_destroy);
GRPC_CONNECTED_SUBCHANNEL_UNREF(exec_ctx, connection, "subchannel_call");
GPR_TIMER_END("grpc_subchannel_call_unref.destroy", 0);
@@ -708,8 +708,8 @@ static void subchannel_call_destroy(grpc_exec_ctx* exec_ctx, void* call,
void grpc_subchannel_call_set_cleanup_closure(grpc_subchannel_call* call,
grpc_closure* closure) {
- GPR_ASSERT(call->schedule_closure_after_destroy == NULL);
- GPR_ASSERT(closure != NULL);
+ GPR_ASSERT(call->schedule_closure_after_destroy == nullptr);
+ GPR_ASSERT(closure != nullptr);
call->schedule_closure_after_destroy = closure;
}
@@ -756,7 +756,7 @@ grpc_error* grpc_connected_subchannel_create_call(
(*call)->connection = GRPC_CONNECTED_SUBCHANNEL_REF(con, "subchannel_call");
const grpc_call_element_args call_args = {
callstk, /* call_stack */
- NULL, /* server_transport_data */
+ nullptr, /* server_transport_data */
args->context, /* context */
args->path, /* path */
args->start_time, /* start_time */
@@ -783,7 +783,7 @@ grpc_call_stack* grpc_subchannel_call_get_call_stack(
static void grpc_uri_to_sockaddr(grpc_exec_ctx* exec_ctx, const char* uri_str,
grpc_resolved_address* addr) {
grpc_uri* uri = grpc_uri_parse(exec_ctx, uri_str, 0 /* suppress_errors */);
- GPR_ASSERT(uri != NULL);
+ GPR_ASSERT(uri != nullptr);
if (!grpc_parse_uri(uri, addr)) memset(addr, 0, sizeof(*addr));
grpc_uri_destroy(uri);
}
@@ -801,7 +801,7 @@ void grpc_get_subchannel_address_arg(grpc_exec_ctx* exec_ctx,
const char* grpc_get_subchannel_address_uri_arg(const grpc_channel_args* args) {
const grpc_arg* addr_arg =
grpc_channel_args_find(args, GRPC_ARG_SUBCHANNEL_ADDRESS);
- GPR_ASSERT(addr_arg != NULL); // Should have been set by LB policy.
+ GPR_ASSERT(addr_arg != nullptr); // Should have been set by LB policy.
GPR_ASSERT(addr_arg->type == GRPC_ARG_STRING);
return addr_arg->value.string;
}
diff --git a/src/core/ext/filters/client_channel/subchannel_index.cc b/src/core/ext/filters/client_channel/subchannel_index.cc
index 0c4213cf77..ae39ca394e 100644
--- a/src/core/ext/filters/client_channel/subchannel_index.cc
+++ b/src/core/ext/filters/client_channel/subchannel_index.cc
@@ -53,7 +53,7 @@ static grpc_subchannel_key* create_key(
memcpy((grpc_channel_filter*)k->args.filters, args->filters,
sizeof(*k->args.filters) * k->args.filter_count);
} else {
- k->args.filters = NULL;
+ k->args.filters = nullptr;
}
k->args.args = copy_channel_args(args->args);
return k;
@@ -162,10 +162,10 @@ grpc_subchannel* grpc_subchannel_index_find(grpc_exec_ctx* exec_ctx,
grpc_subchannel* grpc_subchannel_index_register(grpc_exec_ctx* exec_ctx,
grpc_subchannel_key* key,
grpc_subchannel* constructed) {
- grpc_subchannel* c = NULL;
+ grpc_subchannel* c = nullptr;
bool need_to_unref_constructed;
- while (c == NULL) {
+ while (c == nullptr) {
need_to_unref_constructed = false;
// Compare and swap loop:
@@ -176,10 +176,10 @@ grpc_subchannel* grpc_subchannel_index_register(grpc_exec_ctx* exec_ctx,
// - Check to see if a subchannel already exists
c = (grpc_subchannel*)gpr_avl_get(index, key, exec_ctx);
- if (c != NULL) {
+ if (c != nullptr) {
c = GRPC_SUBCHANNEL_REF_FROM_WEAK_REF(c, "index_register");
}
- if (c != NULL) {
+ if (c != nullptr) {
// yes -> we're done
need_to_unref_constructed = true;
} else {
diff --git a/src/core/ext/filters/client_channel/uri_parser.cc b/src/core/ext/filters/client_channel/uri_parser.cc
index 1cc52dec12..b76dcbe4e3 100644
--- a/src/core/ext/filters/client_channel/uri_parser.cc
+++ b/src/core/ext/filters/client_channel/uri_parser.cc
@@ -52,7 +52,7 @@ static grpc_uri* bad_uri(const char* uri_text, size_t pos, const char* section,
gpr_free(line_prefix);
}
- return NULL;
+ return nullptr;
}
/** Returns a copy of percent decoded \a src[begin, end) */
@@ -148,10 +148,10 @@ static int parse_fragment_or_query(const char* uri_text, size_t* i) {
static void parse_query_parts(grpc_uri* uri) {
static const char* QUERY_PARTS_SEPARATOR = "&";
static const char* QUERY_PARTS_VALUE_SEPARATOR = "=";
- GPR_ASSERT(uri->query != NULL);
+ GPR_ASSERT(uri->query != nullptr);
if (uri->query[0] == '\0') {
- uri->query_parts = NULL;
- uri->query_parts_values = NULL;
+ uri->query_parts = nullptr;
+ uri->query_parts_values = nullptr;
uri->num_query_parts = 0;
return;
}
@@ -174,7 +174,7 @@ static void parse_query_parts(grpc_uri* uri) {
* be included, even if they include the separator. */
uri->query_parts_values[i] = query_param_parts[1];
} else {
- uri->query_parts_values[i] = NULL;
+ uri->query_parts_values[i] = nullptr;
}
for (size_t j = 2; j < num_query_param_parts; j++) {
gpr_free(query_param_parts[j]);
@@ -289,15 +289,15 @@ grpc_uri* grpc_uri_parse(grpc_exec_ctx* exec_ctx, const char* uri_text,
}
const char* grpc_uri_get_query_arg(const grpc_uri* uri, const char* key) {
- GPR_ASSERT(key != NULL);
- if (key[0] == '\0') return NULL;
+ GPR_ASSERT(key != nullptr);
+ if (key[0] == '\0') return nullptr;
for (size_t i = 0; i < uri->num_query_parts; ++i) {
if (0 == strcmp(key, uri->query_parts[i])) {
return uri->query_parts_values[i];
}
}
- return NULL;
+ return nullptr;
}
void grpc_uri_destroy(grpc_uri* uri) {
diff --git a/src/core/ext/filters/deadline/deadline_filter.cc b/src/core/ext/filters/deadline/deadline_filter.cc
index dc194ec068..849ce7153e 100644
--- a/src/core/ext/filters/deadline/deadline_filter.cc
+++ b/src/core/ext/filters/deadline/deadline_filter.cc
@@ -91,7 +91,7 @@ static void start_timer_if_needed(grpc_exec_ctx* exec_ctx,
return;
}
grpc_deadline_state* deadline_state = (grpc_deadline_state*)elem->call_data;
- grpc_closure* closure = NULL;
+ grpc_closure* closure = nullptr;
switch (deadline_state->timer_state) {
case GRPC_DEADLINE_STATE_PENDING:
// Note: We do not start the timer if there is already a timer
@@ -111,7 +111,7 @@ static void start_timer_if_needed(grpc_exec_ctx* exec_ctx,
elem, grpc_schedule_on_exec_ctx);
break;
}
- GPR_ASSERT(closure != NULL);
+ GPR_ASSERT(closure != nullptr);
GRPC_CALL_STACK_REF(deadline_state->call_stack, "deadline_timer");
grpc_timer_init(exec_ctx, &deadline_state->timer, deadline, closure);
}
@@ -378,7 +378,7 @@ static bool maybe_add_deadline_filter(grpc_exec_ctx* exec_ctx,
return grpc_deadline_checking_enabled(
grpc_channel_stack_builder_get_channel_arguments(builder))
? grpc_channel_stack_builder_prepend_filter(
- builder, (const grpc_channel_filter*)arg, NULL, NULL)
+ builder, (const grpc_channel_filter*)arg, nullptr, nullptr)
: true;
}
diff --git a/src/core/ext/filters/http/client/http_client_filter.cc b/src/core/ext/filters/http/client/http_client_filter.cc
index 590bd22b1e..a625369b02 100644
--- a/src/core/ext/filters/http/client/http_client_filter.cc
+++ b/src/core/ext/filters/http/client/http_client_filter.cc
@@ -71,7 +71,7 @@ typedef struct channel_data {
static grpc_error* client_filter_incoming_metadata(grpc_exec_ctx* exec_ctx,
grpc_call_element* elem,
grpc_metadata_batch* b) {
- if (b->idx.named.status != NULL) {
+ if (b->idx.named.status != nullptr) {
if (grpc_mdelem_eq(b->idx.named.status->md, GRPC_MDELEM_STATUS_200)) {
grpc_metadata_batch_remove(exec_ctx, b, b->idx.named.status);
} else {
@@ -93,7 +93,7 @@ static grpc_error* client_filter_incoming_metadata(grpc_exec_ctx* exec_ctx,
}
}
- if (b->idx.named.grpc_message != NULL) {
+ if (b->idx.named.grpc_message != nullptr) {
grpc_slice pct_decoded_msg = grpc_permissive_percent_decode_slice(
GRPC_MDVALUE(b->idx.named.grpc_message->md));
if (grpc_slice_is_equivalent(pct_decoded_msg,
@@ -105,7 +105,7 @@ static grpc_error* client_filter_incoming_metadata(grpc_exec_ctx* exec_ctx,
}
}
- if (b->idx.named.content_type != NULL) {
+ if (b->idx.named.content_type != nullptr) {
if (!grpc_mdelem_eq(b->idx.named.content_type->md,
GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC)) {
if (grpc_slice_buf_start_eq(GRPC_MDVALUE(b->idx.named.content_type->md),
@@ -292,7 +292,7 @@ static grpc_error* update_path_for_get(grpc_exec_ctx* exec_ctx,
static void remove_if_present(grpc_exec_ctx* exec_ctx,
grpc_metadata_batch* batch,
grpc_metadata_batch_callouts_index idx) {
- if (batch->idx.array[idx] != NULL) {
+ if (batch->idx.array[idx] != nullptr) {
grpc_metadata_batch_remove(exec_ctx, batch, batch->idx.array[idx]);
}
}
@@ -450,7 +450,7 @@ static grpc_mdelem scheme_from_args(const grpc_channel_args* args) {
size_t j;
grpc_mdelem valid_schemes[] = {GRPC_MDELEM_SCHEME_HTTP,
GRPC_MDELEM_SCHEME_HTTPS};
- if (args != NULL) {
+ if (args != nullptr) {
for (i = 0; i < args->num_args; ++i) {
if (args->args[i].type == GRPC_ARG_STRING &&
strcmp(args->args[i].key, GRPC_ARG_HTTP2_SCHEME) == 0) {
@@ -467,7 +467,7 @@ static grpc_mdelem scheme_from_args(const grpc_channel_args* args) {
}
static size_t max_payload_size_from_args(const grpc_channel_args* args) {
- if (args != NULL) {
+ if (args != nullptr) {
for (size_t i = 0; i < args->num_args; ++i) {
if (0 == strcmp(args->args[i].key, GRPC_ARG_MAX_PAYLOAD_SIZE_FOR_GET)) {
if (args->args[i].type != GRPC_ARG_INTEGER) {
@@ -524,7 +524,7 @@ static grpc_slice user_agent_from_args(const grpc_channel_args* args,
}
}
- tmp = gpr_strvec_flatten(&v, NULL);
+ tmp = gpr_strvec_flatten(&v, nullptr);
gpr_strvec_destroy(&v);
result = grpc_slice_intern(grpc_slice_from_static_string(tmp));
gpr_free(tmp);
@@ -538,7 +538,7 @@ static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx,
grpc_channel_element_args* args) {
channel_data* chand = (channel_data*)elem->channel_data;
GPR_ASSERT(!args->is_last);
- GPR_ASSERT(args->optional_transport != NULL);
+ GPR_ASSERT(args->optional_transport != nullptr);
chand->static_scheme = scheme_from_args(args->channel_args);
chand->max_payload_size_for_get =
max_payload_size_from_args(args->channel_args);
diff --git a/src/core/ext/filters/http/http_filters_plugin.cc b/src/core/ext/filters/http/http_filters_plugin.cc
index 064e66e323..69dbde409c 100644
--- a/src/core/ext/filters/http/http_filters_plugin.cc
+++ b/src/core/ext/filters/http/http_filters_plugin.cc
@@ -37,7 +37,7 @@ static optional_filter compress_filter = {
static bool is_building_http_like_transport(
grpc_channel_stack_builder* builder) {
grpc_transport* t = grpc_channel_stack_builder_get_transport(builder);
- return t != NULL && strstr(t->vtable->name, "http");
+ return t != nullptr && strstr(t->vtable->name, "http");
}
static bool maybe_add_optional_filter(grpc_exec_ctx* exec_ctx,
@@ -51,7 +51,7 @@ static bool maybe_add_optional_filter(grpc_exec_ctx* exec_ctx,
grpc_channel_args_find(channel_args, filtarg->control_channel_arg),
!grpc_channel_args_want_minimal_stack(channel_args));
return enable ? grpc_channel_stack_builder_prepend_filter(
- builder, filtarg->filter, NULL, NULL)
+ builder, filtarg->filter, nullptr, nullptr)
: true;
}
@@ -60,7 +60,7 @@ static bool maybe_add_required_filter(grpc_exec_ctx* exec_ctx,
void* arg) {
return is_building_http_like_transport(builder)
? grpc_channel_stack_builder_prepend_filter(
- builder, (const grpc_channel_filter*)arg, NULL, NULL)
+ builder, (const grpc_channel_filter*)arg, nullptr, nullptr)
: true;
}
diff --git a/src/core/ext/filters/http/message_compress/message_compress_filter.cc b/src/core/ext/filters/http/message_compress/message_compress_filter.cc
index 949ff917d6..8d95133d8f 100644
--- a/src/core/ext/filters/http/message_compress/message_compress_filter.cc
+++ b/src/core/ext/filters/http/message_compress/message_compress_filter.cc
@@ -112,7 +112,7 @@ static grpc_error* process_send_initial_metadata(
grpc_stream_compression_algorithm stream_compression_algorithm =
GRPC_STREAM_COMPRESS_NONE;
if (initial_metadata->idx.named.grpc_internal_stream_encoding_request !=
- NULL) {
+ nullptr) {
grpc_mdelem md =
initial_metadata->idx.named.grpc_internal_stream_encoding_request->md;
if (!grpc_stream_compression_algorithm_parse(
@@ -141,13 +141,13 @@ static grpc_error* process_send_initial_metadata(
initial_metadata->idx.named.grpc_internal_stream_encoding_request);
/* Disable message-wise compression */
calld->compression_algorithm = GRPC_COMPRESS_NONE;
- if (initial_metadata->idx.named.grpc_internal_encoding_request != NULL) {
+ if (initial_metadata->idx.named.grpc_internal_encoding_request != nullptr) {
grpc_metadata_batch_remove(
exec_ctx, initial_metadata,
initial_metadata->idx.named.grpc_internal_encoding_request);
}
} else if (initial_metadata->idx.named.grpc_internal_encoding_request !=
- NULL) {
+ nullptr) {
grpc_mdelem md =
initial_metadata->idx.named.grpc_internal_encoding_request->md;
if (!grpc_compression_algorithm_parse(GRPC_MDVALUE(md),
@@ -228,7 +228,7 @@ static void send_message_batch_continue(grpc_exec_ctx* exec_ctx,
// before we do that.
grpc_transport_stream_op_batch* send_message_batch =
calld->send_message_batch;
- calld->send_message_batch = NULL;
+ calld->send_message_batch = nullptr;
grpc_call_next_op(exec_ctx, elem, send_message_batch);
}
@@ -287,11 +287,11 @@ static void fail_send_message_batch_in_call_combiner(grpc_exec_ctx* exec_ctx,
void* arg,
grpc_error* error) {
call_data* calld = (call_data*)arg;
- if (calld->send_message_batch != NULL) {
+ if (calld->send_message_batch != nullptr) {
grpc_transport_stream_op_batch_finish_with_failure(
exec_ctx, calld->send_message_batch, GRPC_ERROR_REF(error),
calld->call_combiner);
- calld->send_message_batch = NULL;
+ calld->send_message_batch = nullptr;
}
}
@@ -382,7 +382,7 @@ static void compress_start_transport_stream_op_batch(
GRPC_ERROR_UNREF(calld->cancel_error);
calld->cancel_error =
GRPC_ERROR_REF(batch->payload->cancel_stream.cancel_error);
- if (calld->send_message_batch != NULL) {
+ if (calld->send_message_batch != nullptr) {
if (calld->send_initial_metadata_state == INITIAL_METADATA_UNSEEN) {
GRPC_CALL_COMBINER_START(
exec_ctx, calld->call_combiner,
@@ -423,7 +423,7 @@ static void compress_start_transport_stream_op_batch(
// for this, since we can't send two batches down while holding the
// call combiner, since the connected_channel filter (at the bottom of
// the call stack) will release the call combiner for each batch it sees.
- if (calld->send_message_batch != NULL) {
+ if (calld->send_message_batch != nullptr) {
GRPC_CALL_COMBINER_START(
exec_ctx, calld->call_combiner,
&calld->start_send_message_batch_in_call_combiner, GRPC_ERROR_NONE,
@@ -432,7 +432,7 @@ static void compress_start_transport_stream_op_batch(
}
// Handle send_message.
if (batch->send_message) {
- GPR_ASSERT(calld->send_message_batch == NULL);
+ GPR_ASSERT(calld->send_message_batch == nullptr);
calld->send_message_batch = batch;
// If we have not yet seen send_initial_metadata, then we have to
// wait. We save the batch in calld and then drop the call
diff --git a/src/core/ext/filters/http/server/http_server_filter.cc b/src/core/ext/filters/http/server/http_server_filter.cc
index 5cfe5acced..4f3897915c 100644
--- a/src/core/ext/filters/http/server/http_server_filter.cc
+++ b/src/core/ext/filters/http/server/http_server_filter.cc
@@ -69,7 +69,7 @@ typedef struct channel_data {
static grpc_error* server_filter_outgoing_metadata(grpc_exec_ctx* exec_ctx,
grpc_call_element* elem,
grpc_metadata_batch* b) {
- if (b->idx.named.grpc_message != NULL) {
+ if (b->idx.named.grpc_message != nullptr) {
grpc_slice pct_encoded_msg = grpc_percent_encode_slice(
GRPC_MDVALUE(b->idx.named.grpc_message->md),
grpc_compatible_percent_encoding_unreserved_bytes);
@@ -100,7 +100,7 @@ static grpc_error* server_filter_incoming_metadata(grpc_exec_ctx* exec_ctx,
grpc_error* error = GRPC_ERROR_NONE;
static const char* error_name = "Failed processing incoming headers";
- if (b->idx.named.method != NULL) {
+ if (b->idx.named.method != nullptr) {
if (grpc_mdelem_eq(b->idx.named.method->md, GRPC_MDELEM_METHOD_POST)) {
*calld->recv_initial_metadata_flags &=
~(GRPC_INITIAL_METADATA_CACHEABLE_REQUEST |
@@ -132,7 +132,7 @@ static grpc_error* server_filter_incoming_metadata(grpc_exec_ctx* exec_ctx,
GRPC_ERROR_STR_KEY, grpc_slice_from_static_string(":method")));
}
- if (b->idx.named.te != NULL) {
+ if (b->idx.named.te != nullptr) {
if (!grpc_mdelem_eq(b->idx.named.te->md, GRPC_MDELEM_TE_TRAILERS)) {
add_error(error_name, &error,
grpc_attach_md_to_error(
@@ -147,7 +147,7 @@ static grpc_error* server_filter_incoming_metadata(grpc_exec_ctx* exec_ctx,
GRPC_ERROR_STR_KEY, grpc_slice_from_static_string("te")));
}
- if (b->idx.named.scheme != NULL) {
+ if (b->idx.named.scheme != nullptr) {
if (!grpc_mdelem_eq(b->idx.named.scheme->md, GRPC_MDELEM_SCHEME_HTTP) &&
!grpc_mdelem_eq(b->idx.named.scheme->md, GRPC_MDELEM_SCHEME_HTTPS) &&
!grpc_mdelem_eq(b->idx.named.scheme->md, GRPC_MDELEM_SCHEME_GRPC)) {
@@ -165,7 +165,7 @@ static grpc_error* server_filter_incoming_metadata(grpc_exec_ctx* exec_ctx,
GRPC_ERROR_STR_KEY, grpc_slice_from_static_string(":scheme")));
}
- if (b->idx.named.content_type != NULL) {
+ if (b->idx.named.content_type != nullptr) {
if (!grpc_mdelem_eq(b->idx.named.content_type->md,
GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC)) {
if (grpc_slice_buf_start_eq(GRPC_MDVALUE(b->idx.named.content_type->md),
@@ -194,7 +194,7 @@ static grpc_error* server_filter_incoming_metadata(grpc_exec_ctx* exec_ctx,
grpc_metadata_batch_remove(exec_ctx, b, b->idx.named.content_type);
}
- if (b->idx.named.path == NULL) {
+ if (b->idx.named.path == nullptr) {
add_error(error_name, &error,
grpc_error_set_str(
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Missing header"),
@@ -239,7 +239,7 @@ static grpc_error* server_filter_incoming_metadata(grpc_exec_ctx* exec_ctx,
}
}
- if (b->idx.named.host != NULL && b->idx.named.authority == NULL) {
+ if (b->idx.named.host != nullptr && b->idx.named.authority == nullptr) {
grpc_linked_mdelem* el = b->idx.named.host;
grpc_mdelem md = GRPC_MDELEM_REF(el->md);
grpc_metadata_batch_remove(exec_ctx, b, el);
@@ -252,7 +252,7 @@ static grpc_error* server_filter_incoming_metadata(grpc_exec_ctx* exec_ctx,
GRPC_MDELEM_UNREF(exec_ctx, md);
}
- if (b->idx.named.authority == NULL) {
+ if (b->idx.named.authority == nullptr) {
add_error(
error_name, &error,
grpc_error_set_str(
@@ -281,16 +281,16 @@ static void hs_on_complete(grpc_exec_ctx* exec_ctx, void* user_data,
grpc_call_element* elem = (grpc_call_element*)user_data;
call_data* calld = (call_data*)elem->call_data;
/* Call recv_message_ready if we got the payload via the path field */
- if (calld->seen_path_with_query && calld->recv_message_ready != NULL) {
+ if (calld->seen_path_with_query && calld->recv_message_ready != nullptr) {
*calld->pp_recv_message = calld->payload_bin_delivered
- ? NULL
+ ? nullptr
: (grpc_byte_stream*)&calld->read_stream;
// Re-enter call combiner for recv_message_ready, since the surface
// code will release the call combiner for each callback it receives.
GRPC_CALL_COMBINER_START(exec_ctx, calld->call_combiner,
calld->recv_message_ready, GRPC_ERROR_REF(err),
"resuming recv_message_ready from on_complete");
- calld->recv_message_ready = NULL;
+ calld->recv_message_ready = nullptr;
calld->payload_bin_delivered = true;
}
GRPC_CLOSURE_RUN(exec_ctx, calld->on_complete, GRPC_ERROR_REF(err));
@@ -341,7 +341,7 @@ static grpc_error* hs_mutate_op(grpc_exec_ctx* exec_ctx,
if (op->recv_initial_metadata) {
/* substitute our callback for the higher callback */
- GPR_ASSERT(op->payload->recv_initial_metadata.recv_flags != NULL);
+ GPR_ASSERT(op->payload->recv_initial_metadata.recv_flags != nullptr);
calld->recv_initial_metadata =
op->payload->recv_initial_metadata.recv_initial_metadata;
calld->recv_initial_metadata_flags =
diff --git a/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc b/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc
index 77b086c324..762198f034 100644
--- a/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc
+++ b/src/core/ext/filters/load_reporting/server_load_reporting_filter.cc
@@ -60,7 +60,7 @@ static void on_initial_md_ready(grpc_exec_ctx* exec_ctx, void* user_data,
call_data* calld = (call_data*)elem->call_data;
if (err == GRPC_ERROR_NONE) {
- if (calld->recv_initial_metadata->idx.named.path != NULL) {
+ if (calld->recv_initial_metadata->idx.named.path != nullptr) {
calld->service_method = grpc_slice_ref_internal(
GRPC_MDVALUE(calld->recv_initial_metadata->idx.named.path->md));
calld->have_service_method = true;
@@ -68,7 +68,7 @@ static void on_initial_md_ready(grpc_exec_ctx* exec_ctx, void* user_data,
err = grpc_error_add_child(
err, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Missing :path header"));
}
- if (calld->recv_initial_metadata->idx.named.lb_token != NULL) {
+ if (calld->recv_initial_metadata->idx.named.lb_token != nullptr) {
calld->initial_md_string = grpc_slice_ref_internal(
GRPC_MDVALUE(calld->recv_initial_metadata->idx.named.lb_token->md));
calld->have_initial_md_string = true;
diff --git a/src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc b/src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc
index b26cbe3579..ab8387967c 100644
--- a/src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc
+++ b/src/core/ext/filters/load_reporting/server_load_reporting_plugin.cc
@@ -48,8 +48,8 @@ static bool maybe_add_server_load_reporting_filter(
!grpc_channel_stack_builder_iterator_is_end(it);
grpc_channel_stack_builder_iterator_destroy(it);
if (is_load_reporting_enabled(args) && !already_has_load_reporting_filter) {
- return grpc_channel_stack_builder_prepend_filter(builder, filter, NULL,
- NULL);
+ return grpc_channel_stack_builder_prepend_filter(builder, filter, nullptr,
+ nullptr);
}
return true;
}
diff --git a/src/core/ext/filters/max_age/max_age_filter.cc b/src/core/ext/filters/max_age/max_age_filter.cc
index ade2e5bc82..001f9f3906 100644
--- a/src/core/ext/filters/max_age/max_age_filter.cc
+++ b/src/core/ext/filters/max_age/max_age_filter.cc
@@ -126,7 +126,7 @@ static void start_max_age_timer_after_init(grpc_exec_ctx* exec_ctx, void* arg,
grpc_exec_ctx_now(exec_ctx) + chand->max_connection_age,
&chand->close_max_age_channel);
gpr_mu_unlock(&chand->max_age_timer_mu);
- grpc_transport_op* op = grpc_make_transport_op(NULL);
+ grpc_transport_op* op = grpc_make_transport_op(nullptr);
op->on_connectivity_state_change = &chand->channel_connectivity_changed,
op->connectivity_state = &chand->connectivity_state;
grpc_channel_next_op(exec_ctx,
@@ -159,7 +159,7 @@ static void close_max_idle_channel(grpc_exec_ctx* exec_ctx, void* arg,
if (error == GRPC_ERROR_NONE) {
/* Prevent the max idle timer from being set again */
gpr_atm_no_barrier_fetch_add(&chand->call_count, 1);
- grpc_transport_op* op = grpc_make_transport_op(NULL);
+ grpc_transport_op* op = grpc_make_transport_op(nullptr);
op->goaway_error =
grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING("max_idle"),
GRPC_ERROR_INT_HTTP2_ERROR, GRPC_HTTP2_NO_ERROR);
@@ -204,7 +204,7 @@ static void force_close_max_age_channel(grpc_exec_ctx* exec_ctx, void* arg,
chand->max_age_grace_timer_pending = false;
gpr_mu_unlock(&chand->max_age_timer_mu);
if (error == GRPC_ERROR_NONE) {
- grpc_transport_op* op = grpc_make_transport_op(NULL);
+ grpc_transport_op* op = grpc_make_transport_op(nullptr);
op->disconnect_with_error =
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Channel reaches max age");
grpc_channel_element* elem =
@@ -221,7 +221,7 @@ static void channel_connectivity_changed(grpc_exec_ctx* exec_ctx, void* arg,
grpc_error* error) {
channel_data* chand = (channel_data*)arg;
if (chand->connectivity_state != GRPC_CHANNEL_SHUTDOWN) {
- grpc_transport_op* op = grpc_make_transport_op(NULL);
+ grpc_transport_op* op = grpc_make_transport_op(nullptr);
op->on_connectivity_state_change = &chand->channel_connectivity_changed,
op->connectivity_state = &chand->connectivity_state;
grpc_channel_next_op(
@@ -398,7 +398,7 @@ static bool maybe_add_max_age_filter(grpc_exec_ctx* exec_ctx,
MAX_CONNECTION_IDLE_INTEGER_OPTIONS) != INT_MAX;
if (enable) {
return grpc_channel_stack_builder_prepend_filter(
- builder, &grpc_max_age_filter, NULL, NULL);
+ builder, &grpc_max_age_filter, nullptr, nullptr);
} else {
return true;
}
@@ -407,7 +407,7 @@ static bool maybe_add_max_age_filter(grpc_exec_ctx* exec_ctx,
extern "C" void grpc_max_age_filter_init(void) {
grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL,
GRPC_CHANNEL_INIT_BUILTIN_PRIORITY,
- maybe_add_max_age_filter, NULL);
+ maybe_add_max_age_filter, nullptr);
}
extern "C" void grpc_max_age_filter_shutdown(void) {}
diff --git a/src/core/ext/filters/message_size/message_size_filter.cc b/src/core/ext/filters/message_size/message_size_filter.cc
index 9376d978b4..2e81d09961 100644
--- a/src/core/ext/filters/message_size/message_size_filter.cc
+++ b/src/core/ext/filters/message_size/message_size_filter.cc
@@ -60,22 +60,22 @@ static void* refcounted_message_size_limits_create_from_json(
const grpc_json* json) {
int max_request_message_bytes = -1;
int max_response_message_bytes = -1;
- for (grpc_json* field = json->child; field != NULL; field = field->next) {
- if (field->key == NULL) continue;
+ for (grpc_json* field = json->child; field != nullptr; field = field->next) {
+ if (field->key == nullptr) continue;
if (strcmp(field->key, "maxRequestMessageBytes") == 0) {
- if (max_request_message_bytes >= 0) return NULL; // Duplicate.
+ if (max_request_message_bytes >= 0) return nullptr; // Duplicate.
if (field->type != GRPC_JSON_STRING && field->type != GRPC_JSON_NUMBER) {
- return NULL;
+ return nullptr;
}
max_request_message_bytes = gpr_parse_nonnegative_int(field->value);
- if (max_request_message_bytes == -1) return NULL;
+ if (max_request_message_bytes == -1) return nullptr;
} else if (strcmp(field->key, "maxResponseMessageBytes") == 0) {
- if (max_response_message_bytes >= 0) return NULL; // Duplicate.
+ if (max_response_message_bytes >= 0) return nullptr; // Duplicate.
if (field->type != GRPC_JSON_STRING && field->type != GRPC_JSON_NUMBER) {
- return NULL;
+ return nullptr;
}
max_response_message_bytes = gpr_parse_nonnegative_int(field->value);
- if (max_response_message_bytes == -1) return NULL;
+ if (max_response_message_bytes == -1) return nullptr;
}
}
refcounted_message_size_limits* value =
@@ -112,7 +112,7 @@ static void recv_message_ready(grpc_exec_ctx* exec_ctx, void* user_data,
grpc_error* error) {
grpc_call_element* elem = (grpc_call_element*)user_data;
call_data* calld = (call_data*)elem->call_data;
- if (*calld->recv_message != NULL && calld->limits.max_recv_size >= 0 &&
+ if (*calld->recv_message != nullptr && calld->limits.max_recv_size >= 0 &&
(*calld->recv_message)->length > (size_t)calld->limits.max_recv_size) {
char* message_string;
gpr_asprintf(&message_string,
@@ -175,7 +175,7 @@ static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx,
channel_data* chand = (channel_data*)elem->channel_data;
call_data* calld = (call_data*)elem->call_data;
calld->call_combiner = args->call_combiner;
- calld->next_recv_message_ready = NULL;
+ calld->next_recv_message_ready = nullptr;
GRPC_CLOSURE_INIT(&calld->recv_message_ready, recv_message_ready, elem,
grpc_schedule_on_exec_ctx);
// Get max sizes from channel data, then merge in per-method config values.
@@ -183,11 +183,11 @@ static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx,
// apply the max request size to the send limit and the max response
// size to the receive limit.
calld->limits = chand->limits;
- if (chand->method_limit_table != NULL) {
+ if (chand->method_limit_table != nullptr) {
refcounted_message_size_limits* limits =
(refcounted_message_size_limits*)grpc_method_config_table_get(
exec_ctx, chand->method_limit_table, args->path);
- if (limits != NULL) {
+ if (limits != nullptr) {
if (limits->limits.max_send_size >= 0 &&
(limits->limits.max_send_size < calld->limits.max_send_size ||
calld->limits.max_send_size < 0)) {
@@ -250,11 +250,11 @@ static grpc_error* init_channel_elem(grpc_exec_ctx* exec_ctx,
// Get method config table from channel args.
const grpc_arg* channel_arg =
grpc_channel_args_find(args->channel_args, GRPC_ARG_SERVICE_CONFIG);
- if (channel_arg != NULL) {
+ if (channel_arg != nullptr) {
GPR_ASSERT(channel_arg->type == GRPC_ARG_STRING);
grpc_service_config* service_config =
grpc_service_config_create(channel_arg->value.string);
- if (service_config != NULL) {
+ if (service_config != nullptr) {
chand->method_limit_table =
grpc_service_config_create_method_config_table(
exec_ctx, service_config,
@@ -299,12 +299,12 @@ static bool maybe_add_message_size_filter(grpc_exec_ctx* exec_ctx,
}
const grpc_arg* a =
grpc_channel_args_find(channel_args, GRPC_ARG_SERVICE_CONFIG);
- if (a != NULL) {
+ if (a != nullptr) {
enable = true;
}
if (enable) {
return grpc_channel_stack_builder_prepend_filter(
- builder, &grpc_message_size_filter, NULL, NULL);
+ builder, &grpc_message_size_filter, nullptr, nullptr);
} else {
return true;
}
@@ -313,13 +313,13 @@ static bool maybe_add_message_size_filter(grpc_exec_ctx* exec_ctx,
extern "C" void grpc_message_size_filter_init(void) {
grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL,
GRPC_CHANNEL_INIT_BUILTIN_PRIORITY,
- maybe_add_message_size_filter, NULL);
+ maybe_add_message_size_filter, nullptr);
grpc_channel_init_register_stage(GRPC_CLIENT_DIRECT_CHANNEL,
GRPC_CHANNEL_INIT_BUILTIN_PRIORITY,
- maybe_add_message_size_filter, NULL);
+ maybe_add_message_size_filter, nullptr);
grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL,
GRPC_CHANNEL_INIT_BUILTIN_PRIORITY,
- maybe_add_message_size_filter, NULL);
+ maybe_add_message_size_filter, nullptr);
}
extern "C" void grpc_message_size_filter_shutdown(void) {}
diff --git a/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc b/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc
index f77ed02421..6bbb4d5739 100644
--- a/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc
+++ b/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.cc
@@ -42,7 +42,7 @@ typedef struct call_data {
// Find the user agent metadata element in the batch
static bool get_user_agent_mdelem(const grpc_metadata_batch* batch,
grpc_mdelem* md) {
- if (batch->idx.named.user_agent != NULL) {
+ if (batch->idx.named.user_agent != nullptr) {
*md = batch->idx.named.user_agent->md;
return true;
}
@@ -104,7 +104,7 @@ static grpc_error* init_call_elem(grpc_exec_ctx* exec_ctx,
grpc_call_element* elem,
const grpc_call_element_args* args) {
call_data* calld = (call_data*)elem->call_data;
- calld->next_recv_initial_metadata_ready = NULL;
+ calld->next_recv_initial_metadata_ready = nullptr;
calld->workaround_active = false;
GRPC_CLOSURE_INIT(&calld->recv_initial_metadata_ready,
recv_initial_metadata_ready, elem,
@@ -142,7 +142,7 @@ static bool parse_user_agent(grpc_mdelem md) {
long major_version, minor_version;
char* head = strtok(user_agent_str, " ");
- while (head != NULL) {
+ while (head != nullptr) {
if (!grpc_objc_specifier_seen &&
0 == strncmp(head, grpc_objc_specifier, grpc_objc_specifier_len)) {
major_version_str = head + grpc_objc_specifier_len;
@@ -153,11 +153,11 @@ static bool parse_user_agent(grpc_mdelem md) {
break;
}
- head = strtok(NULL, " ");
+ head = strtok(nullptr, " ");
}
if (grpc_objc_specifier_seen) {
major_version_str = strtok(major_version_str, ".");
- minor_version_str = strtok(NULL, ".");
+ minor_version_str = strtok(nullptr, ".");
major_version = atol(major_version_str);
minor_version = atol(minor_version_str);
}
@@ -186,20 +186,20 @@ static bool register_workaround_cronet_compression(
grpc_channel_stack_builder_get_channel_arguments(builder);
const grpc_arg* a = grpc_channel_args_find(
channel_args, GRPC_ARG_WORKAROUND_CRONET_COMPRESSION);
- if (a == NULL) {
+ if (a == nullptr) {
return true;
}
if (grpc_channel_arg_get_bool(a, false) == false) {
return true;
}
return grpc_channel_stack_builder_prepend_filter(
- builder, &grpc_workaround_cronet_compression_filter, NULL, NULL);
+ builder, &grpc_workaround_cronet_compression_filter, nullptr, nullptr);
}
extern "C" void grpc_workaround_cronet_compression_filter_init(void) {
grpc_channel_init_register_stage(
GRPC_SERVER_CHANNEL, GRPC_WORKAROUND_PRIORITY_HIGH,
- register_workaround_cronet_compression, NULL);
+ register_workaround_cronet_compression, nullptr);
grpc_register_workaround(GRPC_WORKAROUND_ID_CRONET_COMPRESSION,
parse_user_agent);
}
diff --git a/src/core/ext/filters/workarounds/workaround_utils.cc b/src/core/ext/filters/workarounds/workaround_utils.cc
index 9db42fbeee..9d76582ea2 100644
--- a/src/core/ext/filters/workarounds/workaround_utils.cc
+++ b/src/core/ext/filters/workarounds/workaround_utils.cc
@@ -30,7 +30,7 @@ grpc_workaround_user_agent_md* grpc_parse_user_agent(grpc_mdelem md) {
(grpc_workaround_user_agent_md*)grpc_mdelem_get_user_data(
md, destroy_user_agent_md);
- if (NULL != user_agent_md) {
+ if (nullptr != user_agent_md) {
return user_agent_md;
}
user_agent_md = (grpc_workaround_user_agent_md*)gpr_malloc(
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..028b69e5ff 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,8 +98,8 @@ 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
- : grpc_lame_client_channel_create(
- target, GRPC_STATUS_INTERNAL,
- "Failed to create client 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..e748d28964 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,14 +58,14 @@ 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
- : grpc_lame_client_channel_create(
- target, GRPC_STATUS_INTERNAL,
- "Failed to create client channel");
+ return channel != nullptr ? channel
+ : grpc_lame_client_channel_create(
+ target, GRPC_STATUS_INTERNAL,
+ "Failed to create client channel");
}
#else // !GPR_SUPPORT_CHANNELS_FROM_FD
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..dd2bc427a7 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,8 +217,8 @@ 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
- : grpc_lame_client_channel_create(
- target, GRPC_STATUS_INTERNAL,
- "Failed to create secure client channel");
+ return channel != nullptr ? channel
+ : grpc_lame_client_channel_create(
+ target, GRPC_STATUS_INTERNAL,
+ "Failed to create secure client channel");
}
diff --git a/src/core/ext/transport/chttp2/server/chttp2_server.cc b/src/core/ext/transport/chttp2/server/chttp2_server.cc
index 98683acc59..93be5e4081 100644
--- a/src/core/ext/transport/chttp2/server/chttp2_server.cc
+++ b/src/core/ext/transport/chttp2/server/chttp2_server.cc
@@ -69,7 +69,7 @@ static void on_handshake_done(grpc_exec_ctx* exec_ctx, void* arg,
const char* error_str = grpc_error_string(error);
gpr_log(GPR_DEBUG, "Handshaking failed: %s", error_str);
- if (error == GRPC_ERROR_NONE && args->endpoint != NULL) {
+ if (error == GRPC_ERROR_NONE && args->endpoint != nullptr) {
// We were shut down after handshaking completed successfully, so
// destroy the endpoint here.
// TODO(ctiller): It is currently necessary to shutdown endpoints
@@ -86,7 +86,7 @@ static void on_handshake_done(grpc_exec_ctx* exec_ctx, void* arg,
// If the handshaking succeeded but there is no endpoint, then the
// handshaker may have handed off the connection to some external
// code, so we can just clean up here without creating a transport.
- if (args->endpoint != NULL) {
+ if (args->endpoint != nullptr) {
grpc_transport* transport =
grpc_create_chttp2_transport(exec_ctx, args->args, args->endpoint, 0);
grpc_server_setup_transport(
@@ -166,7 +166,7 @@ static void tcp_server_shutdown_complete(grpc_exec_ctx* exec_ctx, void* arg,
// Flush queued work before destroying handshaker factory, since that
// may do a synchronous unref.
grpc_exec_ctx_flush(exec_ctx);
- if (destroy_done != NULL) {
+ if (destroy_done != nullptr) {
destroy_done->cb(exec_ctx, destroy_done->cb_arg, GRPC_ERROR_REF(error));
grpc_exec_ctx_flush(exec_ctx);
}
@@ -194,14 +194,14 @@ grpc_error* grpc_chttp2_server_add_port(grpc_exec_ctx* exec_ctx,
grpc_server* server, const char* addr,
grpc_channel_args* args,
int* port_num) {
- grpc_resolved_addresses* resolved = NULL;
- grpc_tcp_server* tcp_server = NULL;
+ grpc_resolved_addresses* resolved = nullptr;
+ grpc_tcp_server* tcp_server = nullptr;
size_t i;
size_t count = 0;
int port_temp;
grpc_error* err = GRPC_ERROR_NONE;
- server_state* state = NULL;
- grpc_error** errors = NULL;
+ server_state* state = nullptr;
+ grpc_error** errors = nullptr;
size_t naddrs = 0;
*port_num = -1;
@@ -284,7 +284,7 @@ error:
*port_num = 0;
done:
- if (errors != NULL) {
+ if (errors != nullptr) {
for (i = 0; i < naddrs; i++) {
GRPC_ERROR_UNREF(errors[i]);
}
diff --git a/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc b/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc
index e37d69e5e9..007d1be50c 100644
--- a/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc
+++ b/src/core/ext/transport/chttp2/server/insecure/server_chttp2_posix.cc
@@ -36,7 +36,7 @@
void grpc_server_add_insecure_channel_from_fd(grpc_server* server,
void* reserved, int fd) {
- GPR_ASSERT(reserved == NULL);
+ GPR_ASSERT(reserved == nullptr);
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
char* name;
@@ -60,8 +60,9 @@ void grpc_server_add_insecure_channel_from_fd(grpc_server* server,
grpc_endpoint_add_to_pollset(&exec_ctx, server_endpoint, pollsets[i]);
}
- grpc_server_setup_transport(&exec_ctx, server, transport, NULL, server_args);
- grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL);
+ grpc_server_setup_transport(&exec_ctx, server, transport, nullptr,
+ server_args);
+ grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr);
grpc_exec_ctx_finish(&exec_ctx);
}
diff --git a/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc b/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc
index 4b2e348780..ac3ea40f47 100644
--- a/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc
+++ b/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.cc
@@ -38,16 +38,16 @@ int grpc_server_add_secure_http2_port(grpc_server* server, const char* addr,
grpc_server_credentials* creds) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_error* err = GRPC_ERROR_NONE;
- grpc_server_security_connector* sc = NULL;
+ grpc_server_security_connector* sc = nullptr;
int port_num = 0;
grpc_security_status status;
- grpc_channel_args* args = NULL;
+ grpc_channel_args* args = nullptr;
GRPC_API_TRACE(
"grpc_server_add_secure_http2_port("
"server=%p, addr=%s, creds=%p)",
3, (server, addr, creds));
// Create security context.
- if (creds == NULL) {
+ if (creds == nullptr) {
err = GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"No credentials specified for secure server port (creds==NULL)");
goto done;
@@ -74,7 +74,7 @@ int grpc_server_add_secure_http2_port(grpc_server* server, const char* addr,
// Add server port.
err = grpc_chttp2_server_add_port(&exec_ctx, server, addr, args, &port_num);
done:
- if (sc != NULL) {
+ if (sc != nullptr) {
GRPC_SECURITY_CONNECTOR_UNREF(&exec_ctx, &sc->base, "server");
}
grpc_exec_ctx_finish(&exec_ctx);
diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
index a955ec2589..43788bfc5c 100644
--- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
+++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc
@@ -201,8 +201,8 @@ static void destruct_transport(grpc_exec_ctx* exec_ctx,
grpc_chttp2_goaway_parser_destroy(&t->goaway_parser);
for (i = 0; i < STREAM_LIST_COUNT; i++) {
- GPR_ASSERT(t->lists[i].head == NULL);
- GPR_ASSERT(t->lists[i].tail == NULL);
+ GPR_ASSERT(t->lists[i].head == nullptr);
+ GPR_ASSERT(t->lists[i].tail == nullptr);
}
GRPC_ERROR_UNREF(t->goaway_error);
@@ -575,7 +575,7 @@ static void init_transport(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
schedule_bdp_ping_locked(exec_ctx, t);
grpc_chttp2_act_on_flowctl_action(
- exec_ctx, t->flow_control->PeriodicUpdate(exec_ctx), t, NULL);
+ exec_ctx, t->flow_control->PeriodicUpdate(exec_ctx), t, nullptr);
}
grpc_chttp2_initiate_write(exec_ctx, t,
@@ -614,7 +614,7 @@ static void close_transport_locked(grpc_exec_ctx* exec_ctx,
GRPC_STATUS_UNAVAILABLE);
}
if (t->write_state != GRPC_CHTTP2_WRITE_STATE_IDLE) {
- if (t->close_transport_on_writes_finished == NULL) {
+ if (t->close_transport_on_writes_finished == nullptr) {
t->close_transport_on_writes_finished =
GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"Delayed close due to in-progress write");
@@ -729,7 +729,7 @@ static void destroy_stream_locked(grpc_exec_ctx* exec_ctx, void* sp,
GPR_ASSERT((s->write_closed && s->read_closed) || s->id == 0);
if (s->id != 0) {
- GPR_ASSERT(grpc_chttp2_stream_map_find(&t->stream_map, s->id) == NULL);
+ GPR_ASSERT(grpc_chttp2_stream_map_find(&t->stream_map, s->id) == nullptr);
}
grpc_slice_buffer_destroy_internal(exec_ctx,
@@ -749,12 +749,12 @@ static void destroy_stream_locked(grpc_exec_ctx* exec_ctx, void* sp,
}
}
- GPR_ASSERT(s->send_initial_metadata_finished == NULL);
- GPR_ASSERT(s->fetching_send_message == NULL);
- GPR_ASSERT(s->send_trailing_metadata_finished == NULL);
- GPR_ASSERT(s->recv_initial_metadata_ready == NULL);
- GPR_ASSERT(s->recv_message_ready == NULL);
- GPR_ASSERT(s->recv_trailing_metadata_finished == NULL);
+ GPR_ASSERT(s->send_initial_metadata_finished == nullptr);
+ GPR_ASSERT(s->fetching_send_message == nullptr);
+ GPR_ASSERT(s->send_trailing_metadata_finished == nullptr);
+ GPR_ASSERT(s->recv_initial_metadata_ready == nullptr);
+ GPR_ASSERT(s->recv_message_ready == nullptr);
+ GPR_ASSERT(s->recv_trailing_metadata_finished == nullptr);
grpc_chttp2_data_parser_destroy(exec_ctx, &s->data_parser);
grpc_chttp2_incoming_metadata_buffer_destroy(exec_ctx,
&s->metadata_buffer[0]);
@@ -781,13 +781,13 @@ static void destroy_stream(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
grpc_chttp2_transport* t = (grpc_chttp2_transport*)gt;
grpc_chttp2_stream* s = (grpc_chttp2_stream*)gs;
- if (s->stream_compression_ctx != NULL) {
+ if (s->stream_compression_ctx != nullptr) {
grpc_stream_compression_context_destroy(s->stream_compression_ctx);
- s->stream_compression_ctx = NULL;
+ s->stream_compression_ctx = nullptr;
}
- if (s->stream_decompression_ctx != NULL) {
+ if (s->stream_decompression_ctx != nullptr) {
grpc_stream_compression_context_destroy(s->stream_decompression_ctx);
- s->stream_decompression_ctx = NULL;
+ s->stream_decompression_ctx = nullptr;
}
s->destroy_stream_arg = then_schedule_closure;
@@ -807,16 +807,16 @@ grpc_chttp2_stream* grpc_chttp2_parsing_lookup_stream(grpc_chttp2_transport* t,
grpc_chttp2_stream* grpc_chttp2_parsing_accept_stream(grpc_exec_ctx* exec_ctx,
grpc_chttp2_transport* t,
uint32_t id) {
- if (t->channel_callback.accept_stream == NULL) {
- return NULL;
+ if (t->channel_callback.accept_stream == nullptr) {
+ return nullptr;
}
grpc_chttp2_stream* accepting;
- GPR_ASSERT(t->accepting_stream == NULL);
+ GPR_ASSERT(t->accepting_stream == nullptr);
t->accepting_stream = &accepting;
t->channel_callback.accept_stream(exec_ctx,
t->channel_callback.accept_stream_user_data,
&t->base, (void*)(uintptr_t)id);
- t->accepting_stream = NULL;
+ t->accepting_stream = nullptr;
return accepting;
}
@@ -845,9 +845,9 @@ static void set_write_state(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
t->write_state = st;
if (st == GRPC_CHTTP2_WRITE_STATE_IDLE) {
GRPC_CLOSURE_LIST_SCHED(exec_ctx, &t->run_after_write);
- if (t->close_transport_on_writes_finished != NULL) {
+ if (t->close_transport_on_writes_finished != nullptr) {
grpc_error* err = t->close_transport_on_writes_finished;
- t->close_transport_on_writes_finished = NULL;
+ t->close_transport_on_writes_finished = nullptr;
close_transport_locked(exec_ctx, t, err);
}
}
@@ -987,7 +987,7 @@ static grpc_closure_scheduler* write_scheduler(grpc_chttp2_transport* t,
case GRPC_CHTTP2_OPTIMIZE_FOR_LATENCY:
return grpc_schedule_on_exec_ctx;
}
- GPR_UNREACHABLE_CODE(return NULL);
+ GPR_UNREACHABLE_CODE(return nullptr);
}
#define WRITE_STATE_TUPLE_TO_INT(p, i) (2 * (int)(p) + (int)(i))
@@ -1221,7 +1221,7 @@ static grpc_closure* add_closure_barrier(grpc_closure* closure) {
static void null_then_run_closure(grpc_exec_ctx* exec_ctx,
grpc_closure** closure, grpc_error* error) {
grpc_closure* c = *closure;
- *closure = NULL;
+ *closure = nullptr;
GRPC_CLOSURE_RUN(exec_ctx, c, error);
}
@@ -1231,8 +1231,8 @@ void grpc_chttp2_complete_closure_step(grpc_exec_ctx* exec_ctx,
grpc_closure** pclosure,
grpc_error* error, const char* desc) {
grpc_closure* closure = *pclosure;
- *pclosure = NULL;
- if (closure == NULL) {
+ *pclosure = nullptr;
+ if (closure == nullptr) {
GRPC_ERROR_UNREF(error);
return;
}
@@ -1262,7 +1262,7 @@ void grpc_chttp2_complete_closure_step(grpc_exec_ctx* exec_ctx,
if (closure->next_data.scratch < CLOSURE_BARRIER_FIRST_REF_BIT) {
if (closure->next_data.scratch & CLOSURE_BARRIER_STATS_BIT) {
grpc_transport_move_stats(&s->stats, s->collecting_stats);
- s->collecting_stats = NULL;
+ s->collecting_stats = nullptr;
}
if ((t->write_state == GRPC_CHTTP2_WRITE_STATE_IDLE) ||
!(closure->next_data.scratch & CLOSURE_BARRIER_MAY_COVER_WRITE)) {
@@ -1275,7 +1275,7 @@ void grpc_chttp2_complete_closure_step(grpc_exec_ctx* exec_ctx,
}
static bool contains_non_ok_status(grpc_metadata_batch* batch) {
- if (batch->idx.named.grpc_status != NULL) {
+ if (batch->idx.named.grpc_status != nullptr) {
return !grpc_mdelem_eq(batch->idx.named.grpc_status->md,
GRPC_MDELEM_GRPC_STATUS_0);
}
@@ -1306,7 +1306,7 @@ static void continue_fetching_send_locked(grpc_exec_ctx* exec_ctx,
grpc_chttp2_transport* t,
grpc_chttp2_stream* s) {
for (;;) {
- if (s->fetching_send_message == NULL) {
+ if (s->fetching_send_message == nullptr) {
/* Stream was cancelled before message fetch completed */
abort(); /* TODO(ctiller): what cleanup here? */
return; /* early out */
@@ -1320,14 +1320,14 @@ static void continue_fetching_send_locked(grpc_exec_ctx* exec_ctx,
"fetching_send_message_finished");
} else {
grpc_chttp2_write_cb* cb = t->write_cb_pool;
- if (cb == NULL) {
+ if (cb == nullptr) {
cb = (grpc_chttp2_write_cb*)gpr_malloc(sizeof(*cb));
} else {
t->write_cb_pool = cb->next;
}
cb->call_at_byte = notify_offset;
cb->closure = s->fetching_send_message_finished;
- s->fetching_send_message_finished = NULL;
+ s->fetching_send_message_finished = nullptr;
grpc_chttp2_write_cb** list =
s->fetching_send_message->flags & GRPC_WRITE_THROUGH
? &s->on_write_finished_cbs
@@ -1335,7 +1335,7 @@ static void continue_fetching_send_locked(grpc_exec_ctx* exec_ctx,
cb->next = *list;
*list = cb;
}
- s->fetching_send_message = NULL;
+ s->fetching_send_message = nullptr;
return; /* early out */
} else if (grpc_byte_stream_next(exec_ctx, s->fetching_send_message,
UINT32_MAX, &s->complete_fetch_locked)) {
@@ -1373,7 +1373,7 @@ static void do_nothing(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {}
static void log_metadata(const grpc_metadata_batch* md_batch, uint32_t id,
bool is_client, bool is_initial) {
- for (grpc_linked_mdelem* md = md_batch->list.head; md != NULL;
+ for (grpc_linked_mdelem* md = md_batch->list.head; md != nullptr;
md = md->next) {
char* key = grpc_slice_to_c_string(GRPC_MDKEY(md->md));
char* value = grpc_slice_to_c_string(GRPC_MDVALUE(md->md));
@@ -1412,9 +1412,9 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
}
grpc_closure* on_complete = op->on_complete;
- if (on_complete == NULL) {
+ if (on_complete == nullptr) {
on_complete =
- GRPC_CLOSURE_CREATE(do_nothing, NULL, grpc_schedule_on_exec_ctx);
+ GRPC_CLOSURE_CREATE(do_nothing, nullptr, grpc_schedule_on_exec_ctx);
}
/* use final_data as a barrier until enqueue time; the inital counter is
@@ -1423,7 +1423,7 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
on_complete->error_data.error = GRPC_ERROR_NONE;
if (op->collect_stats) {
- GPR_ASSERT(s->collecting_stats == NULL);
+ GPR_ASSERT(s->collecting_stats == nullptr);
s->collecting_stats = op_payload->collect_stats.collect_stats;
on_complete->next_data.scratch |= CLOSURE_BARRIER_STATS_BIT;
}
@@ -1436,12 +1436,12 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
if (op->send_initial_metadata) {
GRPC_STATS_INC_HTTP2_OP_SEND_INITIAL_METADATA(exec_ctx);
- GPR_ASSERT(s->send_initial_metadata_finished == NULL);
+ GPR_ASSERT(s->send_initial_metadata_finished == nullptr);
on_complete->next_data.scratch |= CLOSURE_BARRIER_MAY_COVER_WRITE;
/* Identify stream compression */
if (op_payload->send_initial_metadata.send_initial_metadata->idx.named
- .content_encoding == NULL ||
+ .content_encoding == nullptr ||
grpc_stream_compression_method_parse(
GRPC_MDVALUE(
op_payload->send_initial_metadata.send_initial_metadata->idx
@@ -1502,7 +1502,7 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
}
}
} else {
- s->send_initial_metadata = NULL;
+ s->send_initial_metadata = nullptr;
grpc_chttp2_complete_closure_step(
exec_ctx, t, s, &s->send_initial_metadata_finished,
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
@@ -1511,7 +1511,7 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
"send_initial_metadata_finished");
}
}
- if (op_payload->send_initial_metadata.peer_string != NULL) {
+ if (op_payload->send_initial_metadata.peer_string != nullptr) {
gpr_atm_rel_store(op_payload->send_initial_metadata.peer_string,
(gpr_atm)gpr_strdup(t->peer_string));
}
@@ -1538,7 +1538,7 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
&s->write_closed_error, 1),
"fetching_send_message_finished");
} else {
- GPR_ASSERT(s->fetching_send_message == NULL);
+ GPR_ASSERT(s->fetching_send_message == nullptr);
uint8_t* frame_hdr = grpc_slice_buffer_tiny_add(
&s->flow_controlled_buffer, GRPC_HEADER_SIZE_IN_BYTES);
uint32_t flags = op_payload->send_message.send_message->flags;
@@ -1566,7 +1566,7 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
if (op->send_trailing_metadata) {
GRPC_STATS_INC_HTTP2_OP_SEND_TRAILING_METADATA(exec_ctx);
- GPR_ASSERT(s->send_trailing_metadata_finished == NULL);
+ GPR_ASSERT(s->send_trailing_metadata_finished == nullptr);
on_complete->next_data.scratch |= CLOSURE_BARRIER_MAY_COVER_WRITE;
s->send_trailing_metadata_finished = add_closure_barrier(on_complete);
s->send_trailing_metadata =
@@ -1594,7 +1594,7 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
s->seen_error = true;
}
if (s->write_closed) {
- s->send_trailing_metadata = NULL;
+ s->send_trailing_metadata = nullptr;
grpc_chttp2_complete_closure_step(
exec_ctx, t, s, &s->send_trailing_metadata_finished,
grpc_metadata_batch_is_empty(
@@ -1616,14 +1616,14 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
if (op->recv_initial_metadata) {
GRPC_STATS_INC_HTTP2_OP_RECV_INITIAL_METADATA(exec_ctx);
- GPR_ASSERT(s->recv_initial_metadata_ready == NULL);
+ GPR_ASSERT(s->recv_initial_metadata_ready == nullptr);
s->recv_initial_metadata_ready =
op_payload->recv_initial_metadata.recv_initial_metadata_ready;
s->recv_initial_metadata =
op_payload->recv_initial_metadata.recv_initial_metadata;
s->trailing_metadata_available =
op_payload->recv_initial_metadata.trailing_metadata_available;
- if (op_payload->recv_initial_metadata.peer_string != NULL) {
+ if (op_payload->recv_initial_metadata.peer_string != nullptr) {
gpr_atm_rel_store(op_payload->recv_initial_metadata.peer_string,
(gpr_atm)gpr_strdup(t->peer_string));
}
@@ -1633,7 +1633,7 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
if (op->recv_message) {
GRPC_STATS_INC_HTTP2_OP_RECV_MESSAGE(exec_ctx);
size_t already_received;
- GPR_ASSERT(s->recv_message_ready == NULL);
+ GPR_ASSERT(s->recv_message_ready == nullptr);
GPR_ASSERT(!s->pending_byte_stream);
s->recv_message_ready = op_payload->recv_message.recv_message_ready;
s->recv_message = op_payload->recv_message.recv_message;
@@ -1651,7 +1651,7 @@ static void perform_stream_op_locked(grpc_exec_ctx* exec_ctx, void* stream_op,
if (op->recv_trailing_metadata) {
GRPC_STATS_INC_HTTP2_OP_RECV_TRAILING_METADATA(exec_ctx);
- GPR_ASSERT(s->recv_trailing_metadata_finished == NULL);
+ GPR_ASSERT(s->recv_trailing_metadata_finished == nullptr);
s->recv_trailing_metadata_finished = add_closure_barrier(on_complete);
s->recv_trailing_metadata =
op_payload->recv_trailing_metadata.recv_trailing_metadata;
@@ -1761,8 +1761,8 @@ static void send_goaway(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
t->sent_goaway_state = GRPC_CHTTP2_GOAWAY_SEND_SCHEDULED;
grpc_http2_error_code http_error;
grpc_slice slice;
- grpc_error_get_status(exec_ctx, error, GRPC_MILLIS_INF_FUTURE, NULL, &slice,
- &http_error);
+ grpc_error_get_status(exec_ctx, error, GRPC_MILLIS_INF_FUTURE, nullptr,
+ &slice, &http_error);
grpc_chttp2_goaway_append(t->last_new_stream_id, (uint32_t)http_error,
grpc_slice_ref_internal(slice), &t->qbuf);
grpc_chttp2_initiate_write(exec_ctx, t,
@@ -1815,12 +1815,12 @@ static void perform_transport_op_locked(grpc_exec_ctx* exec_ctx,
}
if (op->send_ping) {
- send_ping_locked(exec_ctx, t, NULL, op->send_ping);
+ send_ping_locked(exec_ctx, t, nullptr, op->send_ping);
grpc_chttp2_initiate_write(exec_ctx, t,
GRPC_CHTTP2_INITIATE_WRITE_APPLICATION_PING);
}
- if (op->on_connectivity_state_change != NULL) {
+ if (op->on_connectivity_state_change != nullptr) {
grpc_connectivity_state_notify_on_state_change(
exec_ctx, &t->channel_callback.state_tracker, op->connectivity_state,
op->on_connectivity_state_change);
@@ -1856,7 +1856,7 @@ static void perform_transport_op(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
void grpc_chttp2_maybe_complete_recv_initial_metadata(grpc_exec_ctx* exec_ctx,
grpc_chttp2_transport* t,
grpc_chttp2_stream* s) {
- if (s->recv_initial_metadata_ready != NULL &&
+ if (s->recv_initial_metadata_ready != nullptr &&
s->published_metadata[0] != GRPC_METADATA_NOT_PUBLISHED) {
if (s->seen_error) {
grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &s->frame_storage);
@@ -1876,8 +1876,8 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx* exec_ctx,
grpc_chttp2_transport* t,
grpc_chttp2_stream* s) {
grpc_error* error = GRPC_ERROR_NONE;
- if (s->recv_message_ready != NULL) {
- *s->recv_message = NULL;
+ if (s->recv_message_ready != nullptr) {
+ *s->recv_message = nullptr;
if (s->final_metadata_requested && s->seen_error) {
grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &s->frame_storage);
if (!s->pending_byte_stream) {
@@ -1906,7 +1906,7 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx* exec_ctx,
if (!grpc_stream_decompress(
s->stream_decompression_ctx,
&s->unprocessed_incoming_frames_buffer,
- &s->decompressed_data_buffer, NULL,
+ &s->decompressed_data_buffer, nullptr,
GRPC_HEADER_SIZE_IN_BYTES - s->decompressed_header_bytes,
&end_of_context)) {
grpc_slice_buffer_reset_and_unref_internal(exec_ctx,
@@ -1922,17 +1922,17 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx* exec_ctx,
}
error = grpc_deframe_unprocessed_incoming_frames(
exec_ctx, &s->data_parser, s, &s->decompressed_data_buffer,
- NULL, s->recv_message);
+ nullptr, s->recv_message);
if (end_of_context) {
grpc_stream_compression_context_destroy(
s->stream_decompression_ctx);
- s->stream_decompression_ctx = NULL;
+ s->stream_decompression_ctx = nullptr;
}
}
} else {
error = grpc_deframe_unprocessed_incoming_frames(
exec_ctx, &s->data_parser, s,
- &s->unprocessed_incoming_frames_buffer, NULL, s->recv_message);
+ &s->unprocessed_incoming_frames_buffer, nullptr, s->recv_message);
}
if (error != GRPC_ERROR_NONE) {
s->seen_error = true;
@@ -1941,15 +1941,15 @@ void grpc_chttp2_maybe_complete_recv_message(grpc_exec_ctx* exec_ctx,
grpc_slice_buffer_reset_and_unref_internal(
exec_ctx, &s->unprocessed_incoming_frames_buffer);
break;
- } else if (*s->recv_message != NULL) {
+ } else if (*s->recv_message != nullptr) {
break;
}
}
}
- if (error == GRPC_ERROR_NONE && *s->recv_message != NULL) {
+ if (error == GRPC_ERROR_NONE && *s->recv_message != nullptr) {
null_then_run_closure(exec_ctx, &s->recv_message_ready, GRPC_ERROR_NONE);
} else if (s->published_metadata[1] != GRPC_METADATA_NOT_PUBLISHED) {
- *s->recv_message = NULL;
+ *s->recv_message = nullptr;
null_then_run_closure(exec_ctx, &s->recv_message_ready, GRPC_ERROR_NONE);
}
GRPC_ERROR_UNREF(error);
@@ -1960,7 +1960,7 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx* exec_ctx,
grpc_chttp2_transport* t,
grpc_chttp2_stream* s) {
grpc_chttp2_maybe_complete_recv_message(exec_ctx, t, s);
- if (s->recv_trailing_metadata_finished != NULL && s->read_closed &&
+ if (s->recv_trailing_metadata_finished != nullptr && s->read_closed &&
s->write_closed) {
if (s->seen_error) {
grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &s->frame_storage);
@@ -1972,7 +1972,7 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx* exec_ctx,
bool pending_data = s->pending_byte_stream ||
s->unprocessed_incoming_frames_buffer.length > 0;
if (s->read_closed && s->frame_storage.length > 0 && !pending_data &&
- !s->seen_error && s->recv_trailing_metadata_finished != NULL) {
+ !s->seen_error && s->recv_trailing_metadata_finished != nullptr) {
/* Maybe some SYNC_FLUSH data is left in frame_storage. Consume them and
* maybe decompress the next 5 bytes in the stream. */
bool end_of_context;
@@ -1980,10 +1980,10 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx* exec_ctx,
s->stream_decompression_ctx = grpc_stream_compression_context_create(
s->stream_decompression_method);
}
- if (!grpc_stream_decompress(s->stream_decompression_ctx,
- &s->frame_storage,
- &s->unprocessed_incoming_frames_buffer, NULL,
- GRPC_HEADER_SIZE_IN_BYTES, &end_of_context)) {
+ if (!grpc_stream_decompress(
+ s->stream_decompression_ctx, &s->frame_storage,
+ &s->unprocessed_incoming_frames_buffer, nullptr,
+ GRPC_HEADER_SIZE_IN_BYTES, &end_of_context)) {
grpc_slice_buffer_reset_and_unref_internal(exec_ctx, &s->frame_storage);
grpc_slice_buffer_reset_and_unref_internal(
exec_ctx, &s->unprocessed_incoming_frames_buffer);
@@ -1995,12 +1995,12 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_exec_ctx* exec_ctx,
}
if (end_of_context) {
grpc_stream_compression_context_destroy(s->stream_decompression_ctx);
- s->stream_decompression_ctx = NULL;
+ s->stream_decompression_ctx = nullptr;
}
}
}
if (s->read_closed && s->frame_storage.length == 0 && !pending_data &&
- s->recv_trailing_metadata_finished != NULL) {
+ s->recv_trailing_metadata_finished != nullptr) {
grpc_chttp2_incoming_metadata_buffer_publish(
exec_ctx, &s->metadata_buffer[1], s->recv_trailing_metadata);
grpc_chttp2_complete_closure_step(
@@ -2016,18 +2016,18 @@ static void remove_stream(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
(grpc_chttp2_stream*)grpc_chttp2_stream_map_delete(&t->stream_map, id);
GPR_ASSERT(s);
if (t->incoming_stream == s) {
- t->incoming_stream = NULL;
+ t->incoming_stream = nullptr;
grpc_chttp2_parsing_become_skip_parser(exec_ctx, t);
}
if (s->pending_byte_stream) {
- if (s->on_next != NULL) {
+ if (s->on_next != nullptr) {
grpc_chttp2_incoming_byte_stream* bs = s->data_parser.parsing_frame;
if (error == GRPC_ERROR_NONE) {
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message");
}
incoming_byte_stream_publish_error(exec_ctx, bs, error);
incoming_byte_stream_unref(exec_ctx, bs);
- s->data_parser.parsing_frame = NULL;
+ s->data_parser.parsing_frame = nullptr;
} else {
GRPC_ERROR_UNREF(s->byte_stream_error);
s->byte_stream_error = GRPC_ERROR_REF(error);
@@ -2064,8 +2064,8 @@ void grpc_chttp2_cancel_stream(grpc_exec_ctx* exec_ctx,
if (!s->read_closed || !s->write_closed) {
if (s->id != 0) {
grpc_http2_error_code http_error;
- grpc_error_get_status(exec_ctx, due_to_error, s->deadline, NULL, NULL,
- &http_error);
+ grpc_error_get_status(exec_ctx, due_to_error, s->deadline, nullptr,
+ nullptr, &http_error);
grpc_slice_buffer_add(
&t->qbuf, grpc_chttp2_rst_stream_create(s->id, (uint32_t)http_error,
&s->stats.outgoing));
@@ -2083,7 +2083,7 @@ void grpc_chttp2_fake_status(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
grpc_chttp2_stream* s, grpc_error* error) {
grpc_status_code status;
grpc_slice slice;
- grpc_error_get_status(exec_ctx, error, s->deadline, &status, &slice, NULL);
+ grpc_error_get_status(exec_ctx, error, s->deadline, &status, &slice, nullptr);
if (status != GRPC_STATUS_OK) {
s->seen_error = true;
}
@@ -2094,7 +2094,7 @@ void grpc_chttp2_fake_status(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
what we want - which is safe because we haven't told anyone
about the metadata yet */
if (s->published_metadata[1] == GRPC_METADATA_NOT_PUBLISHED ||
- s->recv_trailing_metadata_finished != NULL) {
+ s->recv_trailing_metadata_finished != nullptr) {
char status_string[GPR_LTOA_MIN_BUFSIZE];
gpr_ltoa(status, status_string);
GRPC_LOG_IF_ERROR("add_status",
@@ -2165,17 +2165,17 @@ void grpc_chttp2_fail_pending_writes(grpc_exec_ctx* exec_ctx,
grpc_chttp2_stream* s, grpc_error* error) {
error =
removal_error(error, s, "Pending writes failed due to stream closure");
- s->send_initial_metadata = NULL;
+ s->send_initial_metadata = nullptr;
grpc_chttp2_complete_closure_step(
exec_ctx, t, s, &s->send_initial_metadata_finished, GRPC_ERROR_REF(error),
"send_initial_metadata_finished");
- s->send_trailing_metadata = NULL;
+ s->send_trailing_metadata = nullptr;
grpc_chttp2_complete_closure_step(
exec_ctx, t, s, &s->send_trailing_metadata_finished,
GRPC_ERROR_REF(error), "send_trailing_metadata_finished");
- s->fetching_send_message = NULL;
+ s->fetching_send_message = nullptr;
grpc_chttp2_complete_closure_step(
exec_ctx, t, s, &s->fetching_send_message_finished, GRPC_ERROR_REF(error),
"fetching_send_message_finished");
@@ -2248,7 +2248,7 @@ static void close_from_api(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
grpc_status_code grpc_status;
grpc_slice slice;
grpc_error_get_status(exec_ctx, error, s->deadline, &grpc_status, &slice,
- NULL);
+ nullptr);
GPR_ASSERT(grpc_status >= 0 && (int)grpc_status < 100);
@@ -2472,7 +2472,7 @@ static grpc_error* try_http_parsing(grpc_exec_ctx* exec_ctx,
grpc_error* parse_error = GRPC_ERROR_NONE;
for (; i < t->read_buffer.count && parse_error == GRPC_ERROR_NONE; i++) {
parse_error =
- grpc_http_parser_parse(&parser, t->read_buffer.slices[i], NULL);
+ grpc_http_parser_parse(&parser, t->read_buffer.slices[i], nullptr);
}
if (parse_error == GRPC_ERROR_NONE &&
(parse_error = grpc_http_parser_eof(&parser)) == GRPC_ERROR_NONE) {
@@ -2569,7 +2569,7 @@ static void read_action_locked(grpc_exec_ctx* exec_ctx, void* tp,
grpc_endpoint_read(exec_ctx, t->ep, &t->read_buffer,
&t->read_action_locked);
grpc_chttp2_act_on_flowctl_action(exec_ctx, t->flow_control->MakeAction(),
- t, NULL);
+ t, nullptr);
GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "keep_reading");
} else {
GRPC_CHTTP2_UNREF_TRANSPORT(exec_ctx, t, "reading_action");
@@ -2820,7 +2820,7 @@ static void reset_byte_stream(grpc_exec_ctx* exec_ctx, void* arg,
} else {
GPR_ASSERT(error != GRPC_ERROR_NONE);
GRPC_CLOSURE_SCHED(exec_ctx, s->on_next, GRPC_ERROR_REF(error));
- s->on_next = NULL;
+ s->on_next = nullptr;
GRPC_ERROR_UNREF(s->byte_stream_error);
s->byte_stream_error = GRPC_ERROR_NONE;
grpc_chttp2_cancel_stream(exec_ctx, s->t, s, GRPC_ERROR_REF(error));
@@ -2859,9 +2859,9 @@ static void incoming_byte_stream_next_locked(grpc_exec_ctx* exec_ctx,
} else if (s->byte_stream_error != GRPC_ERROR_NONE) {
GRPC_CLOSURE_SCHED(exec_ctx, bs->next_action.on_complete,
GRPC_ERROR_REF(s->byte_stream_error));
- if (s->data_parser.parsing_frame != NULL) {
+ if (s->data_parser.parsing_frame != nullptr) {
incoming_byte_stream_unref(exec_ctx, s->data_parser.parsing_frame);
- s->data_parser.parsing_frame = NULL;
+ s->data_parser.parsing_frame = nullptr;
}
} else if (s->read_closed) {
if (bs->remaining_bytes != 0) {
@@ -2869,9 +2869,9 @@ static void incoming_byte_stream_next_locked(grpc_exec_ctx* exec_ctx,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Truncated message");
GRPC_CLOSURE_SCHED(exec_ctx, bs->next_action.on_complete,
GRPC_ERROR_REF(s->byte_stream_error));
- if (s->data_parser.parsing_frame != NULL) {
+ if (s->data_parser.parsing_frame != nullptr) {
incoming_byte_stream_unref(exec_ctx, s->data_parser.parsing_frame);
- s->data_parser.parsing_frame = NULL;
+ s->data_parser.parsing_frame = nullptr;
}
} else {
/* Should never reach here. */
@@ -2927,7 +2927,7 @@ static grpc_error* incoming_byte_stream_pull(grpc_exec_ctx* exec_ctx,
}
if (!grpc_stream_decompress(s->stream_decompression_ctx,
&s->unprocessed_incoming_frames_buffer,
- &s->decompressed_data_buffer, NULL,
+ &s->decompressed_data_buffer, nullptr,
MAX_SIZE_T, &end_of_context)) {
error =
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Stream decompression error.");
@@ -2939,7 +2939,7 @@ static grpc_error* incoming_byte_stream_pull(grpc_exec_ctx* exec_ctx,
s->unprocessed_incoming_frames_decompressed = true;
if (end_of_context) {
grpc_stream_compression_context_destroy(s->stream_decompression_ctx);
- s->stream_decompression_ctx = NULL;
+ s->stream_decompression_ctx = nullptr;
}
if (s->unprocessed_incoming_frames_buffer.length == 0) {
*slice = grpc_empty_slice();
@@ -2947,7 +2947,7 @@ static grpc_error* incoming_byte_stream_pull(grpc_exec_ctx* exec_ctx,
}
error = grpc_deframe_unprocessed_incoming_frames(
exec_ctx, &s->data_parser, s, &s->unprocessed_incoming_frames_buffer,
- slice, NULL);
+ slice, nullptr);
if (error != GRPC_ERROR_NONE) {
return error;
}
@@ -2985,7 +2985,7 @@ static void incoming_byte_stream_publish_error(
GPR_ASSERT(error != GRPC_ERROR_NONE);
GRPC_CLOSURE_SCHED(exec_ctx, s->on_next, GRPC_ERROR_REF(error));
- s->on_next = NULL;
+ s->on_next = nullptr;
GRPC_ERROR_UNREF(s->byte_stream_error);
s->byte_stream_error = GRPC_ERROR_REF(error);
grpc_chttp2_cancel_stream(exec_ctx, bs->transport, bs->stream,
@@ -3006,7 +3006,7 @@ grpc_error* grpc_chttp2_incoming_byte_stream_push(
return error;
} else {
bs->remaining_bytes -= (uint32_t)GRPC_SLICE_LENGTH(slice);
- if (slice_out != NULL) {
+ if (slice_out != nullptr) {
*slice_out = slice;
}
return GRPC_ERROR_NONE;
@@ -3248,7 +3248,7 @@ void grpc_chttp2_transport_start_reading(grpc_exec_ctx* exec_ctx,
grpc_chttp2_transport* t = (grpc_chttp2_transport*)transport;
GRPC_CHTTP2_REF_TRANSPORT(
t, "reading_action"); /* matches unref inside reading_action */
- if (read_buffer != NULL) {
+ if (read_buffer != nullptr) {
grpc_slice_buffer_move_into(read_buffer, &t->read_buffer);
gpr_free(read_buffer);
}
diff --git a/src/core/ext/transport/chttp2/transport/frame_data.cc b/src/core/ext/transport/chttp2/transport/frame_data.cc
index 7d2c7f5ab9..f0c3b55792 100644
--- a/src/core/ext/transport/chttp2/transport/frame_data.cc
+++ b/src/core/ext/transport/chttp2/transport/frame_data.cc
@@ -32,13 +32,13 @@
grpc_error* grpc_chttp2_data_parser_init(grpc_chttp2_data_parser* parser) {
parser->state = GRPC_CHTTP2_DATA_FH_0;
- parser->parsing_frame = NULL;
+ parser->parsing_frame = nullptr;
return GRPC_ERROR_NONE;
}
void grpc_chttp2_data_parser_destroy(grpc_exec_ctx* exec_ctx,
grpc_chttp2_data_parser* parser) {
- if (parser->parsing_frame != NULL) {
+ if (parser->parsing_frame != nullptr) {
GRPC_ERROR_UNREF(grpc_chttp2_incoming_byte_stream_finished(
exec_ctx, parser->parsing_frame,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Parser destroyed"), false));
@@ -105,9 +105,9 @@ grpc_error* grpc_deframe_unprocessed_incoming_frames(
grpc_chttp2_transport* t = s->t;
while (slices->count > 0) {
- uint8_t* beg = NULL;
- uint8_t* end = NULL;
- uint8_t* cur = NULL;
+ uint8_t* beg = nullptr;
+ uint8_t* end = nullptr;
+ uint8_t* cur = nullptr;
grpc_slice slice = grpc_slice_buffer_take_first(slices);
@@ -188,8 +188,8 @@ grpc_error* grpc_deframe_unprocessed_incoming_frames(
/* fallthrough */
case GRPC_CHTTP2_DATA_FH_4:
s->stats.incoming.framing_bytes++;
- GPR_ASSERT(stream_out != NULL);
- GPR_ASSERT(p->parsing_frame == NULL);
+ GPR_ASSERT(stream_out != nullptr);
+ GPR_ASSERT(p->parsing_frame == nullptr);
p->frame_size |= ((uint32_t)*cur);
p->state = GRPC_CHTTP2_DATA_FRAME;
++cur;
@@ -203,7 +203,7 @@ grpc_error* grpc_deframe_unprocessed_incoming_frames(
if (p->parsing_frame->remaining_bytes == 0) {
GRPC_ERROR_UNREF(grpc_chttp2_incoming_byte_stream_finished(
exec_ctx, p->parsing_frame, GRPC_ERROR_NONE, true));
- p->parsing_frame = NULL;
+ p->parsing_frame = nullptr;
p->state = GRPC_CHTTP2_DATA_FH_0;
}
s->pending_byte_stream = true;
@@ -216,8 +216,8 @@ grpc_error* grpc_deframe_unprocessed_incoming_frames(
grpc_slice_unref_internal(exec_ctx, slice);
return GRPC_ERROR_NONE;
case GRPC_CHTTP2_DATA_FRAME: {
- GPR_ASSERT(p->parsing_frame != NULL);
- GPR_ASSERT(slice_out != NULL);
+ GPR_ASSERT(p->parsing_frame != nullptr);
+ GPR_ASSERT(slice_out != nullptr);
if (cur == end) {
grpc_slice_unref_internal(exec_ctx, slice);
continue;
@@ -239,7 +239,7 @@ grpc_error* grpc_deframe_unprocessed_incoming_frames(
grpc_slice_unref_internal(exec_ctx, slice);
return error;
}
- p->parsing_frame = NULL;
+ p->parsing_frame = nullptr;
p->state = GRPC_CHTTP2_DATA_FH_0;
grpc_slice_unref_internal(exec_ctx, slice);
return GRPC_ERROR_NONE;
@@ -273,7 +273,7 @@ grpc_error* grpc_deframe_unprocessed_incoming_frames(
grpc_slice_unref_internal(exec_ctx, slice);
return error;
}
- p->parsing_frame = NULL;
+ p->parsing_frame = nullptr;
p->state = GRPC_CHTTP2_DATA_FH_0;
cur += p->frame_size;
grpc_slice_buffer_undo_take_first(
@@ -302,7 +302,7 @@ grpc_error* grpc_chttp2_data_parser_parse(grpc_exec_ctx* exec_ctx, void* parser,
grpc_slice_ref_internal(slice);
grpc_slice_buffer_add(&s->unprocessed_incoming_frames_buffer, slice);
GRPC_CLOSURE_SCHED(exec_ctx, s->on_next, GRPC_ERROR_NONE);
- s->on_next = NULL;
+ s->on_next = nullptr;
s->unprocessed_incoming_frames_decompressed = false;
} else {
grpc_slice_ref_internal(slice);
diff --git a/src/core/ext/transport/chttp2/transport/frame_goaway.cc b/src/core/ext/transport/chttp2/transport/frame_goaway.cc
index 6be1d0e0f0..a2ce709a2e 100644
--- a/src/core/ext/transport/chttp2/transport/frame_goaway.cc
+++ b/src/core/ext/transport/chttp2/transport/frame_goaway.cc
@@ -26,7 +26,7 @@
#include <grpc/support/string_util.h>
void grpc_chttp2_goaway_parser_init(grpc_chttp2_goaway_parser* p) {
- p->debug_data = NULL;
+ p->debug_data = nullptr;
}
void grpc_chttp2_goaway_parser_destroy(grpc_chttp2_goaway_parser* p) {
@@ -137,7 +137,7 @@ grpc_error* grpc_chttp2_goaway_parser_parse(grpc_exec_ctx* exec_ctx,
grpc_chttp2_add_incoming_goaway(
exec_ctx, t, (uint32_t)p->error_code,
grpc_slice_new(p->debug_data, p->debug_length, gpr_free));
- p->debug_data = NULL;
+ p->debug_data = nullptr;
}
return GRPC_ERROR_NONE;
}
diff --git a/src/core/ext/transport/chttp2/transport/frame_window_update.cc b/src/core/ext/transport/chttp2/transport/frame_window_update.cc
index 62a4587ac6..08407a8e67 100644
--- a/src/core/ext/transport/chttp2/transport/frame_window_update.cc
+++ b/src/core/ext/transport/chttp2/transport/frame_window_update.cc
@@ -79,7 +79,7 @@ grpc_error* grpc_chttp2_window_update_parser_parse(
p->byte++;
}
- if (s != NULL) {
+ if (s != nullptr) {
s->stats.incoming.framing_bytes += (uint32_t)(end - cur);
}
@@ -95,7 +95,7 @@ grpc_error* grpc_chttp2_window_update_parser_parse(
GPR_ASSERT(is_last);
if (t->incoming_stream_id != 0) {
- if (s != NULL) {
+ if (s != nullptr) {
s->flow_control->RecvUpdate(received_update);
if (grpc_chttp2_list_remove_stalled_by_stream(t, s)) {
grpc_chttp2_mark_stream_writable(exec_ctx, t, s);
diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc
index 3636440905..e6e4ff24a3 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc
+++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc
@@ -51,10 +51,10 @@
/* don't consider adding anything bigger than this to the hpack table */
#define MAX_DECODER_SPACE_USAGE 512
-static grpc_slice_refcount terminal_slice_refcount = {NULL, NULL};
+static grpc_slice_refcount terminal_slice_refcount = {nullptr, nullptr};
static const grpc_slice terminal_slice = {
&terminal_slice_refcount, /* refcount */
- {{0, 0}} /* data.refcounted */
+ {{nullptr, 0}} /* data.refcounted */
};
extern "C" grpc_tracer_flag grpc_http_trace;
@@ -477,7 +477,7 @@ static void hpack_enc(grpc_exec_ctx* exec_ctx, grpc_chttp2_hpack_compressor* c,
if (GRPC_TRACER_ON(grpc_http_trace)) {
char* k = grpc_slice_to_c_string(GRPC_MDKEY(elem));
- char* v = NULL;
+ char* v = nullptr;
if (grpc_is_binary_header(GRPC_MDKEY(elem))) {
v = grpc_dump_slice(GRPC_MDVALUE(elem), GPR_DUMP_HEX);
} else {
diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.cc b/src/core/ext/transport/chttp2/transport/hpack_parser.cc
index 1181402918..960610eee0 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_parser.cc
+++ b/src/core/ext/transport/chttp2/transport/hpack_parser.cc
@@ -653,7 +653,7 @@ static grpc_error* on_hdr(grpc_exec_ctx* exec_ctx, grpc_chttp2_hpack_parser* p,
grpc_mdelem md, int add_to_table) {
if (GRPC_TRACER_ON(grpc_http_trace)) {
char* k = grpc_slice_to_c_string(GRPC_MDKEY(md));
- char* v = NULL;
+ char* v = nullptr;
if (grpc_is_binary_header(GRPC_MDKEY(md))) {
v = grpc_dump_slice(GRPC_MDVALUE(md), GPR_DUMP_HEX);
} else {
@@ -674,7 +674,7 @@ static grpc_error* on_hdr(grpc_exec_ctx* exec_ctx, grpc_chttp2_hpack_parser* p,
grpc_error* err = grpc_chttp2_hptbl_add(exec_ctx, &p->table, md);
if (err != GRPC_ERROR_NONE) return err;
}
- if (p->on_header == NULL) {
+ if (p->on_header == nullptr) {
GRPC_MDELEM_UNREF(exec_ctx, md);
return GRPC_ERROR_CREATE_FROM_STATIC_STRING("on_header callback not set");
}
@@ -1523,7 +1523,7 @@ static grpc_error* begin_parse_string(grpc_exec_ctx* exec_ctx,
uint8_t binary,
grpc_chttp2_hpack_parser_string* str) {
if (!p->huff && binary == NOT_BINARY && (end - cur) >= (intptr_t)p->strlen &&
- p->current_slice_refcount != NULL) {
+ p->current_slice_refcount != nullptr) {
GRPC_STATS_INC_HPACK_RECV_UNCOMPRESSED(exec_ctx);
str->copied = false;
str->data.referenced.refcount = p->current_slice_refcount;
@@ -1613,15 +1613,15 @@ static grpc_error* parse_value_string_with_literal_key(
void grpc_chttp2_hpack_parser_init(grpc_exec_ctx* exec_ctx,
grpc_chttp2_hpack_parser* p) {
- p->on_header = NULL;
- p->on_header_user_data = NULL;
+ p->on_header = nullptr;
+ p->on_header_user_data = nullptr;
p->state = parse_begin;
p->key.data.referenced = grpc_empty_slice();
- p->key.data.copied.str = NULL;
+ p->key.data.copied.str = nullptr;
p->key.data.copied.capacity = 0;
p->key.data.copied.length = 0;
p->value.data.referenced = grpc_empty_slice();
- p->value.data.copied.str = NULL;
+ p->value.data.copied.str = nullptr;
p->value.data.copied.capacity = 0;
p->value.data.copied.length = 0;
p->dynamic_table_update_allowed = 2;
@@ -1659,7 +1659,7 @@ grpc_error* grpc_chttp2_hpack_parser_parse(grpc_exec_ctx* exec_ctx,
error = p->state(exec_ctx, p, start, target);
start = target;
}
- p->current_slice_refcount = NULL;
+ p->current_slice_refcount = nullptr;
return error;
}
@@ -1689,7 +1689,7 @@ static void parse_stream_compression_md(grpc_exec_ctx* exec_ctx,
grpc_chttp2_transport* t,
grpc_chttp2_stream* s,
grpc_metadata_batch* initial_metadata) {
- if (initial_metadata->idx.named.content_encoding == NULL ||
+ if (initial_metadata->idx.named.content_encoding == nullptr ||
grpc_stream_compression_method_parse(
GRPC_MDVALUE(initial_metadata->idx.named.content_encoding->md), false,
&s->stream_decompression_method) == 0) {
@@ -1705,7 +1705,7 @@ grpc_error* grpc_chttp2_header_parser_parse(grpc_exec_ctx* exec_ctx,
grpc_slice slice, int is_last) {
grpc_chttp2_hpack_parser* parser = (grpc_chttp2_hpack_parser*)hpack_parser;
GPR_TIMER_BEGIN("grpc_chttp2_hpack_parser_parse", 0);
- if (s != NULL) {
+ if (s != nullptr) {
s->stats.incoming.header_bytes += GRPC_SLICE_LENGTH(slice);
}
grpc_error* error = grpc_chttp2_hpack_parser_parse(exec_ctx, parser, slice);
@@ -1721,7 +1721,7 @@ grpc_error* grpc_chttp2_header_parser_parse(grpc_exec_ctx* exec_ctx,
}
/* need to check for null stream: this can occur if we receive an invalid
stream id on a header */
- if (s != NULL) {
+ if (s != nullptr) {
if (parser->is_boundary) {
if (s->header_frames_received == GPR_ARRAY_SIZE(s->metadata_buffer)) {
GPR_TIMER_END("grpc_chttp2_hpack_parser_parse", 0);
@@ -1756,8 +1756,8 @@ grpc_error* grpc_chttp2_header_parser_parse(grpc_exec_ctx* exec_ctx,
GRPC_ERROR_NONE);
}
}
- parser->on_header = NULL;
- parser->on_header_user_data = NULL;
+ parser->on_header = nullptr;
+ parser->on_header_user_data = nullptr;
parser->is_boundary = 0xde;
parser->is_eof = 0xde;
parser->dynamic_table_update_allowed = 2;
diff --git a/src/core/ext/transport/chttp2/transport/hpack_table.cc b/src/core/ext/transport/chttp2/transport/hpack_table.cc
index 1a2bc9224e..7970d2ae27 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_table.cc
+++ b/src/core/ext/transport/chttp2/transport/hpack_table.cc
@@ -35,7 +35,7 @@ static struct {
const char* value;
} static_table[] = {
/* 0: */
- {NULL, NULL},
+ {nullptr, nullptr},
/* 1: */
{":authority", ""},
/* 2: */
diff --git a/src/core/ext/transport/chttp2/transport/incoming_metadata.cc b/src/core/ext/transport/chttp2/transport/incoming_metadata.cc
index 15f80fb8a1..4461f8c12c 100644
--- a/src/core/ext/transport/chttp2/transport/incoming_metadata.cc
+++ b/src/core/ext/transport/chttp2/transport/incoming_metadata.cc
@@ -51,7 +51,7 @@ grpc_error* grpc_chttp2_incoming_metadata_buffer_add(
grpc_error* grpc_chttp2_incoming_metadata_buffer_replace_or_add(
grpc_exec_ctx* exec_ctx, grpc_chttp2_incoming_metadata_buffer* buffer,
grpc_mdelem elem) {
- for (grpc_linked_mdelem* l = buffer->batch.list.head; l != NULL;
+ for (grpc_linked_mdelem* l = buffer->batch.list.head; l != nullptr;
l = l->next) {
if (grpc_slice_eq(GRPC_MDKEY(l->md), GRPC_MDKEY(elem))) {
GRPC_MDELEM_UNREF(exec_ctx, l->md);
diff --git a/src/core/ext/transport/chttp2/transport/parsing.cc b/src/core/ext/transport/chttp2/transport/parsing.cc
index 6737c26e72..5f07dec8e8 100644
--- a/src/core/ext/transport/chttp2/transport/parsing.cc
+++ b/src/core/ext/transport/chttp2/transport/parsing.cc
@@ -191,7 +191,7 @@ grpc_error* grpc_chttp2_perform_read(grpc_exec_ctx* exec_ctx,
if (err != GRPC_ERROR_NONE) {
return err;
}
- t->incoming_stream = NULL;
+ t->incoming_stream = nullptr;
if (++cur == end) {
t->deframe_state = GRPC_DTS_FH_0;
return GRPC_ERROR_NONE;
@@ -225,7 +225,7 @@ grpc_error* grpc_chttp2_perform_read(grpc_exec_ctx* exec_ctx,
return err;
}
t->deframe_state = GRPC_DTS_FH_0;
- t->incoming_stream = NULL;
+ t->incoming_stream = nullptr;
return GRPC_ERROR_NONE;
} else if ((uint32_t)(end - cur) > t->incoming_frame_size) {
size_t cur_offset = (size_t)(cur - beg);
@@ -238,7 +238,7 @@ grpc_error* grpc_chttp2_perform_read(grpc_exec_ctx* exec_ctx,
return err;
}
cur += t->incoming_frame_size;
- t->incoming_stream = NULL;
+ t->incoming_stream = nullptr;
goto dts_fh_0; /* loop */
} else {
err =
@@ -252,10 +252,10 @@ grpc_error* grpc_chttp2_perform_read(grpc_exec_ctx* exec_ctx,
t->incoming_frame_size -= (uint32_t)(end - cur);
return GRPC_ERROR_NONE;
}
- GPR_UNREACHABLE_CODE(return 0);
+ GPR_UNREACHABLE_CODE(return nullptr);
}
- GPR_UNREACHABLE_CODE(return 0);
+ GPR_UNREACHABLE_CODE(return nullptr);
}
static grpc_error* init_frame_parser(grpc_exec_ctx* exec_ctx,
@@ -337,7 +337,7 @@ static grpc_error* init_skip_frame_parser(grpc_exec_ctx* exec_ctx,
t->parser = grpc_chttp2_header_parser_parse;
t->parser_data = &t->hpack_parser;
t->hpack_parser.on_header = skip_header;
- t->hpack_parser.on_header_user_data = NULL;
+ t->hpack_parser.on_header_user_data = nullptr;
t->hpack_parser.is_boundary = is_eoh;
t->hpack_parser.is_eof = (uint8_t)(is_eoh ? t->header_eof : 0);
} else {
@@ -369,7 +369,7 @@ static grpc_error* init_data_frame_parser(grpc_exec_ctx* exec_ctx,
if (err != GRPC_ERROR_NONE) {
goto error_handler;
}
- if (s == NULL) {
+ if (s == nullptr) {
return init_skip_frame_parser(exec_ctx, t, 0);
}
s->received_bytes += t->incoming_frame_size;
@@ -391,9 +391,9 @@ error_handler:
t->ping_policy.max_pings_without_data;
t->ping_state.last_ping_sent_time = GRPC_MILLIS_INF_PAST;
return GRPC_ERROR_NONE;
- } else if (grpc_error_get_int(err, GRPC_ERROR_INT_STREAM_ID, NULL)) {
+ } else if (grpc_error_get_int(err, GRPC_ERROR_INT_STREAM_ID, nullptr)) {
/* handle stream errors by closing the stream */
- if (s != NULL) {
+ if (s != nullptr) {
grpc_chttp2_mark_stream_closed(exec_ctx, t, s, true, false, err);
}
grpc_slice_buffer_add(
@@ -415,7 +415,7 @@ static void on_initial_header(grpc_exec_ctx* exec_ctx, void* tp,
GPR_TIMER_BEGIN("on_initial_header", 0);
- GPR_ASSERT(s != NULL);
+ GPR_ASSERT(s != nullptr);
if (GRPC_TRACER_ON(grpc_http_trace)) {
char* key = grpc_slice_to_c_string(GRPC_MDKEY(md));
@@ -437,7 +437,7 @@ static void on_initial_header(grpc_exec_ctx* exec_ctx, void* tp,
grpc_millis* cached_timeout =
static_cast<grpc_millis*>(grpc_mdelem_get_user_data(md, free_timeout));
grpc_millis timeout;
- if (cached_timeout != NULL) {
+ if (cached_timeout != nullptr) {
timeout = *cached_timeout;
} else {
if (!grpc_http2_decode_timeout(GRPC_MDVALUE(md), &timeout)) {
@@ -499,7 +499,7 @@ static void on_trailing_header(grpc_exec_ctx* exec_ctx, void* tp,
GPR_TIMER_BEGIN("on_trailing_header", 0);
- GPR_ASSERT(s != NULL);
+ GPR_ASSERT(s != nullptr);
if (GRPC_TRACER_ON(grpc_http_trace)) {
char* key = grpc_slice_to_c_string(GRPC_MDKEY(md));
@@ -575,7 +575,7 @@ static grpc_error* init_header_frame_parser(grpc_exec_ctx* exec_ctx,
/* could be a new grpc_chttp2_stream or an existing grpc_chttp2_stream */
s = grpc_chttp2_parsing_lookup_stream(t, t->incoming_stream_id);
- if (s == NULL) {
+ if (s == nullptr) {
if (is_continuation) {
GRPC_CHTTP2_IF_TRACING(
gpr_log(GPR_ERROR,
@@ -617,7 +617,7 @@ static grpc_error* init_header_frame_parser(grpc_exec_ctx* exec_ctx,
t->last_new_stream_id = t->incoming_stream_id;
s = t->incoming_stream =
grpc_chttp2_parsing_accept_stream(exec_ctx, t, t->incoming_stream_id);
- if (s == NULL) {
+ if (s == nullptr) {
GRPC_CHTTP2_IF_TRACING(
gpr_log(GPR_ERROR, "grpc_chttp2_stream not accepted"));
return init_skip_frame_parser(exec_ctx, t, 1);
@@ -625,12 +625,12 @@ static grpc_error* init_header_frame_parser(grpc_exec_ctx* exec_ctx,
} else {
t->incoming_stream = s;
}
- GPR_ASSERT(s != NULL);
+ GPR_ASSERT(s != nullptr);
s->stats.incoming.framing_bytes += 9;
if (s->read_closed) {
GRPC_CHTTP2_IF_TRACING(gpr_log(
GPR_ERROR, "skipping already closed grpc_chttp2_stream header"));
- t->incoming_stream = NULL;
+ t->incoming_stream = nullptr;
return init_skip_frame_parser(exec_ctx, t, 1);
}
t->parser = grpc_chttp2_header_parser_parse;
@@ -639,7 +639,7 @@ static grpc_error* init_header_frame_parser(grpc_exec_ctx* exec_ctx,
case 0:
if (t->is_client && t->header_eof) {
GRPC_CHTTP2_IF_TRACING(gpr_log(GPR_INFO, "parsing Trailers-Only"));
- if (s->trailing_metadata_available != NULL) {
+ if (s->trailing_metadata_available != nullptr) {
*s->trailing_metadata_available = true;
}
t->hpack_parser.on_header = on_trailing_header;
@@ -677,7 +677,7 @@ static grpc_error* init_window_update_frame_parser(grpc_exec_ctx* exec_ctx,
if (t->incoming_stream_id != 0) {
grpc_chttp2_stream* s = t->incoming_stream =
grpc_chttp2_parsing_lookup_stream(t, t->incoming_stream_id);
- if (s == NULL) {
+ if (s == nullptr) {
return init_skip_frame_parser(exec_ctx, t, 0);
}
s->stats.incoming.framing_bytes += 9;
@@ -757,7 +757,7 @@ static grpc_error* parse_frame_slice(grpc_exec_ctx* exec_ctx,
grpc_error* err = t->parser(exec_ctx, t->parser_data, t, s, slice, is_last);
if (err == GRPC_ERROR_NONE) {
return err;
- } else if (grpc_error_get_int(err, GRPC_ERROR_INT_STREAM_ID, NULL)) {
+ } else if (grpc_error_get_int(err, GRPC_ERROR_INT_STREAM_ID, nullptr)) {
if (GRPC_TRACER_ON(grpc_http_trace)) {
const char* msg = grpc_error_string(err);
gpr_log(GPR_ERROR, "%s", msg);
diff --git a/src/core/ext/transport/chttp2/transport/stream_lists.cc b/src/core/ext/transport/chttp2/transport/stream_lists.cc
index 8d25ab277d..d92527f05c 100644
--- a/src/core/ext/transport/chttp2/transport/stream_lists.cc
+++ b/src/core/ext/transport/chttp2/transport/stream_lists.cc
@@ -46,7 +46,7 @@ grpc_tracer_flag grpc_trace_http2_stream_state =
static bool stream_list_empty(grpc_chttp2_transport* t,
grpc_chttp2_stream_list_id id) {
- return t->lists[id].head == NULL;
+ return t->lists[id].head == nullptr;
}
static bool stream_list_pop(grpc_chttp2_transport* t,
@@ -58,10 +58,10 @@ static bool stream_list_pop(grpc_chttp2_transport* t,
GPR_ASSERT(s->included[id]);
if (new_head) {
t->lists[id].head = new_head;
- new_head->links[id].prev = NULL;
+ new_head->links[id].prev = nullptr;
} else {
- t->lists[id].head = NULL;
- t->lists[id].tail = NULL;
+ t->lists[id].head = nullptr;
+ t->lists[id].tail = nullptr;
}
s->included[id] = 0;
}
@@ -70,7 +70,7 @@ static bool stream_list_pop(grpc_chttp2_transport* t,
gpr_log(GPR_DEBUG, "%p[%d][%s]: pop from %s", t, s->id,
t->is_client ? "cli" : "svr", stream_list_id_string(id));
}
- return s != 0;
+ return s != nullptr;
}
static void stream_list_remove(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
@@ -111,7 +111,7 @@ static void stream_list_add_tail(grpc_chttp2_transport* t,
grpc_chttp2_stream* old_tail;
GPR_ASSERT(!s->included[id]);
old_tail = t->lists[id].tail;
- s->links[id].next = NULL;
+ s->links[id].next = nullptr;
s->links[id].prev = old_tail;
if (old_tail) {
old_tail->links[id].next = s;
diff --git a/src/core/ext/transport/chttp2/transport/stream_map.cc b/src/core/ext/transport/chttp2/transport/stream_map.cc
index c863191795..e4f08f5a6c 100644
--- a/src/core/ext/transport/chttp2/transport/stream_map.cc
+++ b/src/core/ext/transport/chttp2/transport/stream_map.cc
@@ -62,7 +62,7 @@ void grpc_chttp2_stream_map_add(grpc_chttp2_stream_map* map, uint32_t key,
GPR_ASSERT(count == 0 || keys[count - 1] < key);
GPR_ASSERT(value);
- GPR_ASSERT(grpc_chttp2_stream_map_find(map, key) == NULL);
+ GPR_ASSERT(grpc_chttp2_stream_map_find(map, key) == nullptr);
if (count == capacity) {
if (map->free > capacity / 4) {
@@ -92,7 +92,7 @@ static void** find(grpc_chttp2_stream_map* map, uint32_t key) {
void** values = map->values;
uint32_t mid_key;
- if (max_idx == 0) return NULL;
+ if (max_idx == 0) return nullptr;
while (min_idx < max_idx) {
/* find the midpoint, avoiding overflow */
@@ -109,29 +109,29 @@ static void** find(grpc_chttp2_stream_map* map, uint32_t key) {
}
}
- return NULL;
+ return nullptr;
}
void* grpc_chttp2_stream_map_delete(grpc_chttp2_stream_map* map, uint32_t key) {
void** pvalue = find(map, key);
- void* out = NULL;
- if (pvalue != NULL) {
+ void* out = nullptr;
+ if (pvalue != nullptr) {
out = *pvalue;
- *pvalue = NULL;
- map->free += (out != NULL);
+ *pvalue = nullptr;
+ map->free += (out != nullptr);
/* recognize complete emptyness and ensure we can skip
* defragmentation later */
if (map->free == map->count) {
map->free = map->count = 0;
}
- GPR_ASSERT(grpc_chttp2_stream_map_find(map, key) == NULL);
+ GPR_ASSERT(grpc_chttp2_stream_map_find(map, key) == nullptr);
}
return out;
}
void* grpc_chttp2_stream_map_find(grpc_chttp2_stream_map* map, uint32_t key) {
void** pvalue = find(map, key);
- return pvalue != NULL ? *pvalue : NULL;
+ return pvalue != nullptr ? *pvalue : nullptr;
}
size_t grpc_chttp2_stream_map_size(grpc_chttp2_stream_map* map) {
@@ -140,11 +140,12 @@ size_t grpc_chttp2_stream_map_size(grpc_chttp2_stream_map* map) {
void* grpc_chttp2_stream_map_rand(grpc_chttp2_stream_map* map) {
if (map->count == map->free) {
- return NULL;
+ return nullptr;
}
if (map->free != 0) {
map->count = compact(map->keys, map->values, map->count);
map->free = 0;
+ GPR_ASSERT(map->count > 0);
}
return map->values[((size_t)rand()) % map->count];
}
diff --git a/src/core/ext/transport/chttp2/transport/writing.cc b/src/core/ext/transport/chttp2/transport/writing.cc
index 6154bdb682..61a2598618 100644
--- a/src/core/ext/transport/chttp2/transport/writing.cc
+++ b/src/core/ext/transport/chttp2/transport/writing.cc
@@ -120,7 +120,7 @@ static bool update_list(grpc_exec_ctx* exec_ctx, grpc_chttp2_transport* t,
grpc_error* error) {
bool sched_any = false;
grpc_chttp2_write_cb* cb = *list;
- *list = NULL;
+ *list = nullptr;
*ctr += send_bytes;
while (cb) {
grpc_chttp2_write_cb* next = cb->next;
@@ -330,24 +330,25 @@ class DataSendContext {
bool is_last_data_frame =
(send_bytes == s_->compressed_data_buffer.length &&
s_->flow_controlled_buffer.length == 0 &&
- s_->fetching_send_message == NULL);
- if (is_last_data_frame && s_->send_trailing_metadata != NULL &&
- s_->stream_compression_ctx != NULL) {
- if (!grpc_stream_compress(s_->stream_compression_ctx,
- &s_->flow_controlled_buffer,
- &s_->compressed_data_buffer, NULL, MAX_SIZE_T,
- GRPC_STREAM_COMPRESSION_FLUSH_FINISH)) {
+ s_->fetching_send_message == nullptr);
+ if (is_last_data_frame && s_->send_trailing_metadata != nullptr &&
+ s_->stream_compression_ctx != nullptr) {
+ if (!grpc_stream_compress(
+ s_->stream_compression_ctx, &s_->flow_controlled_buffer,
+ &s_->compressed_data_buffer, nullptr, MAX_SIZE_T,
+ GRPC_STREAM_COMPRESSION_FLUSH_FINISH)) {
gpr_log(GPR_ERROR, "Stream compression failed.");
}
grpc_stream_compression_context_destroy(s_->stream_compression_ctx);
- s_->stream_compression_ctx = NULL;
+ s_->stream_compression_ctx = nullptr;
/* After finish, bytes in s->compressed_data_buffer may be
* more than max_outgoing. Start another round of the current
* while loop so that send_bytes and is_last_data_frame are
* recalculated. */
return;
}
- is_last_frame_ = is_last_data_frame && s_->send_trailing_metadata != NULL &&
+ is_last_frame_ = is_last_data_frame &&
+ s_->send_trailing_metadata != nullptr &&
grpc_metadata_batch_is_empty(s_->send_trailing_metadata);
grpc_chttp2_encode_data(s_->id, &s_->compressed_data_buffer, send_bytes,
is_last_frame_, &s_->stats.outgoing, &t_->outbuf);
@@ -358,14 +359,14 @@ class DataSendContext {
}
void CompressMoreBytes() {
- if (s_->stream_compression_ctx == NULL) {
+ if (s_->stream_compression_ctx == nullptr) {
s_->stream_compression_ctx =
grpc_stream_compression_context_create(s_->stream_compression_method);
}
s_->uncompressed_data_size = s_->flow_controlled_buffer.length;
if (!grpc_stream_compress(s_->stream_compression_ctx,
&s_->flow_controlled_buffer,
- &s_->compressed_data_buffer, NULL, MAX_SIZE_T,
+ &s_->compressed_data_buffer, nullptr, MAX_SIZE_T,
GRPC_STREAM_COMPRESSION_FLUSH_SYNC)) {
gpr_log(GPR_ERROR, "Stream compression failed.");
}
@@ -397,7 +398,7 @@ class StreamWriteContext {
GRPC_CHTTP2_IF_TRACING(
gpr_log(GPR_DEBUG, "W:%p %s[%d] im-(sent,send)=(%d,%d) announce=%d", t_,
t_->is_client ? "CLIENT" : "SERVER", s->id,
- s->sent_initial_metadata, s->send_initial_metadata != NULL,
+ s->sent_initial_metadata, s->send_initial_metadata != nullptr,
(int)(s->flow_control->local_window_delta() -
s->flow_control->announced_window_delta())));
}
@@ -429,13 +430,13 @@ class StreamWriteContext {
[GRPC_CHTTP2_SETTINGS_MAX_FRAME_SIZE], // max_frame_size
&s_->stats.outgoing // stats
};
- grpc_chttp2_encode_header(exec_ctx, &t_->hpack_compressor, NULL, 0,
+ grpc_chttp2_encode_header(exec_ctx, &t_->hpack_compressor, nullptr, 0,
s_->send_initial_metadata, &hopt, &t_->outbuf);
write_context_->ResetPingRecvClock();
write_context_->IncInitialMetadataWrites();
}
- s_->send_initial_metadata = NULL;
+ s_->send_initial_metadata = nullptr;
s_->sent_initial_metadata = true;
write_context_->NoteScheduledResults();
grpc_chttp2_complete_closure_step(
@@ -502,8 +503,8 @@ class StreamWriteContext {
void FlushTrailingMetadata(grpc_exec_ctx* exec_ctx) {
if (!s_->sent_initial_metadata) return;
- if (s_->send_trailing_metadata == NULL) return;
- if (s_->fetching_send_message != NULL) return;
+ if (s_->send_trailing_metadata == nullptr) return;
+ if (s_->fetching_send_message != nullptr) return;
if (s_->flow_controlled_buffer.length != 0) return;
if (s_->compressed_data_buffer.length != 0) return;
@@ -543,12 +544,12 @@ class StreamWriteContext {
gpr_log(GPR_INFO, "not sending initial_metadata (Trailers-Only)"));
// When sending Trailers-Only, we need to move the :status and
// content-type headers to the trailers.
- if (s_->send_initial_metadata->idx.named.status != NULL) {
+ if (s_->send_initial_metadata->idx.named.status != nullptr) {
extra_headers_for_trailing_metadata_
[num_extra_headers_for_trailing_metadata_++] =
&s_->send_initial_metadata->idx.named.status->md;
}
- if (s_->send_initial_metadata->idx.named.content_type != NULL) {
+ if (s_->send_initial_metadata->idx.named.content_type != nullptr) {
extra_headers_for_trailing_metadata_
[num_extra_headers_for_trailing_metadata_++] =
&s_->send_initial_metadata->idx.named.content_type->md;
@@ -556,7 +557,7 @@ class StreamWriteContext {
}
void SentLastFrame(grpc_exec_ctx* exec_ctx) {
- s_->send_trailing_metadata = NULL;
+ s_->send_trailing_metadata = nullptr;
s_->sent_trailing_metadata = true;
if (!t_->is_client && !s_->read_closed) {
diff --git a/src/core/ext/transport/cronet/transport/cronet_api_dummy.cc b/src/core/ext/transport/cronet/transport/cronet_api_dummy.cc
index 4f248ad919..578cbb8ac6 100644
--- a/src/core/ext/transport/cronet/transport/cronet_api_dummy.cc
+++ b/src/core/ext/transport/cronet/transport/cronet_api_dummy.cc
@@ -33,7 +33,7 @@ bidirectional_stream* bidirectional_stream_create(
stream_engine* engine, void* annotation,
bidirectional_stream_callback* callback) {
GPR_ASSERT(0);
- return NULL;
+ return nullptr;
}
int bidirectional_stream_destroy(bidirectional_stream* stream) {
diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.cc b/src/core/ext/transport/cronet/transport/cronet_transport.cc
index 0b1ddf8839..4d24efe47b 100644
--- a/src/core/ext/transport/cronet/transport/cronet_transport.cc
+++ b/src/core/ext/transport/cronet/transport/cronet_transport.cc
@@ -273,7 +273,7 @@ static void null_and_maybe_free_read_buffer(stream_obj* s) {
s->state.rs.read_buffer != s->state.rs.grpc_header_bytes) {
gpr_free(s->state.rs.read_buffer);
}
- s->state.rs.read_buffer = NULL;
+ s->state.rs.read_buffer = nullptr;
}
static void maybe_flush_read(stream_obj* s) {
@@ -342,7 +342,7 @@ static void add_to_storage(struct stream_obj* s,
static void remove_from_storage(struct stream_obj* s,
struct op_and_state* oas) {
struct op_and_state* curr;
- if (s->storage.head == NULL || oas == NULL) {
+ if (s->storage.head == nullptr || oas == nullptr) {
return;
}
if (s->storage.head == oas) {
@@ -352,7 +352,7 @@ static void remove_from_storage(struct stream_obj* s,
CRONET_LOG(GPR_DEBUG, "Freed %p. Now %d in the queue", oas,
s->storage.num_pending_ops);
} else {
- for (curr = s->storage.head; curr != NULL; curr = curr->next) {
+ for (curr = s->storage.head; curr != nullptr; curr = curr->next) {
if (curr->next == oas) {
curr->next = oas->next;
s->storage.num_pending_ops--;
@@ -360,7 +360,7 @@ static void remove_from_storage(struct stream_obj* s,
s->storage.num_pending_ops);
gpr_free(oas);
break;
- } else if (curr->next == NULL) {
+ } else if (curr->next == nullptr) {
CRONET_LOG(GPR_ERROR, "Reached end of LL and did not find op to free");
}
}
@@ -375,7 +375,7 @@ static void remove_from_storage(struct stream_obj* s,
*/
static void execute_from_storage(grpc_exec_ctx* exec_ctx, stream_obj* s) {
gpr_mu_lock(&s->mu);
- for (struct op_and_state* curr = s->storage.head; curr != NULL;) {
+ for (struct op_and_state* curr = s->storage.head; curr != nullptr;) {
CRONET_LOG(GPR_DEBUG, "calling op at %p. done = %d", curr, curr->done);
GPR_ASSERT(curr->done == 0);
enum e_op_result result = execute_stream_op(exec_ctx, curr);
@@ -408,14 +408,14 @@ static void on_failed(bidirectional_stream* stream, int net_error) {
gpr_mu_lock(&s->mu);
bidirectional_stream_destroy(s->cbs);
s->state.state_callback_received[OP_FAILED] = true;
- s->cbs = NULL;
+ s->cbs = nullptr;
if (s->header_array.headers) {
gpr_free(s->header_array.headers);
- s->header_array.headers = NULL;
+ s->header_array.headers = nullptr;
}
if (s->state.ws.write_buffer) {
gpr_free(s->state.ws.write_buffer);
- s->state.ws.write_buffer = NULL;
+ s->state.ws.write_buffer = nullptr;
}
null_and_maybe_free_read_buffer(s);
gpr_mu_unlock(&s->mu);
@@ -435,14 +435,14 @@ static void on_canceled(bidirectional_stream* stream) {
gpr_mu_lock(&s->mu);
bidirectional_stream_destroy(s->cbs);
s->state.state_callback_received[OP_CANCELED] = true;
- s->cbs = NULL;
+ s->cbs = nullptr;
if (s->header_array.headers) {
gpr_free(s->header_array.headers);
- s->header_array.headers = NULL;
+ s->header_array.headers = nullptr;
}
if (s->state.ws.write_buffer) {
gpr_free(s->state.ws.write_buffer);
- s->state.ws.write_buffer = NULL;
+ s->state.ws.write_buffer = nullptr;
}
null_and_maybe_free_read_buffer(s);
gpr_mu_unlock(&s->mu);
@@ -462,7 +462,7 @@ static void on_succeeded(bidirectional_stream* stream) {
gpr_mu_lock(&s->mu);
bidirectional_stream_destroy(s->cbs);
s->state.state_callback_received[OP_SUCCEEDED] = true;
- s->cbs = NULL;
+ s->cbs = nullptr;
null_and_maybe_free_read_buffer(s);
gpr_mu_unlock(&s->mu);
execute_from_storage(&exec_ctx, s);
@@ -484,7 +484,7 @@ static void on_stream_ready(bidirectional_stream* stream) {
/* Free the memory allocated for headers */
if (s->header_array.headers) {
gpr_free(s->header_array.headers);
- s->header_array.headers = NULL;
+ s->header_array.headers = nullptr;
}
/* Send the initial metadata on wire if there is no SEND_MESSAGE or
* SEND_TRAILING_METADATA ops pending */
@@ -566,7 +566,7 @@ static void on_write_completed(bidirectional_stream* stream, const char* data) {
gpr_mu_lock(&s->mu);
if (s->state.ws.write_buffer) {
gpr_free(s->state.ws.write_buffer);
- s->state.ws.write_buffer = NULL;
+ s->state.ws.write_buffer = nullptr;
}
s->state.state_callback_received[OP_SEND_MESSAGE] = true;
gpr_mu_unlock(&s->mu);
@@ -713,7 +713,7 @@ static void convert_metadata_to_cronet_headers(
grpc_linked_mdelem* curr = head;
/* Walk the linked list and get number of header fields */
size_t num_headers_available = 0;
- while (curr != NULL) {
+ while (curr != nullptr) {
curr = curr->next;
num_headers_available++;
}
@@ -765,7 +765,7 @@ static void convert_metadata_to_cronet_headers(
headers[num_headers].key = key;
headers[num_headers].value = value;
num_headers++;
- if (curr == NULL) {
+ if (curr == nullptr) {
break;
}
}
@@ -785,7 +785,7 @@ static void parse_grpc_header(const uint8_t* data, int* length,
}
static bool header_has_authority(grpc_linked_mdelem* head) {
- while (head != NULL) {
+ while (head != nullptr) {
if (grpc_slice_eq(GRPC_MDKEY(head->md), GRPC_MDSTR_AUTHORITY)) {
return true;
}
@@ -993,7 +993,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx* exec_ctx,
CRONET_LOG(GPR_DEBUG, "running: %p OP_SEND_INITIAL_METADATA", oas);
/* Start new cronet stream. It is destroyed in on_succeeded, on_canceled,
* on_failed */
- GPR_ASSERT(s->cbs == NULL);
+ GPR_ASSERT(s->cbs == nullptr);
GPR_ASSERT(!stream_state->state_op_done[OP_SEND_INITIAL_METADATA]);
s->cbs =
bidirectional_stream_create(t->engine, s->curr_gs, &cronet_callbacks);
@@ -1002,9 +1002,9 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx* exec_ctx,
bidirectional_stream_disable_auto_flush(s->cbs, true);
bidirectional_stream_delay_request_headers_until_flush(s->cbs, true);
}
- char* url = NULL;
+ char* url = nullptr;
const char* method = "POST";
- s->header_array.headers = NULL;
+ s->header_array.headers = nullptr;
convert_metadata_to_cronet_headers(stream_op->payload->send_initial_metadata
.send_initial_metadata->list.head,
t->host, &url, &s->header_array.headers,
@@ -1042,7 +1042,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx* exec_ctx,
if (1 != grpc_byte_stream_next(
exec_ctx, stream_op->payload->send_message.send_message,
stream_op->payload->send_message.send_message->length,
- NULL)) {
+ nullptr)) {
/* Should never reach here */
GPR_ASSERT(false);
}
@@ -1358,10 +1358,10 @@ static int init_stream(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
s->refcount = refcount;
GRPC_CRONET_STREAM_REF(s, "cronet transport");
memset(&s->storage, 0, sizeof(s->storage));
- s->storage.head = NULL;
+ s->storage.head = nullptr;
memset(&s->state, 0, sizeof(s->state));
- s->curr_op = NULL;
- s->cbs = NULL;
+ s->curr_op = nullptr;
+ s->cbs = nullptr;
memset(&s->header_array, 0, sizeof(s->header_array));
memset(&s->state.rs, 0, sizeof(s->state.rs));
memset(&s->state.ws, 0, sizeof(s->state.ws));
@@ -1369,7 +1369,7 @@ static int init_stream(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
memset(s->state.state_callback_received, 0,
sizeof(s->state.state_callback_received));
s->state.fail_state = s->state.flush_read = false;
- s->state.cancel_error = NULL;
+ s->state.cancel_error = nullptr;
s->state.flush_cronet_when_ready = s->state.pending_write_for_trailer = false;
s->state.pending_send_message = false;
s->state.pending_recv_trailing_metadata = false;
@@ -1432,7 +1432,7 @@ static void destroy_transport(grpc_exec_ctx* exec_ctx, grpc_transport* gt) {}
static grpc_endpoint* get_endpoint(grpc_exec_ctx* exec_ctx,
grpc_transport* gt) {
- return NULL;
+ return nullptr;
}
static void perform_op(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
@@ -1491,5 +1491,5 @@ error:
gpr_free(ct);
}
- return NULL;
+ return nullptr;
}
diff --git a/src/core/ext/transport/inproc/inproc_transport.cc b/src/core/ext/transport/inproc/inproc_transport.cc
index a7a6db8bc2..7ea08b05bb 100644
--- a/src/core/ext/transport/inproc/inproc_transport.cc
+++ b/src/core/ext/transport/inproc/inproc_transport.cc
@@ -184,7 +184,7 @@ static void really_destroy_stream(grpc_exec_ctx* exec_ctx, inproc_stream* s) {
static void log_metadata(const grpc_metadata_batch* md_batch, bool is_client,
bool is_initial) {
- for (grpc_linked_mdelem* md = md_batch->list.head; md != NULL;
+ for (grpc_linked_mdelem* md = md_batch->list.head; md != nullptr;
md = md->next) {
char* key = grpc_slice_to_c_string(GRPC_MDKEY(md->md));
char* value = grpc_slice_to_c_string(GRPC_MDVALUE(md->md));
@@ -200,18 +200,18 @@ static grpc_error* fill_in_metadata(grpc_exec_ctx* exec_ctx, inproc_stream* s,
uint32_t flags, grpc_metadata_batch* out_md,
uint32_t* outflags, bool* markfilled) {
if (GRPC_TRACER_ON(grpc_inproc_trace)) {
- log_metadata(metadata, s->t->is_client, outflags != NULL);
+ log_metadata(metadata, s->t->is_client, outflags != nullptr);
}
- if (outflags != NULL) {
+ if (outflags != nullptr) {
*outflags = flags;
}
- if (markfilled != NULL) {
+ if (markfilled != nullptr) {
*markfilled = true;
}
grpc_error* error = GRPC_ERROR_NONE;
for (grpc_linked_mdelem* elem = metadata->list.head;
- (elem != NULL) && (error == GRPC_ERROR_NONE); elem = elem->next) {
+ (elem != nullptr) && (error == GRPC_ERROR_NONE); elem = elem->next) {
grpc_linked_mdelem* nelem =
(grpc_linked_mdelem*)gpr_arena_alloc(s->arena, sizeof(*nelem));
nelem->md = grpc_mdelem_from_slices(
@@ -250,7 +250,7 @@ static int init_stream(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
GRPC_CLOSURE_INIT(&s->op_closure, op_state_machine, s,
grpc_schedule_on_exec_ctx);
s->t = t;
- s->closure_at_destroy = NULL;
+ s->closure_at_destroy = nullptr;
s->other_side_closed = false;
s->initial_md_sent = s->trailing_md_sent = s->initial_md_recvd =
@@ -264,7 +264,7 @@ static int init_stream(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
s->deadline = GRPC_MILLIS_INF_FUTURE;
s->write_buffer_deadline = GRPC_MILLIS_INF_FUTURE;
- s->stream_list_prev = NULL;
+ s->stream_list_prev = nullptr;
gpr_mu_lock(&t->mu->mu);
s->listed = true;
ref_stream(s, "inproc_init_stream:list");
@@ -279,7 +279,7 @@ static int init_stream(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
ref_transport(t);
inproc_transport* st = t->other_side;
ref_transport(st);
- s->other_side = NULL; // will get filled in soon
+ s->other_side = nullptr; // will get filled in soon
// Pass the client-side stream address to the server-side for a ref
ref_stream(s, "inproc_init_stream:clt"); // ref it now on behalf of server
// side to avoid destruction
@@ -311,7 +311,7 @@ static int init_stream(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
}
if (cs->write_buffer_trailing_md_filled) {
fill_in_metadata(exec_ctx, s, &cs->write_buffer_trailing_md, 0,
- &s->to_read_trailing_md, NULL,
+ &s->to_read_trailing_md, nullptr,
&s->to_read_trailing_md_filled);
grpc_metadata_batch_clear(exec_ctx, &cs->write_buffer_trailing_md);
cs->write_buffer_trailing_md_filled = false;
@@ -335,12 +335,12 @@ static void close_stream_locked(grpc_exec_ctx* exec_ctx, inproc_stream* s) {
if (s->listed) {
inproc_stream* p = s->stream_list_prev;
inproc_stream* n = s->stream_list_next;
- if (p != NULL) {
+ if (p != nullptr) {
p->stream_list_next = n;
} else {
s->t->stream_list = n;
}
- if (n != NULL) {
+ if (n != nullptr) {
n->stream_list_prev = p;
}
s->listed = false;
@@ -354,14 +354,14 @@ static void close_stream_locked(grpc_exec_ctx* exec_ctx, inproc_stream* s) {
// This function means that we are done talking/listening to the other side
static void close_other_side_locked(grpc_exec_ctx* exec_ctx, inproc_stream* s,
const char* reason) {
- if (s->other_side != NULL) {
+ if (s->other_side != nullptr) {
// First release the metadata that came from the other side's arena
grpc_metadata_batch_destroy(exec_ctx, &s->to_read_initial_md);
grpc_metadata_batch_destroy(exec_ctx, &s->to_read_trailing_md);
unref_stream(exec_ctx, s->other_side, reason);
s->other_side_closed = true;
- s->other_side = NULL;
+ s->other_side = nullptr;
} else if (!s->other_side_closed) {
s->write_buffer_other_side_closed = true;
}
@@ -410,14 +410,15 @@ static void fail_helper_locked(grpc_exec_ctx* exec_ctx, inproc_stream* s,
grpc_metadata_batch_init(&fake_md);
inproc_stream* other = s->other_side;
- grpc_metadata_batch* dest = (other == NULL) ? &s->write_buffer_trailing_md
- : &other->to_read_trailing_md;
- bool* destfilled = (other == NULL) ? &s->write_buffer_trailing_md_filled
- : &other->to_read_trailing_md_filled;
- fill_in_metadata(exec_ctx, s, &fake_md, 0, dest, NULL, destfilled);
+ grpc_metadata_batch* dest = (other == nullptr)
+ ? &s->write_buffer_trailing_md
+ : &other->to_read_trailing_md;
+ bool* destfilled = (other == nullptr) ? &s->write_buffer_trailing_md_filled
+ : &other->to_read_trailing_md_filled;
+ fill_in_metadata(exec_ctx, s, &fake_md, 0, dest, nullptr, destfilled);
grpc_metadata_batch_destroy(exec_ctx, &fake_md);
- if (other != NULL) {
+ if (other != nullptr) {
if (other->cancel_other_error == GRPC_ERROR_NONE) {
other->cancel_other_error = GRPC_ERROR_REF(error);
}
@@ -451,7 +452,7 @@ static void fail_helper_locked(grpc_exec_ctx* exec_ctx, inproc_stream* s,
s->recv_initial_md_op->payload->recv_initial_metadata
.recv_initial_metadata,
s->recv_initial_md_op->payload->recv_initial_metadata.recv_flags,
- NULL);
+ nullptr);
grpc_metadata_batch_destroy(exec_ctx, &fake_md);
err = GRPC_ERROR_NONE;
} else {
@@ -469,7 +470,7 @@ static void fail_helper_locked(grpc_exec_ctx* exec_ctx, inproc_stream* s,
complete_if_batch_end_locked(
exec_ctx, s, error, s->recv_initial_md_op,
"fail_helper scheduling recv-initial-metadata-on-complete");
- s->recv_initial_md_op = NULL;
+ s->recv_initial_md_op = nullptr;
}
if (s->recv_message_op) {
INPROC_LOG(GPR_DEBUG, "fail_helper %p scheduling message-ready %p", s,
@@ -480,19 +481,19 @@ static void fail_helper_locked(grpc_exec_ctx* exec_ctx, inproc_stream* s,
complete_if_batch_end_locked(
exec_ctx, s, error, s->recv_message_op,
"fail_helper scheduling recv-message-on-complete");
- s->recv_message_op = NULL;
+ s->recv_message_op = nullptr;
}
if (s->send_message_op) {
complete_if_batch_end_locked(
exec_ctx, s, error, s->send_message_op,
"fail_helper scheduling send-message-on-complete");
- s->send_message_op = NULL;
+ s->send_message_op = nullptr;
}
if (s->send_trailing_md_op) {
complete_if_batch_end_locked(
exec_ctx, s, error, s->send_trailing_md_op,
"fail_helper scheduling send-trailng-md-on-complete");
- s->send_trailing_md_op = NULL;
+ s->send_trailing_md_op = nullptr;
}
if (s->recv_trailing_md_op) {
INPROC_LOG(GPR_DEBUG,
@@ -501,7 +502,7 @@ static void fail_helper_locked(grpc_exec_ctx* exec_ctx, inproc_stream* s,
complete_if_batch_end_locked(
exec_ctx, s, error, s->recv_trailing_md_op,
"fail_helper scheduling recv-trailing-metadata-on-complete");
- s->recv_trailing_md_op = NULL;
+ s->recv_trailing_md_op = nullptr;
}
close_other_side_locked(exec_ctx, s, "fail_helper:other_side");
close_stream_locked(exec_ctx, s);
@@ -554,8 +555,8 @@ static void message_transfer_locked(grpc_exec_ctx* exec_ctx,
exec_ctx, receiver, GRPC_ERROR_NONE, receiver->recv_message_op,
"message_transfer scheduling receiver on_complete");
- receiver->recv_message_op = NULL;
- sender->send_message_op = NULL;
+ receiver->recv_message_op = nullptr;
+ sender->send_message_op = nullptr;
}
static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
@@ -601,7 +602,7 @@ static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
complete_if_batch_end_locked(
exec_ctx, s, GRPC_ERROR_NONE, s->send_message_op,
"op_state_machine scheduling send-message-on-complete");
- s->send_message_op = NULL;
+ s->send_message_op = nullptr;
}
}
// Pause a send trailing metadata if there is still an outstanding
@@ -612,10 +613,11 @@ static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
(!s->send_message_op ||
(s->t->is_client &&
(s->trailing_md_recvd || s->to_read_trailing_md_filled)))) {
- grpc_metadata_batch* dest = (other == NULL) ? &s->write_buffer_trailing_md
- : &other->to_read_trailing_md;
- bool* destfilled = (other == NULL) ? &s->write_buffer_trailing_md_filled
- : &other->to_read_trailing_md_filled;
+ grpc_metadata_batch* dest = (other == nullptr)
+ ? &s->write_buffer_trailing_md
+ : &other->to_read_trailing_md;
+ bool* destfilled = (other == nullptr) ? &s->write_buffer_trailing_md_filled
+ : &other->to_read_trailing_md_filled;
if (*destfilled || s->trailing_md_sent) {
// The buffer is already in use; that's an error!
INPROC_LOG(GPR_DEBUG, "Extra trailing metadata %p", s);
@@ -627,7 +629,7 @@ static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
fill_in_metadata(exec_ctx, s,
s->send_trailing_md_op->payload->send_trailing_metadata
.send_trailing_metadata,
- 0, dest, NULL, destfilled);
+ 0, dest, nullptr, destfilled);
}
s->trailing_md_sent = true;
if (!s->t->is_client && s->trailing_md_recvd && s->recv_trailing_md_op) {
@@ -635,7 +637,7 @@ static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
"op_state_machine %p scheduling trailing-md-on-complete", s);
GRPC_CLOSURE_SCHED(exec_ctx, s->recv_trailing_md_op->on_complete,
GRPC_ERROR_NONE);
- s->recv_trailing_md_op = NULL;
+ s->recv_trailing_md_op = nullptr;
needs_close = true;
}
}
@@ -643,7 +645,7 @@ static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
complete_if_batch_end_locked(
exec_ctx, s, GRPC_ERROR_NONE, s->send_trailing_md_op,
"op_state_machine scheduling send-trailing-metadata-on-complete");
- s->send_trailing_md_op = NULL;
+ s->send_trailing_md_op = nullptr;
}
if (s->recv_initial_md_op) {
if (s->initial_md_recvd) {
@@ -665,7 +667,7 @@ static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
s->recv_initial_md_op->payload->recv_initial_metadata
.recv_initial_metadata,
s->recv_initial_md_op->payload->recv_initial_metadata.recv_flags,
- NULL);
+ nullptr);
s->recv_initial_md_op->payload->recv_initial_metadata
.recv_initial_metadata->deadline = s->deadline;
grpc_metadata_batch_clear(exec_ctx, &s->to_read_initial_md);
@@ -680,7 +682,7 @@ static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
complete_if_batch_end_locked(
exec_ctx, s, new_err, s->recv_initial_md_op,
"op_state_machine scheduling recv-initial-metadata-on-complete");
- s->recv_initial_md_op = NULL;
+ s->recv_initial_md_op = nullptr;
if (new_err != GRPC_ERROR_NONE) {
INPROC_LOG(GPR_DEBUG,
@@ -713,7 +715,7 @@ static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
fail_helper_locked(exec_ctx, s, GRPC_ERROR_REF(new_err));
goto done;
}
- if (s->recv_message_op != NULL) {
+ if (s->recv_message_op != nullptr) {
// This message needs to be wrapped up because it will never be
// satisfied
INPROC_LOG(GPR_DEBUG, "op_state_machine %p scheduling message-ready", s);
@@ -724,7 +726,7 @@ static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
complete_if_batch_end_locked(
exec_ctx, s, new_err, s->recv_message_op,
"op_state_machine scheduling recv-message-on-complete");
- s->recv_message_op = NULL;
+ s->recv_message_op = nullptr;
}
if ((s->trailing_md_sent || s->t->is_client) && s->send_message_op) {
// Nothing further will try to receive from this stream, so finish off
@@ -732,16 +734,16 @@ static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
complete_if_batch_end_locked(
exec_ctx, s, new_err, s->send_message_op,
"op_state_machine scheduling send-message-on-complete");
- s->send_message_op = NULL;
+ s->send_message_op = nullptr;
}
- if (s->recv_trailing_md_op != NULL) {
+ if (s->recv_trailing_md_op != nullptr) {
// We wanted trailing metadata and we got it
s->trailing_md_recvd = true;
new_err =
fill_in_metadata(exec_ctx, s, &s->to_read_trailing_md, 0,
s->recv_trailing_md_op->payload
->recv_trailing_metadata.recv_trailing_metadata,
- NULL, NULL);
+ nullptr, nullptr);
grpc_metadata_batch_clear(exec_ctx, &s->to_read_trailing_md);
s->to_read_trailing_md_filled = false;
@@ -756,7 +758,7 @@ static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
s, new_err);
GRPC_CLOSURE_SCHED(exec_ctx, s->recv_trailing_md_op->on_complete,
GRPC_ERROR_REF(new_err));
- s->recv_trailing_md_op = NULL;
+ s->recv_trailing_md_op = nullptr;
needs_close = true;
} else {
INPROC_LOG(GPR_DEBUG,
@@ -780,7 +782,7 @@ static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
complete_if_batch_end_locked(
exec_ctx, s, new_err, s->recv_message_op,
"op_state_machine scheduling recv-message-on-complete");
- s->recv_message_op = NULL;
+ s->recv_message_op = nullptr;
}
if (s->trailing_md_recvd && (s->trailing_md_sent || s->t->is_client) &&
s->send_message_op) {
@@ -789,7 +791,7 @@ static void op_state_machine(grpc_exec_ctx* exec_ctx, void* arg,
complete_if_batch_end_locked(
exec_ctx, s, new_err, s->send_message_op,
"op_state_machine scheduling send-message-on-complete");
- s->send_message_op = NULL;
+ s->send_message_op = nullptr;
}
if (s->send_message_op || s->send_trailing_md_op || s->recv_initial_md_op ||
s->recv_message_op || s->recv_trailing_md_op) {
@@ -827,14 +829,15 @@ static bool cancel_stream_locked(grpc_exec_ctx* exec_ctx, inproc_stream* s,
grpc_metadata_batch_init(&cancel_md);
inproc_stream* other = s->other_side;
- grpc_metadata_batch* dest = (other == NULL) ? &s->write_buffer_trailing_md
- : &other->to_read_trailing_md;
- bool* destfilled = (other == NULL) ? &s->write_buffer_trailing_md_filled
- : &other->to_read_trailing_md_filled;
- fill_in_metadata(exec_ctx, s, &cancel_md, 0, dest, NULL, destfilled);
+ grpc_metadata_batch* dest = (other == nullptr)
+ ? &s->write_buffer_trailing_md
+ : &other->to_read_trailing_md;
+ bool* destfilled = (other == nullptr) ? &s->write_buffer_trailing_md_filled
+ : &other->to_read_trailing_md_filled;
+ fill_in_metadata(exec_ctx, s, &cancel_md, 0, dest, nullptr, destfilled);
grpc_metadata_batch_destroy(exec_ctx, &cancel_md);
- if (other != NULL) {
+ if (other != nullptr) {
if (other->cancel_other_error == GRPC_ERROR_NONE) {
other->cancel_other_error = GRPC_ERROR_REF(s->cancel_self_error);
}
@@ -851,7 +854,7 @@ static bool cancel_stream_locked(grpc_exec_ctx* exec_ctx, inproc_stream* s,
complete_if_batch_end_locked(
exec_ctx, s, s->cancel_self_error, s->recv_trailing_md_op,
"cancel_stream scheduling trailing-md-on-complete");
- s->recv_trailing_md_op = NULL;
+ s->recv_trailing_md_op = nullptr;
}
}
@@ -882,7 +885,7 @@ static void perform_stream_op(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
}
grpc_error* error = GRPC_ERROR_NONE;
grpc_closure* on_complete = op->on_complete;
- if (on_complete == NULL) {
+ if (on_complete == nullptr) {
on_complete = &do_nothing_closure;
}
@@ -914,12 +917,14 @@ static void perform_stream_op(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Endpoint already shutdown");
}
if (error == GRPC_ERROR_NONE && op->send_initial_metadata) {
- grpc_metadata_batch* dest = (other == NULL) ? &s->write_buffer_initial_md
- : &other->to_read_initial_md;
- uint32_t* destflags = (other == NULL) ? &s->write_buffer_initial_md_flags
- : &other->to_read_initial_md_flags;
- bool* destfilled = (other == NULL) ? &s->write_buffer_initial_md_filled
- : &other->to_read_initial_md_filled;
+ grpc_metadata_batch* dest = (other == nullptr)
+ ? &s->write_buffer_initial_md
+ : &other->to_read_initial_md;
+ uint32_t* destflags = (other == nullptr)
+ ? &s->write_buffer_initial_md_flags
+ : &other->to_read_initial_md_flags;
+ bool* destfilled = (other == nullptr) ? &s->write_buffer_initial_md_filled
+ : &other->to_read_initial_md_filled;
if (*destfilled || s->initial_md_sent) {
// The buffer is already in use; that's an error!
INPROC_LOG(GPR_DEBUG, "Extra initial metadata %p", s);
@@ -934,7 +939,7 @@ static void perform_stream_op(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
}
if (s->t->is_client) {
grpc_millis* dl =
- (other == NULL) ? &s->write_buffer_deadline : &other->deadline;
+ (other == nullptr) ? &s->write_buffer_deadline : &other->deadline;
*dl = GPR_MIN(*dl, op->payload->send_initial_metadata
.send_initial_metadata->deadline);
s->initial_md_sent = true;
@@ -973,11 +978,11 @@ static void perform_stream_op(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
// 5. There is trailing metadata, even if nothing specifically wants
// that because that can shut down the receive message as well
if ((op->send_message && other &&
- ((other->recv_message_op != NULL) ||
- (other->recv_trailing_md_op != NULL))) ||
+ ((other->recv_message_op != nullptr) ||
+ (other->recv_trailing_md_op != nullptr))) ||
(op->send_trailing_metadata && !op->send_message) ||
(op->recv_initial_metadata && s->to_read_initial_md_filled) ||
- (op->recv_message && other && (other->send_message_op != NULL)) ||
+ (op->recv_message && other && (other->send_message_op != nullptr)) ||
(s->to_read_trailing_md_filled || s->trailing_md_recvd)) {
if (!s->op_closure_scheduled) {
GRPC_CLOSURE_SCHED(exec_ctx, &s->op_closure, GRPC_ERROR_NONE);
@@ -1031,7 +1036,7 @@ static void close_transport_locked(grpc_exec_ctx* exec_ctx,
if (!t->is_closed) {
t->is_closed = true;
/* Also end all streams on this transport */
- while (t->stream_list != NULL) {
+ while (t->stream_list != nullptr) {
// cancel_stream_locked also adjusts stream list
cancel_stream_locked(
exec_ctx, t->stream_list,
@@ -1110,7 +1115,7 @@ static void set_pollset_set(grpc_exec_ctx* exec_ctx, grpc_transport* gt,
}
static grpc_endpoint* get_endpoint(grpc_exec_ctx* exec_ctx, grpc_transport* t) {
- return NULL;
+ return nullptr;
}
/*******************************************************************************
@@ -1120,9 +1125,9 @@ static void do_nothing(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {}
void grpc_inproc_transport_init(void) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
- GRPC_CLOSURE_INIT(&do_nothing_closure, do_nothing, NULL,
+ GRPC_CLOSURE_INIT(&do_nothing_closure, do_nothing, nullptr,
grpc_schedule_on_exec_ctx);
- g_empty_slice = grpc_slice_from_static_buffer(NULL, 0);
+ g_empty_slice = grpc_slice_from_static_buffer(nullptr, 0);
grpc_slice key_tmp = grpc_slice_from_static_string(":path");
g_fake_path_key = grpc_slice_intern(key_tmp);
@@ -1173,8 +1178,8 @@ static void inproc_transports_create(grpc_exec_ctx* exec_ctx,
"inproc_client");
st->other_side = ct;
ct->other_side = st;
- st->stream_list = NULL;
- ct->stream_list = NULL;
+ st->stream_list = nullptr;
+ ct->stream_list = nullptr;
*server_transport = (grpc_transport*)st;
*client_transport = (grpc_transport*)ct;
}
@@ -1203,7 +1208,7 @@ grpc_channel* grpc_inproc_channel_create(grpc_server* server,
inproc_transports_create(&exec_ctx, &server_transport, server_args,
&client_transport, client_args);
- grpc_server_setup_transport(&exec_ctx, server, server_transport, NULL,
+ grpc_server_setup_transport(&exec_ctx, server, server_transport, nullptr,
server_args);
grpc_channel* channel =
grpc_channel_create(&exec_ctx, "inproc", client_args,