diff options
author | Noah Eisen <ncteisen@google.com> | 2017-11-13 16:44:02 -0800 |
---|---|---|
committer | Noah Eisen <ncteisen@google.com> | 2017-11-13 16:44:02 -0800 |
commit | 68bb1bf7480e87005220003985da19ea0a0929d0 (patch) | |
tree | c434576b07f94f427925dd7f7dfba4dbdeecee31 /test/core/iomgr | |
parent | 6bf73e8cf6d9d2ede844ab628a0b88000ffc9afa (diff) | |
parent | b0bad8f3864dc9c8745736fe68efe513b2b84932 (diff) |
Merge branch 'master' of https://github.com/grpc/grpc into tracing++
Diffstat (limited to 'test/core/iomgr')
-rw-r--r-- | test/core/iomgr/combiner_test.cc | 6 | ||||
-rw-r--r-- | test/core/iomgr/endpoint_tests.cc | 18 | ||||
-rw-r--r-- | test/core/iomgr/ev_epollsig_linux_test.cc | 10 | ||||
-rw-r--r-- | test/core/iomgr/fd_conservation_posix_test.cc | 2 | ||||
-rw-r--r-- | test/core/iomgr/fd_posix_test.cc | 45 | ||||
-rw-r--r-- | test/core/iomgr/load_file_test.cc | 24 | ||||
-rw-r--r-- | test/core/iomgr/pollset_set_test.cc | 8 | ||||
-rw-r--r-- | test/core/iomgr/resolve_address_posix_test.cc | 16 | ||||
-rw-r--r-- | test/core/iomgr/resolve_address_test.cc | 20 | ||||
-rw-r--r-- | test/core/iomgr/resource_quota_test.cc | 105 | ||||
-rw-r--r-- | test/core/iomgr/sockaddr_utils_test.cc | 12 | ||||
-rw-r--r-- | test/core/iomgr/tcp_client_posix_test.cc | 28 | ||||
-rw-r--r-- | test/core/iomgr/tcp_posix_test.cc | 24 | ||||
-rw-r--r-- | test/core/iomgr/tcp_server_posix_test.cc | 58 | ||||
-rw-r--r-- | test/core/iomgr/timer_heap_test.cc | 12 | ||||
-rw-r--r-- | test/core/iomgr/timer_list_test.cc | 10 | ||||
-rw-r--r-- | test/core/iomgr/udp_server_test.cc | 40 |
17 files changed, 221 insertions, 217 deletions
diff --git a/test/core/iomgr/combiner_test.cc b/test/core/iomgr/combiner_test.cc index 5a825368f7..146a6bd553 100644 --- a/test/core/iomgr/combiner_test.cc +++ b/test/core/iomgr/combiner_test.cc @@ -51,7 +51,7 @@ static void test_execute_one(void) { GRPC_ERROR_NONE); grpc_exec_ctx_flush(&exec_ctx); GPR_ASSERT(gpr_event_wait(&done, grpc_timeout_seconds_to_deadline(5)) != - NULL); + nullptr); GRPC_COMBINER_UNREF(&exec_ctx, lock, "test_execute_one"); grpc_exec_ctx_finish(&exec_ctx); } @@ -116,7 +116,7 @@ static void test_execute_many(void) { } for (size_t i = 0; i < GPR_ARRAY_SIZE(thds); i++) { GPR_ASSERT(gpr_event_wait(&ta[i].done, - gpr_inf_future(GPR_CLOCK_REALTIME)) != NULL); + gpr_inf_future(GPR_CLOCK_REALTIME)) != nullptr); gpr_thd_join(thds[i]); } grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; @@ -150,7 +150,7 @@ static void test_execute_finally(void) { GRPC_ERROR_NONE); grpc_exec_ctx_flush(&exec_ctx); GPR_ASSERT(gpr_event_wait(&got_in_finally, - grpc_timeout_seconds_to_deadline(5)) != NULL); + grpc_timeout_seconds_to_deadline(5)) != nullptr); GRPC_COMBINER_UNREF(&exec_ctx, lock, "test_execute_finally"); grpc_exec_ctx_finish(&exec_ctx); } diff --git a/test/core/iomgr/endpoint_tests.cc b/test/core/iomgr/endpoint_tests.cc index 8e859ba909..026e34105d 100644 --- a/test/core/iomgr/endpoint_tests.cc +++ b/test/core/iomgr/endpoint_tests.cc @@ -127,7 +127,7 @@ static void read_and_write_test_read_handler(grpc_exec_ctx* exec_ctx, gpr_mu_lock(g_mu); state->read_done = 1 + (error == GRPC_ERROR_NONE); GRPC_LOG_IF_ERROR("pollset_kick", - grpc_pollset_kick(exec_ctx, g_pollset, NULL)); + grpc_pollset_kick(exec_ctx, g_pollset, nullptr)); gpr_mu_unlock(g_mu); } else if (error == GRPC_ERROR_NONE) { grpc_endpoint_read(exec_ctx, state->read_ep, &state->incoming, @@ -139,7 +139,7 @@ static void read_and_write_test_write_handler(grpc_exec_ctx* exec_ctx, void* data, grpc_error* error) { struct read_and_write_test_state* state = (struct read_and_write_test_state*)data; - grpc_slice* slices = NULL; + grpc_slice* slices = nullptr; size_t nslices; if (error == GRPC_ERROR_NONE) { @@ -164,7 +164,7 @@ static void read_and_write_test_write_handler(grpc_exec_ctx* exec_ctx, gpr_mu_lock(g_mu); state->write_done = 1 + (error == GRPC_ERROR_NONE); GRPC_LOG_IF_ERROR("pollset_kick", - grpc_pollset_kick(exec_ctx, g_pollset, NULL)); + grpc_pollset_kick(exec_ctx, g_pollset, nullptr)); gpr_mu_unlock(g_mu); } @@ -237,7 +237,7 @@ static void read_and_write_test(grpc_endpoint_test_config config, gpr_mu_lock(g_mu); while (!state.read_done || !state.write_done) { - grpc_pollset_worker* worker = NULL; + grpc_pollset_worker* worker = nullptr; GPR_ASSERT(grpc_exec_ctx_now(&exec_ctx) < deadline); GPR_ASSERT(GRPC_LOG_IF_ERROR( "pollset_work", @@ -258,8 +258,8 @@ static void inc_on_failure(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) { gpr_mu_lock(g_mu); *(int*)arg += (error != GRPC_ERROR_NONE); - GPR_ASSERT( - GRPC_LOG_IF_ERROR("kick", grpc_pollset_kick(exec_ctx, g_pollset, NULL))); + GPR_ASSERT(GRPC_LOG_IF_ERROR( + "kick", grpc_pollset_kick(exec_ctx, g_pollset, nullptr))); gpr_mu_unlock(g_mu); } @@ -271,7 +271,7 @@ static void wait_for_fail_count(grpc_exec_ctx* exec_ctx, int* fail_count, grpc_timespec_to_millis_round_up(grpc_timeout_seconds_to_deadline(10)); while (grpc_exec_ctx_now(exec_ctx) < deadline && *fail_count < want_fail_count) { - grpc_pollset_worker* worker = NULL; + grpc_pollset_worker* worker = nullptr; GPR_ASSERT(GRPC_LOG_IF_ERROR( "pollset_work", grpc_pollset_work(exec_ctx, g_pollset, &worker, deadline))); @@ -332,6 +332,6 @@ void grpc_endpoint_tests(grpc_endpoint_test_config config, for (i = 1; i < 1000; i = GPR_MAX(i + 1, i * 5 / 4)) { read_and_write_test(config, 40320, i, i, false); } - g_pollset = NULL; - g_mu = NULL; + g_pollset = nullptr; + g_mu = nullptr; } diff --git a/test/core/iomgr/ev_epollsig_linux_test.cc b/test/core/iomgr/ev_epollsig_linux_test.cc index 3ee607d97e..ac8b2f43d1 100644 --- a/test/core/iomgr/ev_epollsig_linux_test.cc +++ b/test/core/iomgr/ev_epollsig_linux_test.cc @@ -80,7 +80,7 @@ static void test_fd_cleanup(grpc_exec_ctx* exec_ctx, test_fd* tfds, GRPC_ERROR_CREATE_FROM_STATIC_STRING("test_fd_cleanup")); grpc_exec_ctx_flush(exec_ctx); - grpc_fd_orphan(exec_ctx, tfds[i].fd, NULL, &release_fd, + grpc_fd_orphan(exec_ctx, tfds[i].fd, nullptr, &release_fd, false /* already_closed */, "test_fd_cleanup"); grpc_exec_ctx_flush(exec_ctx); @@ -137,7 +137,7 @@ static void test_add_fd_to_pollset() { test_fd tfds[NUM_FDS]; int fds[NUM_FDS]; test_pollset pollsets[NUM_POLLSETS]; - void* expected_pi = NULL; + void* expected_pi = nullptr; int i; test_fd_init(tfds, fds, NUM_FDS); @@ -295,7 +295,7 @@ static void test_threading(void) { { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_fd_shutdown(&exec_ctx, shared.wakeup_desc, GRPC_ERROR_CANCELLED); - grpc_fd_orphan(&exec_ctx, shared.wakeup_desc, NULL, NULL, + grpc_fd_orphan(&exec_ctx, shared.wakeup_desc, nullptr, nullptr, false /* already_closed */, "done"); grpc_pollset_shutdown(&exec_ctx, shared.pollset, GRPC_CLOSURE_CREATE(destroy_pollset, shared.pollset, @@ -306,13 +306,13 @@ static void test_threading(void) { } int main(int argc, char** argv) { - const char* poll_strategy = NULL; + const char* poll_strategy = nullptr; grpc_test_init(argc, argv); grpc_init(); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; poll_strategy = grpc_get_poll_strategy_name(); - if (poll_strategy != NULL && strcmp(poll_strategy, "epollsig") == 0) { + if (poll_strategy != nullptr && strcmp(poll_strategy, "epollsig") == 0) { test_add_fd_to_pollset(); test_threading(); } else { diff --git a/test/core/iomgr/fd_conservation_posix_test.cc b/test/core/iomgr/fd_conservation_posix_test.cc index b76c247fb8..f46430c611 100644 --- a/test/core/iomgr/fd_conservation_posix_test.cc +++ b/test/core/iomgr/fd_conservation_posix_test.cc @@ -42,7 +42,7 @@ int main(int argc, char** argv) { grpc_resource_quota_create("fd_conservation_posix_test"); for (i = 0; i < 100; i++) { - p = grpc_iomgr_create_endpoint_pair("test", NULL); + p = grpc_iomgr_create_endpoint_pair("test", nullptr); grpc_endpoint_destroy(&exec_ctx, p.client); grpc_endpoint_destroy(&exec_ctx, p.server); grpc_exec_ctx_flush(&exec_ctx); diff --git a/test/core/iomgr/fd_posix_test.cc b/test/core/iomgr/fd_posix_test.cc index c70187ce91..a03d841ecd 100644 --- a/test/core/iomgr/fd_posix_test.cc +++ b/test/core/iomgr/fd_posix_test.cc @@ -115,8 +115,8 @@ static void session_shutdown_cb(grpc_exec_ctx* exec_ctx, void* arg, /*session */ bool success) { session* se = static_cast<session*>(arg); server* sv = se->sv; - grpc_fd_orphan(exec_ctx, se->em_fd, NULL, NULL, false /* already_closed */, - "a"); + grpc_fd_orphan(exec_ctx, se->em_fd, nullptr, nullptr, + false /* already_closed */, "a"); gpr_free(se); /* Start to shutdown listen fd. */ grpc_fd_shutdown(exec_ctx, sv->em_fd, @@ -173,13 +173,13 @@ static void listen_shutdown_cb(grpc_exec_ctx* exec_ctx, void* arg /*server */, int success) { server* sv = static_cast<server*>(arg); - grpc_fd_orphan(exec_ctx, sv->em_fd, NULL, NULL, false /* already_closed */, - "b"); + grpc_fd_orphan(exec_ctx, sv->em_fd, nullptr, nullptr, + false /* already_closed */, "b"); gpr_mu_lock(g_mu); sv->done = 1; - GPR_ASSERT(GRPC_LOG_IF_ERROR("pollset_kick", - grpc_pollset_kick(exec_ctx, g_pollset, NULL))); + GPR_ASSERT(GRPC_LOG_IF_ERROR( + "pollset_kick", grpc_pollset_kick(exec_ctx, g_pollset, nullptr))); gpr_mu_unlock(g_mu); } @@ -250,7 +250,7 @@ static void server_wait_and_shutdown(server* sv) { gpr_mu_lock(g_mu); while (!sv->done) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_pollset_worker* worker = NULL; + grpc_pollset_worker* worker = nullptr; GPR_ASSERT(GRPC_LOG_IF_ERROR( "pollset_work", grpc_pollset_work(&exec_ctx, g_pollset, &worker, GRPC_MILLIS_INF_FUTURE))); @@ -292,11 +292,11 @@ static void client_init(client* cl) { static void client_session_shutdown_cb(grpc_exec_ctx* exec_ctx, void* arg /*client */, int success) { client* cl = static_cast<client*>(arg); - grpc_fd_orphan(exec_ctx, cl->em_fd, NULL, NULL, false /* already_closed */, - "c"); + grpc_fd_orphan(exec_ctx, cl->em_fd, nullptr, nullptr, + false /* already_closed */, "c"); cl->done = 1; - GPR_ASSERT(GRPC_LOG_IF_ERROR("pollset_kick", - grpc_pollset_kick(exec_ctx, g_pollset, NULL))); + GPR_ASSERT(GRPC_LOG_IF_ERROR( + "pollset_kick", grpc_pollset_kick(exec_ctx, g_pollset, nullptr))); } /* Write as much as possible, then register notify_on_write. */ @@ -366,7 +366,7 @@ static void client_start(grpc_exec_ctx* exec_ctx, client* cl, int port) { static void client_wait_and_shutdown(client* cl) { gpr_mu_lock(g_mu); while (!cl->done) { - grpc_pollset_worker* worker = NULL; + grpc_pollset_worker* worker = nullptr; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; GPR_ASSERT(GRPC_LOG_IF_ERROR( "pollset_work", grpc_pollset_work(&exec_ctx, g_pollset, &worker, @@ -402,7 +402,7 @@ typedef struct fd_change_data { grpc_iomgr_cb_func cb_that_ran; } fd_change_data; -void init_change_data(fd_change_data* fdc) { fdc->cb_that_ran = NULL; } +void init_change_data(fd_change_data* fdc) { fdc->cb_that_ran = nullptr; } void destroy_change_data(fd_change_data* fdc) {} @@ -413,8 +413,8 @@ static void first_read_callback(grpc_exec_ctx* exec_ctx, gpr_mu_lock(g_mu); fdc->cb_that_ran = first_read_callback; - GPR_ASSERT(GRPC_LOG_IF_ERROR("pollset_kick", - grpc_pollset_kick(exec_ctx, g_pollset, NULL))); + GPR_ASSERT(GRPC_LOG_IF_ERROR( + "pollset_kick", grpc_pollset_kick(exec_ctx, g_pollset, nullptr))); gpr_mu_unlock(g_mu); } @@ -425,8 +425,8 @@ static void second_read_callback(grpc_exec_ctx* exec_ctx, gpr_mu_lock(g_mu); fdc->cb_that_ran = second_read_callback; - GPR_ASSERT(GRPC_LOG_IF_ERROR("pollset_kick", - grpc_pollset_kick(exec_ctx, g_pollset, NULL))); + GPR_ASSERT(GRPC_LOG_IF_ERROR( + "pollset_kick", grpc_pollset_kick(exec_ctx, g_pollset, nullptr))); gpr_mu_unlock(g_mu); } @@ -470,8 +470,8 @@ static void test_grpc_fd_change(void) { /* And now wait for it to run. */ gpr_mu_lock(g_mu); - while (a.cb_that_ran == NULL) { - grpc_pollset_worker* worker = NULL; + while (a.cb_that_ran == nullptr) { + grpc_pollset_worker* worker = nullptr; GPR_ASSERT(GRPC_LOG_IF_ERROR( "pollset_work", grpc_pollset_work(&exec_ctx, g_pollset, &worker, GRPC_MILLIS_INF_FUTURE))); @@ -494,8 +494,8 @@ static void test_grpc_fd_change(void) { GPR_ASSERT(result == 1); gpr_mu_lock(g_mu); - while (b.cb_that_ran == NULL) { - grpc_pollset_worker* worker = NULL; + while (b.cb_that_ran == nullptr) { + grpc_pollset_worker* worker = nullptr; GPR_ASSERT(GRPC_LOG_IF_ERROR( "pollset_work", grpc_pollset_work(&exec_ctx, g_pollset, &worker, GRPC_MILLIS_INF_FUTURE))); @@ -507,7 +507,8 @@ static void test_grpc_fd_change(void) { GPR_ASSERT(b.cb_that_ran == second_read_callback); gpr_mu_unlock(g_mu); - grpc_fd_orphan(&exec_ctx, em_fd, NULL, NULL, false /* already_closed */, "d"); + grpc_fd_orphan(&exec_ctx, em_fd, nullptr, nullptr, false /* already_closed */, + "d"); grpc_exec_ctx_finish(&exec_ctx); destroy_change_data(&a); destroy_change_data(&b); diff --git a/test/core/iomgr/load_file_test.cc b/test/core/iomgr/load_file_test.cc index 2c9e7c33f4..9f360badcc 100644 --- a/test/core/iomgr/load_file_test.cc +++ b/test/core/iomgr/load_file_test.cc @@ -33,7 +33,7 @@ static const char prefix[] = "file_test"; static void test_load_empty_file(void) { - FILE* tmp = NULL; + FILE* tmp = nullptr; grpc_slice slice; grpc_slice slice_with_null_term; grpc_error* error; @@ -42,8 +42,8 @@ static void test_load_empty_file(void) { LOG_TEST_NAME("test_load_empty_file"); tmp = gpr_tmpfile(prefix, &tmp_name); - GPR_ASSERT(tmp_name != NULL); - GPR_ASSERT(tmp != NULL); + GPR_ASSERT(tmp_name != nullptr); + GPR_ASSERT(tmp != nullptr); fclose(tmp); error = grpc_load_file(tmp_name, 0, &slice); @@ -62,7 +62,7 @@ static void test_load_empty_file(void) { } static void test_load_failure(void) { - FILE* tmp = NULL; + FILE* tmp = nullptr; grpc_slice slice; grpc_error* error; char* tmp_name; @@ -70,8 +70,8 @@ static void test_load_failure(void) { LOG_TEST_NAME("test_load_failure"); tmp = gpr_tmpfile(prefix, &tmp_name); - GPR_ASSERT(tmp_name != NULL); - GPR_ASSERT(tmp != NULL); + GPR_ASSERT(tmp_name != nullptr); + GPR_ASSERT(tmp != nullptr); fclose(tmp); remove(tmp_name); @@ -84,7 +84,7 @@ static void test_load_failure(void) { } static void test_load_small_file(void) { - FILE* tmp = NULL; + FILE* tmp = nullptr; grpc_slice slice; grpc_slice slice_with_null_term; grpc_error* error; @@ -94,8 +94,8 @@ static void test_load_small_file(void) { LOG_TEST_NAME("test_load_small_file"); tmp = gpr_tmpfile(prefix, &tmp_name); - GPR_ASSERT(tmp_name != NULL); - GPR_ASSERT(tmp != NULL); + GPR_ASSERT(tmp_name != nullptr); + GPR_ASSERT(tmp != nullptr); GPR_ASSERT(fwrite(blah, 1, strlen(blah), tmp) == strlen(blah)); fclose(tmp); @@ -117,7 +117,7 @@ static void test_load_small_file(void) { } static void test_load_big_file(void) { - FILE* tmp = NULL; + FILE* tmp = nullptr; grpc_slice slice; grpc_error* error; char* tmp_name; @@ -131,8 +131,8 @@ static void test_load_big_file(void) { memset(buffer, 42, buffer_size); tmp = gpr_tmpfile(prefix, &tmp_name); - GPR_ASSERT(tmp != NULL); - GPR_ASSERT(tmp_name != NULL); + GPR_ASSERT(tmp != nullptr); + GPR_ASSERT(tmp_name != nullptr); GPR_ASSERT(fwrite(buffer, 1, buffer_size, tmp) == buffer_size); fclose(tmp); diff --git a/test/core/iomgr/pollset_set_test.cc b/test/core/iomgr/pollset_set_test.cc index 8d0198cace..719eab91fe 100644 --- a/test/core/iomgr/pollset_set_test.cc +++ b/test/core/iomgr/pollset_set_test.cc @@ -52,7 +52,7 @@ void cleanup_test_pollset_sets(grpc_exec_ctx* exec_ctx, const int num_pss) { for (int i = 0; i < num_pss; i++) { grpc_pollset_set_destroy(exec_ctx, pollset_sets[i].pss); - pollset_sets[i].pss = NULL; + pollset_sets[i].pss = nullptr; } } @@ -89,7 +89,7 @@ static void cleanup_test_pollsets(grpc_exec_ctx* exec_ctx, grpc_exec_ctx_flush(exec_ctx); gpr_free(pollsets[i].ps); - pollsets[i].ps = NULL; + pollsets[i].ps = nullptr; } } @@ -141,7 +141,7 @@ static void cleanup_test_fds(grpc_exec_ctx* exec_ctx, test_fd* tfds, * grpc_wakeup_fd and we would like to destroy it ourselves (by calling * grpc_wakeup_fd_destroy). To prevent grpc_fd from calling close() on the * underlying fd, call it with a non-NULL 'release_fd' parameter */ - grpc_fd_orphan(exec_ctx, tfds[i].fd, NULL, &release_fd, + grpc_fd_orphan(exec_ctx, tfds[i].fd, nullptr, &release_fd, false /* already_closed */, "test_fd_cleanup"); grpc_exec_ctx_flush(exec_ctx); @@ -439,7 +439,7 @@ int main(int argc, char** argv) { grpc_init(); const char* poll_strategy = grpc_get_poll_strategy_name(); - if (poll_strategy != NULL && + if (poll_strategy != nullptr && (strcmp(poll_strategy, "epollsig") == 0 || strcmp(poll_strategy, "epoll-threadpool") == 0)) { pollset_set_test_basic(); diff --git a/test/core/iomgr/resolve_address_posix_test.cc b/test/core/iomgr/resolve_address_posix_test.cc index ba89fc8ad5..1a5eb9ace1 100644 --- a/test/core/iomgr/resolve_address_posix_test.cc +++ b/test/core/iomgr/resolve_address_posix_test.cc @@ -54,7 +54,7 @@ void args_init(grpc_exec_ctx* exec_ctx, args_struct* args) { grpc_pollset_init(args->pollset, &args->mu); args->pollset_set = grpc_pollset_set_create(); grpc_pollset_set_add_pollset(exec_ctx, args->pollset_set, args->pollset); - args->addrs = NULL; + args->addrs = nullptr; } void args_finish(grpc_exec_ctx* exec_ctx, args_struct* args) { @@ -63,7 +63,7 @@ void args_finish(grpc_exec_ctx* exec_ctx, args_struct* args) { grpc_pollset_set_del_pollset(exec_ctx, args->pollset_set, args->pollset); grpc_pollset_set_destroy(exec_ctx, args->pollset_set); grpc_closure do_nothing_cb; - GRPC_CLOSURE_INIT(&do_nothing_cb, do_nothing, NULL, + GRPC_CLOSURE_INIT(&do_nothing_cb, do_nothing, nullptr, grpc_schedule_on_exec_ctx); grpc_pollset_shutdown(exec_ctx, args->pollset, &do_nothing_cb); // exec_ctx needs to be flushed before calling grpc_pollset_destroy() @@ -89,7 +89,7 @@ static void actually_poll(void* argsp) { grpc_millis time_left = deadline - grpc_exec_ctx_now(&exec_ctx); gpr_log(GPR_DEBUG, "done=%d, time_left=%" PRIdPTR, done, time_left); GPR_ASSERT(time_left >= 0); - grpc_pollset_worker* worker = NULL; + grpc_pollset_worker* worker = nullptr; gpr_mu_lock(args->mu); GRPC_LOG_IF_ERROR("pollset_work", grpc_pollset_work(&exec_ctx, args->pollset, &worker, @@ -104,14 +104,14 @@ static void actually_poll(void* argsp) { static void poll_pollset_until_request_done(args_struct* args) { gpr_atm_rel_store(&args->done_atm, 0); gpr_thd_id id; - gpr_thd_new(&id, actually_poll, args, NULL); + gpr_thd_new(&id, actually_poll, args, nullptr); } static void must_succeed(grpc_exec_ctx* exec_ctx, void* argsp, grpc_error* err) { args_struct* args = static_cast<args_struct*>(argsp); GPR_ASSERT(err == GRPC_ERROR_NONE); - GPR_ASSERT(args->addrs != NULL); + GPR_ASSERT(args->addrs != nullptr); GPR_ASSERT(args->addrs->naddrs > 0); gpr_atm_rel_store(&args->done_atm, 1); } @@ -128,7 +128,7 @@ static void test_unix_socket(void) { args_init(&exec_ctx, &args); poll_pollset_until_request_done(&args); grpc_resolve_address( - &exec_ctx, "unix:/path/name", NULL, args.pollset_set, + &exec_ctx, "unix:/path/name", nullptr, args.pollset_set, GRPC_CLOSURE_CREATE(must_succeed, &args, grpc_schedule_on_exec_ctx), &args.addrs); args_finish(&exec_ctx, &args); @@ -141,7 +141,7 @@ static void test_unix_socket_path_name_too_long(void) { args_init(&exec_ctx, &args); const char prefix[] = "unix:/path/name"; size_t path_name_length = - GPR_ARRAY_SIZE(((struct sockaddr_un*)0)->sun_path) + 6; + GPR_ARRAY_SIZE(((struct sockaddr_un*)nullptr)->sun_path) + 6; char* path_name = static_cast<char*>(gpr_malloc(sizeof(char) * path_name_length)); memset(path_name, 'a', path_name_length); @@ -150,7 +150,7 @@ static void test_unix_socket_path_name_too_long(void) { poll_pollset_until_request_done(&args); grpc_resolve_address( - &exec_ctx, path_name, NULL, args.pollset_set, + &exec_ctx, path_name, nullptr, args.pollset_set, GRPC_CLOSURE_CREATE(must_fail, &args, grpc_schedule_on_exec_ctx), &args.addrs); gpr_free(path_name); diff --git a/test/core/iomgr/resolve_address_test.cc b/test/core/iomgr/resolve_address_test.cc index 0aa3e5f0f0..1c5aa38a95 100644 --- a/test/core/iomgr/resolve_address_test.cc +++ b/test/core/iomgr/resolve_address_test.cc @@ -47,7 +47,7 @@ void args_init(grpc_exec_ctx* exec_ctx, args_struct* args) { grpc_pollset_init(args->pollset, &args->mu); args->pollset_set = grpc_pollset_set_create(); grpc_pollset_set_add_pollset(exec_ctx, args->pollset_set, args->pollset); - args->addrs = NULL; + args->addrs = nullptr; gpr_atm_rel_store(&args->done_atm, 0); } @@ -57,7 +57,7 @@ void args_finish(grpc_exec_ctx* exec_ctx, args_struct* args) { grpc_pollset_set_del_pollset(exec_ctx, args->pollset_set, args->pollset); grpc_pollset_set_destroy(exec_ctx, args->pollset_set); grpc_closure do_nothing_cb; - GRPC_CLOSURE_INIT(&do_nothing_cb, do_nothing, NULL, + GRPC_CLOSURE_INIT(&do_nothing_cb, do_nothing, nullptr, grpc_schedule_on_exec_ctx); gpr_mu_lock(args->mu); grpc_pollset_shutdown(exec_ctx, args->pollset, &do_nothing_cb); @@ -84,7 +84,7 @@ static void poll_pollset_until_request_done(args_struct* args) { grpc_millis time_left = deadline - grpc_exec_ctx_now(&exec_ctx); gpr_log(GPR_DEBUG, "done=%d, time_left=%" PRIdPTR, done, time_left); GPR_ASSERT(time_left >= 0); - grpc_pollset_worker* worker = NULL; + grpc_pollset_worker* worker = nullptr; gpr_mu_lock(args->mu); GRPC_LOG_IF_ERROR("pollset_work", grpc_pollset_work(&exec_ctx, args->pollset, &worker, @@ -100,12 +100,12 @@ static void must_succeed(grpc_exec_ctx* exec_ctx, void* argsp, grpc_error* err) { args_struct* args = static_cast<args_struct*>(argsp); GPR_ASSERT(err == GRPC_ERROR_NONE); - GPR_ASSERT(args->addrs != NULL); + GPR_ASSERT(args->addrs != nullptr); GPR_ASSERT(args->addrs->naddrs > 0); gpr_atm_rel_store(&args->done_atm, 1); gpr_mu_lock(args->mu); GRPC_LOG_IF_ERROR("pollset_kick", - grpc_pollset_kick(exec_ctx, args->pollset, NULL)); + grpc_pollset_kick(exec_ctx, args->pollset, nullptr)); gpr_mu_unlock(args->mu); } @@ -115,7 +115,7 @@ static void must_fail(grpc_exec_ctx* exec_ctx, void* argsp, grpc_error* err) { gpr_atm_rel_store(&args->done_atm, 1); gpr_mu_lock(args->mu); GRPC_LOG_IF_ERROR("pollset_kick", - grpc_pollset_kick(exec_ctx, args->pollset, NULL)); + grpc_pollset_kick(exec_ctx, args->pollset, nullptr)); gpr_mu_unlock(args->mu); } @@ -124,7 +124,7 @@ static void test_localhost(void) { args_struct args; args_init(&exec_ctx, &args); grpc_resolve_address( - &exec_ctx, "localhost:1", NULL, args.pollset_set, + &exec_ctx, "localhost:1", nullptr, args.pollset_set, GRPC_CLOSURE_CREATE(must_succeed, &args, grpc_schedule_on_exec_ctx), &args.addrs); grpc_exec_ctx_flush(&exec_ctx); @@ -166,7 +166,7 @@ static void test_missing_default_port(void) { args_struct args; args_init(&exec_ctx, &args); grpc_resolve_address( - &exec_ctx, "localhost", NULL, args.pollset_set, + &exec_ctx, "localhost", nullptr, args.pollset_set, GRPC_CLOSURE_CREATE(must_fail, &args, grpc_schedule_on_exec_ctx), &args.addrs); grpc_exec_ctx_flush(&exec_ctx); @@ -180,7 +180,7 @@ static void test_ipv6_with_port(void) { args_struct args; args_init(&exec_ctx, &args); grpc_resolve_address( - &exec_ctx, "[2001:db8::1]:1", NULL, args.pollset_set, + &exec_ctx, "[2001:db8::1]:1", nullptr, args.pollset_set, GRPC_CLOSURE_CREATE(must_succeed, &args, grpc_schedule_on_exec_ctx), &args.addrs); grpc_exec_ctx_flush(&exec_ctx); @@ -222,7 +222,7 @@ static void test_invalid_ip_addresses(void) { args_struct args; args_init(&exec_ctx, &args); grpc_resolve_address( - &exec_ctx, kCases[i], NULL, args.pollset_set, + &exec_ctx, kCases[i], nullptr, args.pollset_set, GRPC_CLOSURE_CREATE(must_fail, &args, grpc_schedule_on_exec_ctx), &args.addrs); grpc_exec_ctx_flush(&exec_ctx); diff --git a/test/core/iomgr/resource_quota_test.cc b/test/core/iomgr/resource_quota_test.cc index 8a2faaed02..6851702e67 100644 --- a/test/core/iomgr/resource_quota_test.cc +++ b/test/core/iomgr/resource_quota_test.cc @@ -121,7 +121,7 @@ static void test_instant_alloc_then_free(void) { grpc_resource_user* usr = grpc_resource_user_create(q, "usr"); { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_alloc(&exec_ctx, usr, 1024, NULL); + grpc_resource_user_alloc(&exec_ctx, usr, 1024, nullptr); grpc_exec_ctx_finish(&exec_ctx); } { @@ -141,7 +141,7 @@ static void test_instant_alloc_free_pair(void) { grpc_resource_user* usr = grpc_resource_user_create(q, "usr"); { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_alloc(&exec_ctx, usr, 1024, NULL); + grpc_resource_user_alloc(&exec_ctx, usr, 1024, nullptr); grpc_resource_user_free(&exec_ctx, usr, 1024); grpc_exec_ctx_finish(&exec_ctx); } @@ -162,7 +162,7 @@ static void test_simple_async_alloc(void) { grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_event(&ev)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != - NULL); + nullptr); } { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; @@ -186,10 +186,11 @@ static void test_async_alloc_blocked_by_size(void) { grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_event(&ev)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(gpr_event_wait( - &ev, grpc_timeout_milliseconds_to_deadline(100)) == NULL); + &ev, grpc_timeout_milliseconds_to_deadline(100)) == nullptr); } grpc_resource_quota_resize(q, 1024); - GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != NULL); + GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != + nullptr); ; { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; @@ -213,7 +214,7 @@ static void test_scavenge(void) { grpc_resource_user_alloc(&exec_ctx, usr1, 1024, set_event(&ev)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != - NULL); + nullptr); ; } { @@ -228,7 +229,7 @@ static void test_scavenge(void) { grpc_resource_user_alloc(&exec_ctx, usr2, 1024, set_event(&ev)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != - NULL); + nullptr); ; } { @@ -254,7 +255,7 @@ static void test_scavenge_blocked(void) { grpc_resource_user_alloc(&exec_ctx, usr1, 1024, set_event(&ev)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != - NULL); + nullptr); ; } { @@ -263,14 +264,14 @@ static void test_scavenge_blocked(void) { grpc_resource_user_alloc(&exec_ctx, usr2, 1024, set_event(&ev)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(gpr_event_wait( - &ev, grpc_timeout_milliseconds_to_deadline(100)) == NULL); + &ev, grpc_timeout_milliseconds_to_deadline(100)) == nullptr); } { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_resource_user_free(&exec_ctx, usr1, 1024); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != - NULL); + nullptr); ; } { @@ -296,7 +297,7 @@ static void test_blocked_until_scheduled_reclaim(void) { grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_event(&ev)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != - NULL); + nullptr); ; } gpr_event reclaim_done; @@ -315,9 +316,9 @@ static void test_blocked_until_scheduled_reclaim(void) { grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_event(&ev)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(gpr_event_wait(&reclaim_done, - grpc_timeout_seconds_to_deadline(5)) != NULL); + grpc_timeout_seconds_to_deadline(5)) != nullptr); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != - NULL); + nullptr); ; } { @@ -343,7 +344,7 @@ static void test_blocked_until_scheduled_reclaim_and_scavenge(void) { grpc_resource_user_alloc(&exec_ctx, usr1, 1024, set_event(&ev)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != - NULL); + nullptr); ; } gpr_event reclaim_done; @@ -362,9 +363,9 @@ static void test_blocked_until_scheduled_reclaim_and_scavenge(void) { grpc_resource_user_alloc(&exec_ctx, usr2, 1024, set_event(&ev)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(gpr_event_wait(&reclaim_done, - grpc_timeout_seconds_to_deadline(5)) != NULL); + grpc_timeout_seconds_to_deadline(5)) != nullptr); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != - NULL); + nullptr); ; } { @@ -390,7 +391,7 @@ static void test_blocked_until_scheduled_destructive_reclaim(void) { grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_event(&ev)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != - NULL); + nullptr); ; } gpr_event reclaim_done; @@ -409,9 +410,9 @@ static void test_blocked_until_scheduled_destructive_reclaim(void) { grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_event(&ev)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(gpr_event_wait(&reclaim_done, - grpc_timeout_seconds_to_deadline(5)) != NULL); + grpc_timeout_seconds_to_deadline(5)) != nullptr); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != - NULL); + nullptr); ; } { @@ -443,17 +444,17 @@ static void test_unused_reclaim_is_cancelled(void) { grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(gpr_event_wait(&benign_done, grpc_timeout_milliseconds_to_deadline(100)) == - NULL); + nullptr); GPR_ASSERT(gpr_event_wait(&destructive_done, grpc_timeout_milliseconds_to_deadline(100)) == - NULL); + nullptr); } grpc_resource_quota_unref(q); destroy_user(usr); GPR_ASSERT(gpr_event_wait(&benign_done, - grpc_timeout_seconds_to_deadline(5)) != NULL); + grpc_timeout_seconds_to_deadline(5)) != nullptr); GPR_ASSERT(gpr_event_wait(&destructive_done, - grpc_timeout_seconds_to_deadline(5)) != NULL); + grpc_timeout_seconds_to_deadline(5)) != nullptr); } static void test_benign_reclaim_is_preferred(void) { @@ -473,7 +474,7 @@ static void test_benign_reclaim_is_preferred(void) { grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_event(&ev)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != - NULL); + nullptr); ; } { @@ -487,10 +488,10 @@ static void test_benign_reclaim_is_preferred(void) { grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(gpr_event_wait(&benign_done, grpc_timeout_milliseconds_to_deadline(100)) == - NULL); + nullptr); GPR_ASSERT(gpr_event_wait(&destructive_done, grpc_timeout_milliseconds_to_deadline(100)) == - NULL); + nullptr); } { gpr_event ev; @@ -499,12 +500,12 @@ static void test_benign_reclaim_is_preferred(void) { grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_event(&ev)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(gpr_event_wait(&benign_done, - grpc_timeout_seconds_to_deadline(5)) != NULL); + grpc_timeout_seconds_to_deadline(5)) != nullptr); GPR_ASSERT(gpr_event_wait(&destructive_done, grpc_timeout_milliseconds_to_deadline(100)) == - NULL); + nullptr); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != - NULL); + nullptr); } { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; @@ -514,9 +515,9 @@ static void test_benign_reclaim_is_preferred(void) { grpc_resource_quota_unref(q); destroy_user(usr); GPR_ASSERT(gpr_event_wait(&benign_done, - grpc_timeout_seconds_to_deadline(5)) != NULL); + grpc_timeout_seconds_to_deadline(5)) != nullptr); GPR_ASSERT(gpr_event_wait(&destructive_done, - grpc_timeout_seconds_to_deadline(5)) != NULL); + grpc_timeout_seconds_to_deadline(5)) != nullptr); } static void test_multiple_reclaims_can_be_triggered(void) { @@ -536,7 +537,7 @@ static void test_multiple_reclaims_can_be_triggered(void) { grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_event(&ev)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != - NULL); + nullptr); ; } { @@ -550,10 +551,10 @@ static void test_multiple_reclaims_can_be_triggered(void) { grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(gpr_event_wait(&benign_done, grpc_timeout_milliseconds_to_deadline(100)) == - NULL); + nullptr); GPR_ASSERT(gpr_event_wait(&destructive_done, grpc_timeout_milliseconds_to_deadline(100)) == - NULL); + nullptr); } { gpr_event ev; @@ -562,11 +563,11 @@ static void test_multiple_reclaims_can_be_triggered(void) { grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_event(&ev)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(gpr_event_wait(&benign_done, - grpc_timeout_seconds_to_deadline(5)) != NULL); + grpc_timeout_seconds_to_deadline(5)) != nullptr); GPR_ASSERT(gpr_event_wait(&destructive_done, - grpc_timeout_seconds_to_deadline(5)) != NULL); + grpc_timeout_seconds_to_deadline(5)) != nullptr); GPR_ASSERT(gpr_event_wait(&ev, grpc_timeout_seconds_to_deadline(5)) != - NULL); + nullptr); ; } { @@ -577,9 +578,9 @@ static void test_multiple_reclaims_can_be_triggered(void) { grpc_resource_quota_unref(q); destroy_user(usr); GPR_ASSERT(gpr_event_wait(&benign_done, - grpc_timeout_seconds_to_deadline(5)) != NULL); + grpc_timeout_seconds_to_deadline(5)) != nullptr); GPR_ASSERT(gpr_event_wait(&destructive_done, - grpc_timeout_seconds_to_deadline(5)) != NULL); + grpc_timeout_seconds_to_deadline(5)) != nullptr); } static void test_resource_user_stays_allocated_until_memory_released(void) { @@ -591,7 +592,7 @@ static void test_resource_user_stays_allocated_until_memory_released(void) { grpc_resource_user* usr = grpc_resource_user_create(q, "usr"); { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_resource_user_alloc(&exec_ctx, usr, 1024, NULL); + grpc_resource_user_alloc(&exec_ctx, usr, 1024, nullptr); grpc_exec_ctx_finish(&exec_ctx); } { @@ -630,7 +631,7 @@ test_resource_user_stays_allocated_and_reclaimers_unrun_until_memory_released( grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(gpr_event_wait(&reclaimer_cancelled, grpc_timeout_milliseconds_to_deadline(100)) == - NULL); + nullptr); } { gpr_event allocated; @@ -638,11 +639,11 @@ test_resource_user_stays_allocated_and_reclaimers_unrun_until_memory_released( grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_event(&allocated)); grpc_exec_ctx_finish(&exec_ctx); - GPR_ASSERT(gpr_event_wait(&allocated, - grpc_timeout_seconds_to_deadline(5)) != NULL); + GPR_ASSERT(gpr_event_wait(&allocated, grpc_timeout_seconds_to_deadline( + 5)) != nullptr); GPR_ASSERT(gpr_event_wait(&reclaimer_cancelled, grpc_timeout_milliseconds_to_deadline(100)) == - NULL); + nullptr); } { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; @@ -650,14 +651,15 @@ test_resource_user_stays_allocated_and_reclaimers_unrun_until_memory_released( grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(gpr_event_wait(&reclaimer_cancelled, grpc_timeout_milliseconds_to_deadline(100)) == - NULL); + nullptr); } { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_resource_user_free(&exec_ctx, usr, 1024); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(gpr_event_wait(&reclaimer_cancelled, - grpc_timeout_seconds_to_deadline(5)) != NULL); + grpc_timeout_seconds_to_deadline(5)) != + nullptr); } } grpc_resource_quota_unref(q); @@ -676,7 +678,7 @@ static void test_reclaimers_can_be_posted_repeatedly(void) { grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_event(&allocated)); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(gpr_event_wait(&allocated, - grpc_timeout_seconds_to_deadline(5)) != NULL); + grpc_timeout_seconds_to_deadline(5)) != nullptr); } for (int i = 0; i < 10; i++) { gpr_event reclaimer_done; @@ -689,7 +691,7 @@ static void test_reclaimers_can_be_posted_repeatedly(void) { grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(gpr_event_wait(&reclaimer_done, grpc_timeout_milliseconds_to_deadline(100)) == - NULL); + nullptr); } { gpr_event allocated; @@ -697,10 +699,11 @@ static void test_reclaimers_can_be_posted_repeatedly(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_resource_user_alloc(&exec_ctx, usr, 1024, set_event(&allocated)); grpc_exec_ctx_finish(&exec_ctx); - GPR_ASSERT(gpr_event_wait(&allocated, - grpc_timeout_seconds_to_deadline(5)) != NULL); + GPR_ASSERT(gpr_event_wait(&allocated, grpc_timeout_seconds_to_deadline( + 5)) != nullptr); GPR_ASSERT(gpr_event_wait(&reclaimer_done, - grpc_timeout_seconds_to_deadline(5)) != NULL); + grpc_timeout_seconds_to_deadline(5)) != + nullptr); } } { diff --git a/test/core/iomgr/sockaddr_utils_test.cc b/test/core/iomgr/sockaddr_utils_test.cc index 40f2157ba3..a445714851 100644 --- a/test/core/iomgr/sockaddr_utils_test.cc +++ b/test/core/iomgr/sockaddr_utils_test.cc @@ -81,21 +81,21 @@ static void test_sockaddr_is_v4mapped(void) { /* v4mapped input should succeed. */ input6 = make_addr6(kMapped, sizeof(kMapped)); - GPR_ASSERT(grpc_sockaddr_is_v4mapped(&input6, NULL)); + GPR_ASSERT(grpc_sockaddr_is_v4mapped(&input6, nullptr)); GPR_ASSERT(grpc_sockaddr_is_v4mapped(&input6, &output4)); expect4 = make_addr4(kIPv4, sizeof(kIPv4)); GPR_ASSERT(memcmp(&expect4, &output4, sizeof(expect4)) == 0); /* Non-v4mapped input should fail. */ input6 = make_addr6(kNotQuiteMapped, sizeof(kNotQuiteMapped)); - GPR_ASSERT(!grpc_sockaddr_is_v4mapped(&input6, NULL)); + GPR_ASSERT(!grpc_sockaddr_is_v4mapped(&input6, nullptr)); GPR_ASSERT(!grpc_sockaddr_is_v4mapped(&input6, &output4)); /* Output is unchanged. */ GPR_ASSERT(memcmp(&expect4, &output4, sizeof(expect4)) == 0); /* Plain IPv4 input should also fail. */ input4 = make_addr4(kIPv4, sizeof(kIPv4)); - GPR_ASSERT(!grpc_sockaddr_is_v4mapped(&input4, NULL)); + GPR_ASSERT(!grpc_sockaddr_is_v4mapped(&input4, nullptr)); } static void test_sockaddr_to_v4mapped(void) { @@ -176,7 +176,7 @@ static void expect_sockaddr_str(const char* expected, char* str; gpr_log(GPR_INFO, " expect_sockaddr_str(%s)", expected); result = grpc_sockaddr_to_string(&str, addr, normalize); - GPR_ASSERT(str != NULL); + GPR_ASSERT(str != nullptr); GPR_ASSERT(result >= 0); GPR_ASSERT((size_t)result == strlen(str)); GPR_ASSERT(strcmp(expected, str) == 0); @@ -188,7 +188,7 @@ static void expect_sockaddr_uri(const char* expected, char* str; gpr_log(GPR_INFO, " expect_sockaddr_uri(%s)", expected); str = grpc_sockaddr_to_uri(addr); - GPR_ASSERT(str != NULL); + GPR_ASSERT(str != nullptr); GPR_ASSERT(strcmp(expected, str) == 0); gpr_free(str); } @@ -238,7 +238,7 @@ static void test_sockaddr_to_string(void) { dummy_addr->sa_family = 123; expect_sockaddr_str("(sockaddr family=123)", &dummy, 0); expect_sockaddr_str("(sockaddr family=123)", &dummy, 1); - GPR_ASSERT(grpc_sockaddr_to_uri(&dummy) == NULL); + GPR_ASSERT(grpc_sockaddr_to_uri(&dummy) == nullptr); } static void test_sockaddr_set_get_port(void) { diff --git a/test/core/iomgr/tcp_client_posix_test.cc b/test/core/iomgr/tcp_client_posix_test.cc index 206fa5de01..9fb1a2d770 100644 --- a/test/core/iomgr/tcp_client_posix_test.cc +++ b/test/core/iomgr/tcp_client_posix_test.cc @@ -44,7 +44,7 @@ static grpc_pollset_set* g_pollset_set; static gpr_mu* g_mu; static grpc_pollset* g_pollset; static int g_connections_complete = 0; -static grpc_endpoint* g_connecting = NULL; +static grpc_endpoint* g_connecting = nullptr; static grpc_millis test_deadline(void) { return grpc_timespec_to_millis_round_up(grpc_timeout_seconds_to_deadline(10)); @@ -54,26 +54,26 @@ static void finish_connection() { gpr_mu_lock(g_mu); g_connections_complete++; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - GPR_ASSERT(GRPC_LOG_IF_ERROR("pollset_kick", - grpc_pollset_kick(&exec_ctx, g_pollset, NULL))); + GPR_ASSERT(GRPC_LOG_IF_ERROR( + "pollset_kick", grpc_pollset_kick(&exec_ctx, g_pollset, nullptr))); grpc_exec_ctx_finish(&exec_ctx); gpr_mu_unlock(g_mu); } static void must_succeed(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) { - GPR_ASSERT(g_connecting != NULL); + GPR_ASSERT(g_connecting != nullptr); GPR_ASSERT(error == GRPC_ERROR_NONE); grpc_endpoint_shutdown( exec_ctx, g_connecting, GRPC_ERROR_CREATE_FROM_STATIC_STRING("must_succeed called")); grpc_endpoint_destroy(exec_ctx, g_connecting); - g_connecting = NULL; + g_connecting = nullptr; finish_connection(); } static void must_fail(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) { - GPR_ASSERT(g_connecting == NULL); + GPR_ASSERT(g_connecting == nullptr); GPR_ASSERT(error != GRPC_ERROR_NONE); finish_connection(); } @@ -107,9 +107,9 @@ void test_succeeds(void) { /* connect to it */ GPR_ASSERT(getsockname(svr_fd, (struct sockaddr*)addr, (socklen_t*)&resolved_addr.len) == 0); - GRPC_CLOSURE_INIT(&done, must_succeed, NULL, grpc_schedule_on_exec_ctx); - grpc_tcp_client_connect(&exec_ctx, &done, &g_connecting, g_pollset_set, NULL, - &resolved_addr, GRPC_MILLIS_INF_FUTURE); + GRPC_CLOSURE_INIT(&done, must_succeed, nullptr, grpc_schedule_on_exec_ctx); + grpc_tcp_client_connect(&exec_ctx, &done, &g_connecting, g_pollset_set, + nullptr, &resolved_addr, GRPC_MILLIS_INF_FUTURE); /* await the connection */ do { @@ -122,7 +122,7 @@ void test_succeeds(void) { gpr_mu_lock(g_mu); while (g_connections_complete == connections_complete_before) { - grpc_pollset_worker* worker = NULL; + grpc_pollset_worker* worker = nullptr; GPR_ASSERT(GRPC_LOG_IF_ERROR( "pollset_work", grpc_pollset_work(&exec_ctx, g_pollset, &worker, @@ -156,15 +156,15 @@ void test_fails(void) { gpr_mu_unlock(g_mu); /* connect to a broken address */ - GRPC_CLOSURE_INIT(&done, must_fail, NULL, grpc_schedule_on_exec_ctx); - grpc_tcp_client_connect(&exec_ctx, &done, &g_connecting, g_pollset_set, NULL, - &resolved_addr, GRPC_MILLIS_INF_FUTURE); + GRPC_CLOSURE_INIT(&done, must_fail, nullptr, grpc_schedule_on_exec_ctx); + grpc_tcp_client_connect(&exec_ctx, &done, &g_connecting, g_pollset_set, + nullptr, &resolved_addr, GRPC_MILLIS_INF_FUTURE); gpr_mu_lock(g_mu); /* wait for the connection callback to finish */ while (g_connections_complete == connections_complete_before) { - grpc_pollset_worker* worker = NULL; + grpc_pollset_worker* worker = nullptr; grpc_millis polling_deadline = test_deadline(); switch (grpc_timer_check(&exec_ctx, &polling_deadline)) { case GRPC_TIMERS_FIRED: diff --git a/test/core/iomgr/tcp_posix_test.cc b/test/core/iomgr/tcp_posix_test.cc index 51ab0bfc6a..7986dc2b19 100644 --- a/test/core/iomgr/tcp_posix_test.cc +++ b/test/core/iomgr/tcp_posix_test.cc @@ -147,8 +147,8 @@ static void read_cb(grpc_exec_ctx* exec_ctx, void* user_data, gpr_log(GPR_INFO, "Read %" PRIuPTR " bytes of %" PRIuPTR, read_bytes, state->target_read_bytes); if (state->read_bytes >= state->target_read_bytes) { - GPR_ASSERT(GRPC_LOG_IF_ERROR("kick", - grpc_pollset_kick(exec_ctx, g_pollset, NULL))); + GPR_ASSERT(GRPC_LOG_IF_ERROR( + "kick", grpc_pollset_kick(exec_ctx, g_pollset, nullptr))); gpr_mu_unlock(g_mu); } else { grpc_endpoint_read(exec_ctx, state->ep, &state->incoming, &state->read_cb); @@ -192,7 +192,7 @@ static void read_test(size_t num_bytes, size_t slice_size) { gpr_mu_lock(g_mu); while (state.read_bytes < state.target_read_bytes) { - grpc_pollset_worker* worker = NULL; + grpc_pollset_worker* worker = nullptr; GPR_ASSERT(GRPC_LOG_IF_ERROR( "pollset_work", grpc_pollset_work(&exec_ctx, g_pollset, &worker, deadline))); @@ -245,7 +245,7 @@ static void large_read_test(size_t slice_size) { gpr_mu_lock(g_mu); while (state.read_bytes < state.target_read_bytes) { - grpc_pollset_worker* worker = NULL; + grpc_pollset_worker* worker = nullptr; GPR_ASSERT(GRPC_LOG_IF_ERROR( "pollset_work", grpc_pollset_work(&exec_ctx, g_pollset, &worker, deadline))); @@ -297,8 +297,8 @@ static void write_done(grpc_exec_ctx* exec_ctx, gpr_mu_lock(g_mu); gpr_log(GPR_INFO, "Signalling write done"); state->write_done = 1; - GPR_ASSERT(GRPC_LOG_IF_ERROR("pollset_kick", - grpc_pollset_kick(exec_ctx, g_pollset, NULL))); + GPR_ASSERT(GRPC_LOG_IF_ERROR( + "pollset_kick", grpc_pollset_kick(exec_ctx, g_pollset, nullptr))); gpr_mu_unlock(g_mu); } @@ -315,7 +315,7 @@ void drain_socket_blocking(int fd, size_t num_bytes, size_t read_size) { GPR_ASSERT(fcntl(fd, F_SETFL, flags & ~O_NONBLOCK) == 0); for (;;) { - grpc_pollset_worker* worker = NULL; + grpc_pollset_worker* worker = nullptr; gpr_mu_lock(g_mu); GPR_ASSERT(GRPC_LOG_IF_ERROR( "pollset_work", @@ -386,7 +386,7 @@ static void write_test(size_t num_bytes, size_t slice_size) { drain_socket_blocking(sv[0], num_bytes, num_bytes); gpr_mu_lock(g_mu); for (;;) { - grpc_pollset_worker* worker = NULL; + grpc_pollset_worker* worker = nullptr; if (state.write_done) { break; } @@ -408,8 +408,8 @@ static void write_test(size_t num_bytes, size_t slice_size) { void on_fd_released(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* errors) { int* done = (int*)arg; *done = 1; - GPR_ASSERT(GRPC_LOG_IF_ERROR("pollset_kick", - grpc_pollset_kick(exec_ctx, g_pollset, NULL))); + GPR_ASSERT(GRPC_LOG_IF_ERROR( + "pollset_kick", grpc_pollset_kick(exec_ctx, g_pollset, nullptr))); } /* Do a read_test, then release fd and try to read/write again. Verify that @@ -457,7 +457,7 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) { gpr_mu_lock(g_mu); while (state.read_bytes < state.target_read_bytes) { - grpc_pollset_worker* worker = NULL; + grpc_pollset_worker* worker = nullptr; GPR_ASSERT(GRPC_LOG_IF_ERROR( "pollset_work", grpc_pollset_work(&exec_ctx, g_pollset, &worker, deadline))); @@ -475,7 +475,7 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) { grpc_exec_ctx_flush(&exec_ctx); gpr_mu_lock(g_mu); while (!fd_released_done) { - grpc_pollset_worker* worker = NULL; + grpc_pollset_worker* worker = nullptr; GPR_ASSERT(GRPC_LOG_IF_ERROR( "pollset_work", grpc_pollset_work(&exec_ctx, g_pollset, &worker, deadline))); diff --git a/test/core/iomgr/tcp_server_posix_test.cc b/test/core/iomgr/tcp_server_posix_test.cc index 6efa74c706..48d8d425a5 100644 --- a/test/core/iomgr/tcp_server_posix_test.cc +++ b/test/core/iomgr/tcp_server_posix_test.cc @@ -78,7 +78,7 @@ typedef struct { test_addr addrs[MAX_ADDRS]; } test_addrs; -static on_connect_result g_result = {NULL, 0, 0, -1}; +static on_connect_result g_result = {nullptr, 0, 0, -1}; static char family_name_buf[1024]; static const char* sock_family_name(int family) { @@ -95,7 +95,7 @@ static const char* sock_family_name(int family) { } static void on_connect_result_init(on_connect_result* result) { - result->server = NULL; + result->server = nullptr; result->port_index = 0; result->fd_index = 0; result->server_fd = -1; @@ -113,11 +113,11 @@ static void on_connect_result_set(on_connect_result* result, static void server_weak_ref_shutdown(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) { server_weak_ref* weak_ref = static_cast<server_weak_ref*>(arg); - weak_ref->server = NULL; + weak_ref->server = nullptr; } static void server_weak_ref_init(server_weak_ref* weak_ref) { - weak_ref->server = NULL; + weak_ref->server = nullptr; GRPC_CLOSURE_INIT(&weak_ref->server_shutdown, server_weak_ref_shutdown, weak_ref, grpc_schedule_on_exec_ctx); } @@ -134,7 +134,7 @@ static void server_weak_ref_set(server_weak_ref* weak_ref, } static void test_addr_init_str(test_addr* addr) { - char* str = NULL; + char* str = nullptr; if (grpc_sockaddr_to_string(&str, &addr->addr, 0) != -1) { size_t str_len; memcpy(addr->str, str, (str_len = strnlen(str, sizeof(addr->str) - 1))); @@ -159,8 +159,8 @@ static void on_connect(grpc_exec_ctx* exec_ctx, void* arg, grpc_endpoint* tcp, gpr_mu_lock(g_mu); g_result = temp_result; g_nconnects++; - GPR_ASSERT(GRPC_LOG_IF_ERROR("pollset_kick", - grpc_pollset_kick(exec_ctx, g_pollset, NULL))); + GPR_ASSERT(GRPC_LOG_IF_ERROR( + "pollset_kick", grpc_pollset_kick(exec_ctx, g_pollset, nullptr))); gpr_mu_unlock(g_mu); } @@ -168,7 +168,7 @@ static void test_no_op(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_tcp_server* s; GPR_ASSERT(GRPC_ERROR_NONE == - grpc_tcp_server_create(&exec_ctx, NULL, NULL, &s)); + grpc_tcp_server_create(&exec_ctx, nullptr, nullptr, &s)); grpc_tcp_server_unref(&exec_ctx, s); grpc_exec_ctx_finish(&exec_ctx); } @@ -177,9 +177,9 @@ static void test_no_op_with_start(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_tcp_server* s; GPR_ASSERT(GRPC_ERROR_NONE == - grpc_tcp_server_create(&exec_ctx, NULL, NULL, &s)); + grpc_tcp_server_create(&exec_ctx, nullptr, nullptr, &s)); LOG_TEST("test_no_op_with_start"); - grpc_tcp_server_start(&exec_ctx, s, NULL, 0, on_connect, NULL); + grpc_tcp_server_start(&exec_ctx, s, nullptr, 0, on_connect, nullptr); grpc_tcp_server_unref(&exec_ctx, s); grpc_exec_ctx_finish(&exec_ctx); } @@ -190,7 +190,7 @@ static void test_no_op_with_port(void) { struct sockaddr_in* addr = (struct sockaddr_in*)resolved_addr.addr; grpc_tcp_server* s; GPR_ASSERT(GRPC_ERROR_NONE == - grpc_tcp_server_create(&exec_ctx, NULL, NULL, &s)); + grpc_tcp_server_create(&exec_ctx, nullptr, nullptr, &s)); LOG_TEST("test_no_op_with_port"); memset(&resolved_addr, 0, sizeof(resolved_addr)); @@ -211,7 +211,7 @@ static void test_no_op_with_port_and_start(void) { struct sockaddr_in* addr = (struct sockaddr_in*)resolved_addr.addr; grpc_tcp_server* s; GPR_ASSERT(GRPC_ERROR_NONE == - grpc_tcp_server_create(&exec_ctx, NULL, NULL, &s)); + grpc_tcp_server_create(&exec_ctx, nullptr, nullptr, &s)); LOG_TEST("test_no_op_with_port_and_start"); int port = -1; @@ -222,7 +222,7 @@ static void test_no_op_with_port_and_start(void) { GRPC_ERROR_NONE && port > 0); - grpc_tcp_server_start(&exec_ctx, s, NULL, 0, on_connect, NULL); + grpc_tcp_server_start(&exec_ctx, s, nullptr, 0, on_connect, nullptr); grpc_tcp_server_unref(&exec_ctx, s); grpc_exec_ctx_finish(&exec_ctx); @@ -255,7 +255,7 @@ static grpc_error* tcp_connect(grpc_exec_ctx* exec_ctx, const test_addr* remote, gpr_log(GPR_DEBUG, "wait"); while (g_nconnects == nconnects_before && deadline > grpc_exec_ctx_now(exec_ctx)) { - grpc_pollset_worker* worker = NULL; + grpc_pollset_worker* worker = nullptr; grpc_error* err; if ((err = grpc_pollset_work(exec_ctx, g_pollset, &worker, deadline)) != GRPC_ERROR_NONE) { @@ -307,7 +307,7 @@ static void test_connect(size_t num_connects, grpc_tcp_server* s; const unsigned num_ports = 2; GPR_ASSERT(GRPC_ERROR_NONE == - grpc_tcp_server_create(&exec_ctx, NULL, channel_args, &s)); + grpc_tcp_server_create(&exec_ctx, nullptr, channel_args, &s)); unsigned port_num; server_weak_ref weak_ref; server_weak_ref_init(&weak_ref); @@ -316,8 +316,8 @@ static void test_connect(size_t num_connects, gpr_log(GPR_INFO, "clients=%lu, num chan args=%lu, remote IP=%s, test_dst_addrs=%d", (unsigned long)num_connects, - (unsigned long)(channel_args != NULL ? channel_args->num_args : 0), - dst_addrs != NULL ? "<specific>" : "::", test_dst_addrs); + (unsigned long)(channel_args != nullptr ? channel_args->num_args : 0), + dst_addrs != nullptr ? "<specific>" : "::", test_dst_addrs); memset(&resolved_addr, 0, sizeof(resolved_addr)); memset(&resolved_addr1, 0, sizeof(resolved_addr1)); resolved_addr.len = sizeof(struct sockaddr_storage); @@ -352,9 +352,9 @@ static void test_connect(size_t num_connects, svr1_fd_count = grpc_tcp_server_port_fd_count(s, 1); GPR_ASSERT(svr1_fd_count >= 1); - grpc_tcp_server_start(&exec_ctx, s, &g_pollset, 1, on_connect, NULL); + grpc_tcp_server_start(&exec_ctx, s, &g_pollset, 1, on_connect, nullptr); - if (dst_addrs != NULL) { + if (dst_addrs != nullptr) { int ports[] = {svr_port, svr1_port}; for (port_num = 0; port_num < num_ports; ++port_num) { size_t dst_idx; @@ -417,14 +417,14 @@ static void test_connect(size_t num_connects, } } /* Weak ref to server valid until final unref. */ - GPR_ASSERT(weak_ref.server != NULL); + GPR_ASSERT(weak_ref.server != nullptr); GPR_ASSERT(grpc_tcp_server_port_fd(s, 0, 0) >= 0); grpc_tcp_server_unref(&exec_ctx, s); grpc_exec_ctx_finish(&exec_ctx); /* Weak ref lost. */ - GPR_ASSERT(weak_ref.server == NULL); + GPR_ASSERT(weak_ref.server == nullptr); } static void destroy_pollset(grpc_exec_ctx* exec_ctx, void* p, @@ -440,7 +440,7 @@ int main(int argc, char** argv) { chan_args[0].key = const_cast<char*>(GRPC_ARG_EXPAND_WILDCARD_ADDRS); chan_args[0].value.integer = 1; const grpc_channel_args channel_args = {1, chan_args}; - struct ifaddrs* ifa = NULL; + struct ifaddrs* ifa = nullptr; struct ifaddrs* ifa_it; // Zalloc dst_addrs to avoid oversized frames. test_addrs* dst_addrs = @@ -455,14 +455,14 @@ int main(int argc, char** argv) { test_no_op_with_port(); test_no_op_with_port_and_start(); - if (getifaddrs(&ifa) != 0 || ifa == NULL) { + if (getifaddrs(&ifa) != 0 || ifa == nullptr) { gpr_log(GPR_ERROR, "getifaddrs: %s", strerror(errno)); return EXIT_FAILURE; } dst_addrs->naddrs = 0; - for (ifa_it = ifa; ifa_it != NULL && dst_addrs->naddrs < MAX_ADDRS; + for (ifa_it = ifa; ifa_it != nullptr && dst_addrs->naddrs < MAX_ADDRS; ifa_it = ifa_it->ifa_next) { - if (ifa_it->ifa_addr == NULL) { + if (ifa_it->ifa_addr == nullptr) { continue; } else if (ifa_it->ifa_addr->sa_family == AF_INET) { dst_addrs->addrs[dst_addrs->naddrs].addr.len = sizeof(struct sockaddr_in); @@ -480,15 +480,15 @@ int main(int argc, char** argv) { ++dst_addrs->naddrs; } freeifaddrs(ifa); - ifa = NULL; + ifa = nullptr; /* Connect to same addresses as listeners. */ - test_connect(1, NULL, NULL, false); - test_connect(10, NULL, NULL, false); + test_connect(1, nullptr, nullptr, false); + test_connect(10, nullptr, nullptr, false); /* Set dst_addrs->addrs[i].len=0 for dst_addrs that are unreachable with a "::" listener. */ - test_connect(1, NULL, dst_addrs, true); + test_connect(1, nullptr, dst_addrs, true); /* Test connect(2) with dst_addrs. */ test_connect(1, &channel_args, dst_addrs, false); diff --git a/test/core/iomgr/timer_heap_test.cc b/test/core/iomgr/timer_heap_test.cc index 20a383371d..f0ab4343cb 100644 --- a/test/core/iomgr/timer_heap_test.cc +++ b/test/core/iomgr/timer_heap_test.cc @@ -146,8 +146,8 @@ static elem_struct* search_elems(elem_struct* elems, size_t count, size_t b = (size_t)rand() % count; GPR_SWAP(size_t, search_order[a], search_order[b]); } - elem_struct* out = NULL; - for (size_t i = 0; out == NULL && i < count; i++) { + elem_struct* out = nullptr; + for (size_t i = 0; out == nullptr && i < count; i++) { if (elems[search_order[i]].inserted == inserted) { out = &elems[search_order[i]]; } @@ -174,7 +174,7 @@ static void test2(void) { if (r <= 550) { /* 55% of the time we try to add something */ elem_struct* el = search_elems(elems, GPR_ARRAY_SIZE(elems), false); - if (el != NULL) { + if (el != nullptr) { el->elem.deadline = random_deadline(); grpc_timer_heap_add(&pq, &el->elem); el->inserted = true; @@ -184,7 +184,7 @@ static void test2(void) { } else if (r <= 650) { /* 10% of the time we try to remove something */ elem_struct* el = search_elems(elems, GPR_ARRAY_SIZE(elems), true); - if (el != NULL) { + if (el != nullptr) { grpc_timer_heap_remove(&pq, &el->elem); el->inserted = false; num_inserted--; @@ -207,10 +207,10 @@ static void test2(void) { } if (num_inserted) { - gpr_atm* min_deadline = NULL; + gpr_atm* min_deadline = nullptr; for (size_t i = 0; i < elems_size; i++) { if (elems[i].inserted) { - if (min_deadline == NULL) { + if (min_deadline == nullptr) { min_deadline = &elems[i].elem.deadline; } else { if (elems[i].elem.deadline < *min_deadline) { diff --git a/test/core/iomgr/timer_list_test.cc b/test/core/iomgr/timer_list_test.cc index 1fdcbc45d4..8976894689 100644 --- a/test/core/iomgr/timer_list_test.cc +++ b/test/core/iomgr/timer_list_test.cc @@ -70,7 +70,7 @@ static void add_test(void) { /* collect timers. Only the first batch should be ready. */ exec_ctx.now = start + 500; - GPR_ASSERT(grpc_timer_check(&exec_ctx, NULL) == GRPC_TIMERS_FIRED); + GPR_ASSERT(grpc_timer_check(&exec_ctx, nullptr) == GRPC_TIMERS_FIRED); grpc_exec_ctx_finish(&exec_ctx); for (i = 0; i < 20; i++) { GPR_ASSERT(cb_called[i][1] == (i < 10)); @@ -78,7 +78,7 @@ static void add_test(void) { } exec_ctx.now = start + 600; - GPR_ASSERT(grpc_timer_check(&exec_ctx, NULL) == + GPR_ASSERT(grpc_timer_check(&exec_ctx, nullptr) == GRPC_TIMERS_CHECKED_AND_EMPTY); grpc_exec_ctx_finish(&exec_ctx); for (i = 0; i < 30; i++) { @@ -88,7 +88,7 @@ static void add_test(void) { /* collect the rest of the timers */ exec_ctx.now = start + 1500; - GPR_ASSERT(grpc_timer_check(&exec_ctx, NULL) == GRPC_TIMERS_FIRED); + GPR_ASSERT(grpc_timer_check(&exec_ctx, nullptr) == GRPC_TIMERS_FIRED); grpc_exec_ctx_finish(&exec_ctx); for (i = 0; i < 30; i++) { GPR_ASSERT(cb_called[i][1] == (i < 20)); @@ -96,7 +96,7 @@ static void add_test(void) { } exec_ctx.now = start + 1600; - GPR_ASSERT(grpc_timer_check(&exec_ctx, NULL) == + GPR_ASSERT(grpc_timer_check(&exec_ctx, nullptr) == GRPC_TIMERS_CHECKED_AND_EMPTY); for (i = 0; i < 30; i++) { GPR_ASSERT(cb_called[i][1] == (i < 20)); @@ -137,7 +137,7 @@ void destruction_test(void) { &exec_ctx, &timers[4], 1, GRPC_CLOSURE_CREATE(cb, (void*)(intptr_t)4, grpc_schedule_on_exec_ctx)); exec_ctx.now = 2; - GPR_ASSERT(grpc_timer_check(&exec_ctx, NULL) == GRPC_TIMERS_FIRED); + GPR_ASSERT(grpc_timer_check(&exec_ctx, nullptr) == GRPC_TIMERS_FIRED); grpc_exec_ctx_finish(&exec_ctx); GPR_ASSERT(1 == cb_called[4][1]); grpc_timer_cancel(&exec_ctx, &timers[0]); diff --git a/test/core/iomgr/udp_server_test.cc b/test/core/iomgr/udp_server_test.cc index 4e8f234a8b..803f017106 100644 --- a/test/core/iomgr/udp_server_test.cc +++ b/test/core/iomgr/udp_server_test.cc @@ -61,8 +61,8 @@ static void on_read(grpc_exec_ctx* exec_ctx, grpc_fd* emfd, void* user_data) { g_number_of_reads++; g_number_of_bytes_read += (int)byte_count; - GPR_ASSERT(GRPC_LOG_IF_ERROR("pollset_kick", - grpc_pollset_kick(exec_ctx, g_pollset, NULL))); + GPR_ASSERT(GRPC_LOG_IF_ERROR( + "pollset_kick", grpc_pollset_kick(exec_ctx, g_pollset, nullptr))); gpr_mu_unlock(g_mu); } @@ -70,8 +70,8 @@ static void on_write(grpc_exec_ctx* exec_ctx, grpc_fd* emfd, void* user_data) { gpr_mu_lock(g_mu); g_number_of_writes++; - GPR_ASSERT(GRPC_LOG_IF_ERROR("pollset_kick", - grpc_pollset_kick(exec_ctx, g_pollset, NULL))); + GPR_ASSERT(GRPC_LOG_IF_ERROR( + "pollset_kick", grpc_pollset_kick(exec_ctx, g_pollset, nullptr))); gpr_mu_unlock(g_mu); } @@ -128,17 +128,17 @@ static test_socket_factory* test_socket_factory_create(void) { static void test_no_op(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_udp_server* s = grpc_udp_server_create(NULL); - grpc_udp_server_destroy(&exec_ctx, s, NULL); + grpc_udp_server* s = grpc_udp_server_create(nullptr); + grpc_udp_server_destroy(&exec_ctx, s, nullptr); grpc_exec_ctx_finish(&exec_ctx); } static void test_no_op_with_start(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_udp_server* s = grpc_udp_server_create(NULL); + grpc_udp_server* s = grpc_udp_server_create(nullptr); LOG_TEST("test_no_op_with_start"); - grpc_udp_server_start(&exec_ctx, s, NULL, 0, NULL); - grpc_udp_server_destroy(&exec_ctx, s, NULL); + grpc_udp_server_start(&exec_ctx, s, nullptr, 0, nullptr); + grpc_udp_server_destroy(&exec_ctx, s, nullptr); grpc_exec_ctx_finish(&exec_ctx); } @@ -147,7 +147,7 @@ static void test_no_op_with_port(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_resolved_address resolved_addr; struct sockaddr_in* addr = (struct sockaddr_in*)resolved_addr.addr; - grpc_udp_server* s = grpc_udp_server_create(NULL); + grpc_udp_server* s = grpc_udp_server_create(nullptr); LOG_TEST("test_no_op_with_port"); memset(&resolved_addr, 0, sizeof(resolved_addr)); @@ -156,7 +156,7 @@ static void test_no_op_with_port(void) { GPR_ASSERT(grpc_udp_server_add_port(s, &resolved_addr, on_read, on_write, on_fd_orphaned)); - grpc_udp_server_destroy(&exec_ctx, s, NULL); + grpc_udp_server_destroy(&exec_ctx, s, nullptr); grpc_exec_ctx_finish(&exec_ctx); /* The server had a single FD, which should have been orphaned. */ @@ -173,7 +173,7 @@ static void test_no_op_with_port_and_socket_factory(void) { grpc_arg socket_factory_arg = grpc_socket_factory_to_arg(&socket_factory->base); grpc_channel_args* channel_args = - grpc_channel_args_copy_and_add(NULL, &socket_factory_arg, 1); + grpc_channel_args_copy_and_add(nullptr, &socket_factory_arg, 1); grpc_udp_server* s = grpc_udp_server_create(channel_args); grpc_channel_args_destroy(&exec_ctx, channel_args); @@ -187,7 +187,7 @@ static void test_no_op_with_port_and_socket_factory(void) { GPR_ASSERT(socket_factory->number_of_socket_calls == 1); GPR_ASSERT(socket_factory->number_of_bind_calls == 1); - grpc_udp_server_destroy(&exec_ctx, s, NULL); + grpc_udp_server_destroy(&exec_ctx, s, nullptr); grpc_exec_ctx_finish(&exec_ctx); grpc_socket_factory_unref(&socket_factory->base); @@ -200,7 +200,7 @@ static void test_no_op_with_port_and_start(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_resolved_address resolved_addr; struct sockaddr_in* addr = (struct sockaddr_in*)resolved_addr.addr; - grpc_udp_server* s = grpc_udp_server_create(NULL); + grpc_udp_server* s = grpc_udp_server_create(nullptr); LOG_TEST("test_no_op_with_port_and_start"); memset(&resolved_addr, 0, sizeof(resolved_addr)); @@ -209,9 +209,9 @@ static void test_no_op_with_port_and_start(void) { GPR_ASSERT(grpc_udp_server_add_port(s, &resolved_addr, on_read, on_write, on_fd_orphaned)); - grpc_udp_server_start(&exec_ctx, s, NULL, 0, NULL); + grpc_udp_server_start(&exec_ctx, s, nullptr, 0, nullptr); - grpc_udp_server_destroy(&exec_ctx, s, NULL); + grpc_udp_server_destroy(&exec_ctx, s, nullptr); grpc_exec_ctx_finish(&exec_ctx); /* The server had a single FD, which is orphaned exactly once in * @@ -224,7 +224,7 @@ static void test_receive(int number_of_clients) { grpc_resolved_address resolved_addr; struct sockaddr_storage* addr = (struct sockaddr_storage*)resolved_addr.addr; int clifd, svrfd; - grpc_udp_server* s = grpc_udp_server_create(NULL); + grpc_udp_server* s = grpc_udp_server_create(nullptr); int i; int number_of_reads_before; grpc_millis deadline; @@ -248,7 +248,7 @@ static void test_receive(int number_of_clients) { GPR_ASSERT(resolved_addr.len <= sizeof(struct sockaddr_storage)); pollsets[0] = g_pollset; - grpc_udp_server_start(&exec_ctx, s, pollsets, 1, NULL); + grpc_udp_server_start(&exec_ctx, s, pollsets, 1, nullptr); gpr_mu_lock(g_mu); @@ -265,7 +265,7 @@ static void test_receive(int number_of_clients) { GPR_ASSERT(5 == write(clifd, "hello", 5)); while (g_number_of_reads == number_of_reads_before && deadline > grpc_exec_ctx_now(&exec_ctx)) { - grpc_pollset_worker* worker = NULL; + grpc_pollset_worker* worker = nullptr; GPR_ASSERT(GRPC_LOG_IF_ERROR( "pollset_work", grpc_pollset_work(&exec_ctx, g_pollset, &worker, deadline))); @@ -280,7 +280,7 @@ static void test_receive(int number_of_clients) { gpr_mu_unlock(g_mu); - grpc_udp_server_destroy(&exec_ctx, s, NULL); + grpc_udp_server_destroy(&exec_ctx, s, nullptr); grpc_exec_ctx_finish(&exec_ctx); /* The server had a single FD, which is orphaned exactly once in * |