From 4ac2b8e585cbf7064f9bdde4eabaf8ff42801142 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Fri, 10 Nov 2017 14:14:17 -0800 Subject: [PATCH] Enable clang-tidy as a sanity check, fix up all known failures --- .clang_complete | 5 + .../client_channel/lb_policy/grpclb/grpclb.cc | 6 +- .../resolver/dns/c_ares/grpc_ares_ev_driver.h | 1 + .../dns/c_ares/grpc_ares_ev_driver_posix.cc | 2 +- .../resolver/dns/c_ares/grpc_ares_wrapper.cc | 4 +- .../chttp2/transport/chttp2_transport.cc | 4 +- .../transport/chttp2/transport/flow_control.h | 2 +- .../transport/chttp2/transport/stream_map.cc | 1 + .../ext/transport/chttp2/transport/writing.cc | 2 +- src/core/lib/iomgr/error.h | 9 +- src/core/lib/iomgr/error_internal.h | 1 + src/core/lib/iomgr/iocp_windows.h | 5 + src/core/lib/iomgr/lockfree_event.h | 2 +- src/core/lib/iomgr/pollset_windows.h | 4 + src/core/lib/iomgr/sockaddr_windows.h | 5 + src/core/lib/iomgr/socket_windows.h | 4 + src/core/lib/iomgr/tcp_uv.h | 6 + src/core/lib/iomgr/tcp_windows.h | 4 + src/core/lib/iomgr/udp_server.cc | 1 + src/core/lib/iomgr/unix_sockets_posix.cc | 5 +- src/core/lib/support/atomic_with_atm.h | 2 +- src/core/lib/support/memory.h | 2 +- src/core/lib/surface/channel.cc | 8 +- src/core/lib/transport/bdp_estimator.h | 2 +- src/core/lib/transport/error_utils.cc | 2 - src/core/lib/transport/transport_op_string.cc | 2 +- src/cpp/client/channel_cc.cc | 16 +- src/cpp/client/client_context.cc | 2 +- src/cpp/client/create_channel.cc | 2 +- src/cpp/server/server_cc.cc | 2 +- src/cpp/server/server_context.cc | 8 +- src/cpp/server/server_posix.cc | 2 +- test/core/bad_client/bad_client.cc | 30 +- test/core/bad_client/tests/badreq.cc | 12 +- .../bad_client/tests/connection_prefix.cc | 50 +- .../bad_client/tests/head_of_line_blocking.cc | 6 +- test/core/bad_client/tests/headers.cc | 120 +- .../tests/initial_settings_frame.cc | 54 +- test/core/bad_client/tests/large_metadata.cc | 4 +- .../tests/server_registered_method.cc | 28 +- test/core/bad_client/tests/simple_request.cc | 26 +- test/core/bad_client/tests/unknown_frame.cc | 4 +- test/core/bad_client/tests/window_overflow.cc | 4 +- test/core/bad_ssl/bad_ssl_test.cc | 20 +- test/core/bad_ssl/server_common.cc | 20 +- test/core/bad_ssl/servers/alpn.cc | 4 +- test/core/bad_ssl/servers/cert.cc | 4 +- test/core/channel/channel_args_test.cc | 10 +- .../channel/channel_stack_builder_test.cc | 4 +- test/core/channel/channel_stack_test.cc | 6 +- .../channel/minimal_stack_is_minimal_test.cc | 28 +- test/core/client_channel/lb_policies_test.cc | 96 +- .../core/client_channel/parse_address_test.cc | 4 +- .../dns_resolver_connectivity_test.cc | 12 +- .../resolvers/dns_resolver_test.cc | 4 +- .../resolvers/fake_resolver_test.cc | 20 +- .../resolvers/sockaddr_resolver_test.cc | 4 +- test/core/client_channel/uri_parser_test.cc | 14 +- test/core/compression/algorithm_test.cc | 4 +- .../compression/stream_compression_test.cc | 14 +- test/core/end2end/bad_server_response_test.cc | 30 +- test/core/end2end/connection_refused_test.cc | 20 +- test/core/end2end/cq_verifier.cc | 26 +- test/core/end2end/cq_verifier_native.cc | 7 +- test/core/end2end/dualstack_socket_test.cc | 36 +- test/core/end2end/end2end_test_utils.cc | 6 +- test/core/end2end/fixtures/h2_census.cc | 10 +- test/core/end2end/fixtures/h2_compress.cc | 14 +- test/core/end2end/fixtures/h2_fakesec.cc | 20 +- test/core/end2end/fixtures/h2_fd.cc | 10 +- test/core/end2end/fixtures/h2_full+pipe.cc | 10 +- test/core/end2end/fixtures/h2_full+trace.cc | 10 +- .../end2end/fixtures/h2_full+workarounds.cc | 10 +- test/core/end2end/fixtures/h2_full.cc | 10 +- test/core/end2end/fixtures/h2_http_proxy.cc | 12 +- .../end2end/fixtures/h2_load_reporting.cc | 10 +- test/core/end2end/fixtures/h2_oauth2.cc | 34 +- test/core/end2end/fixtures/h2_proxy.cc | 14 +- .../end2end/fixtures/h2_sockpair+trace.cc | 16 +- test/core/end2end/fixtures/h2_sockpair.cc | 16 +- .../end2end/fixtures/h2_sockpair_1byte.cc | 14 +- test/core/end2end/fixtures/h2_ssl.cc | 28 +- test/core/end2end/fixtures/h2_ssl_proxy.cc | 36 +- test/core/end2end/fixtures/h2_uds.cc | 10 +- .../end2end/fixtures/http_proxy_fixture.cc | 20 +- test/core/end2end/fixtures/inproc.cc | 10 +- test/core/end2end/fixtures/proxy.cc | 58 +- test/core/end2end/fuzzers/api_fuzzer.cc | 226 +- test/core/end2end/fuzzers/client_fuzzer.cc | 36 +- test/core/end2end/fuzzers/server_fuzzer.cc | 22 +- test/core/end2end/goaway_server_test.cc | 52 +- test/core/end2end/h2_ssl_cert_test.cc | 38 +- .../end2end/invalid_call_argument_test.cc | 148 +- .../end2end/multiple_server_queues_test.cc | 24 +- test/core/end2end/no_server_test.cc | 16 +- .../end2end/tests/authority_not_supported.cc | 34 +- test/core/end2end/tests/bad_hostname.cc | 24 +- test/core/end2end/tests/bad_ping.cc | 34 +- test/core/end2end/tests/binary_metadata.cc | 54 +- test/core/end2end/tests/call_creds.cc | 102 +- .../core/end2end/tests/cancel_after_accept.cc | 46 +- .../end2end/tests/cancel_after_client_done.cc | 44 +- .../core/end2end/tests/cancel_after_invoke.cc | 32 +- .../end2end/tests/cancel_after_round_trip.cc | 58 +- .../end2end/tests/cancel_before_invoke.cc | 32 +- test/core/end2end/tests/cancel_in_a_vacuum.cc | 16 +- test/core/end2end/tests/cancel_with_status.cc | 26 +- test/core/end2end/tests/compressed_payload.cc | 114 +- test/core/end2end/tests/connectivity.cc | 6 +- test/core/end2end/tests/default_host.cc | 40 +- .../core/end2end/tests/disappearing_server.cc | 36 +- test/core/end2end/tests/empty_batch.cc | 18 +- .../end2end/tests/filter_call_init_fails.cc | 94 +- .../core/end2end/tests/filter_causes_close.cc | 34 +- test/core/end2end/tests/filter_latency.cc | 40 +- .../end2end/tests/graceful_server_shutdown.cc | 32 +- test/core/end2end/tests/high_initial_seqno.cc | 32 +- test/core/end2end/tests/hpack_size.cc | 34 +- test/core/end2end/tests/idempotent_request.cc | 40 +- .../end2end/tests/invoke_large_request.cc | 44 +- test/core/end2end/tests/keepalive_timeout.cc | 22 +- test/core/end2end/tests/large_metadata.cc | 38 +- .../core/end2end/tests/load_reporting_hook.cc | 52 +- .../end2end/tests/max_concurrent_streams.cc | 166 +- test/core/end2end/tests/max_connection_age.cc | 62 +- .../core/end2end/tests/max_connection_idle.cc | 32 +- test/core/end2end/tests/max_message_length.cc | 98 +- test/core/end2end/tests/negative_deadline.cc | 24 +- .../end2end/tests/network_status_change.cc | 40 +- test/core/end2end/tests/no_logging.cc | 44 +- test/core/end2end/tests/no_op.cc | 10 +- test/core/end2end/tests/payload.cc | 48 +- test/core/end2end/tests/ping.cc | 6 +- .../core/end2end/tests/ping_pong_streaming.cc | 50 +- test/core/end2end/tests/proxy_auth.cc | 38 +- test/core/end2end/tests/registered_call.cc | 36 +- test/core/end2end/tests/request_with_flags.cc | 28 +- .../end2end/tests/request_with_payload.cc | 40 +- .../end2end/tests/resource_quota_server.cc | 48 +- .../end2end/tests/server_finishes_request.cc | 30 +- .../end2end/tests/shutdown_finishes_calls.cc | 26 +- .../end2end/tests/shutdown_finishes_tags.cc | 8 +- .../end2end/tests/simple_cacheable_request.cc | 56 +- .../end2end/tests/simple_delayed_request.cc | 38 +- test/core/end2end/tests/simple_metadata.cc | 54 +- test/core/end2end/tests/simple_request.cc | 40 +- .../stream_compression_compressed_payload.cc | 114 +- .../tests/stream_compression_payload.cc | 50 +- .../stream_compression_ping_pong_streaming.cc | 52 +- .../end2end/tests/streaming_error_response.cc | 34 +- test/core/end2end/tests/trailing_metadata.cc | 58 +- .../tests/workaround_cronet_compression.cc | 60 +- test/core/end2end/tests/write_buffering.cc | 46 +- .../end2end/tests/write_buffering_at_end.cc | 46 +- test/core/fling/client.cc | 32 +- test/core/fling/fling_stream_test.cc | 2 +- test/core/fling/fling_test.cc | 2 +- test/core/fling/server.cc | 54 +- test/core/handshake/client_ssl.cc | 10 +- test/core/handshake/server_ssl.cc | 14 +- test/core/http/format_request_test.cc | 2 +- test/core/http/httpcli_test.cc | 6 +- test/core/http/httpscli_test.cc | 6 +- test/core/http/parser_test.cc | 16 +- test/core/http/request_fuzzer.cc | 2 +- test/core/http/response_fuzzer.cc | 2 +- test/core/iomgr/combiner_test.cc | 6 +- test/core/iomgr/endpoint_tests.cc | 16 +- test/core/iomgr/ev_epollsig_linux_test.cc | 10 +- test/core/iomgr/fd_conservation_posix_test.cc | 2 +- test/core/iomgr/fd_posix_test.cc | 30 +- test/core/iomgr/load_file_test.cc | 24 +- test/core/iomgr/pollset_set_test.cc | 8 +- test/core/iomgr/resolve_address_posix_test.cc | 16 +- test/core/iomgr/resolve_address_test.cc | 20 +- test/core/iomgr/resource_quota_test.cc | 98 +- test/core/iomgr/sockaddr_utils_test.cc | 12 +- test/core/iomgr/tcp_client_posix_test.cc | 22 +- test/core/iomgr/tcp_posix_test.cc | 18 +- test/core/iomgr/tcp_server_posix_test.cc | 56 +- test/core/iomgr/timer_heap_test.cc | 12 +- test/core/iomgr/timer_list_test.cc | 10 +- test/core/iomgr/udp_server_test.cc | 36 +- test/core/json/json_rewrite.cc | 8 +- test/core/json/json_rewrite_test.cc | 4 +- test/core/json/json_stream_error_test.cc | 6 +- test/core/json/json_test.cc | 104 +- test/core/memory_usage/client.cc | 36 +- test/core/memory_usage/server.cc | 40 +- .../network_benchmarks/low_level_ping_pong.cc | 16 +- test/core/security/auth_context_test.cc | 32 +- test/core/security/create_jwt.cc | 18 +- test/core/security/credentials_test.cc | 198 +- test/core/security/fetch_oauth2.cc | 28 +- test/core/security/json_token_test.cc | 98 +- test/core/security/jwt_verifier_test.cc | 120 +- test/core/security/oauth2_utils.cc | 10 +- .../print_google_default_creds_token.cc | 8 +- test/core/security/secure_endpoint_test.cc | 20 +- test/core/security/security_connector_test.cc | 24 +- test/core/security/ssl_credentials_test.cc | 4 +- test/core/security/ssl_server_fuzzer.cc | 8 +- test/core/security/verify_jwt.cc | 16 +- test/core/slice/slice_hash_table_test.cc | 6 +- test/core/slice/slice_test.cc | 8 +- test/core/statistics/census_log_tests.cc | 576 --- test/core/statistics/hash_table_test.cc | 286 -- test/core/statistics/trace_test.cc | 239 -- test/core/statistics/window_stats_test.cc | 304 -- test/core/support/alloc_test.cc | 4 +- test/core/support/arena_test.cc | 2 +- test/core/support/avl_test.cc | 3474 ++++++++--------- test/core/support/cmdline_test.cc | 160 +- test/core/support/cpu_test.cc | 2 +- test/core/support/env_test.cc | 2 +- test/core/support/log_test.cc | 2 +- test/core/support/mpscq_test.cc | 6 +- test/core/support/string_test.cc | 10 +- test/core/support/sync_test.cc | 20 +- test/core/support/thd_test.cc | 4 +- test/core/support/tls_test.cc | 2 +- test/core/surface/alarm_test.cc | 34 +- test/core/surface/channel_create_test.cc | 4 +- test/core/surface/completion_queue_test.cc | 54 +- .../completion_queue_threading_test.cc | 20 +- .../surface/concurrent_connectivity_test.cc | 30 +- .../core/surface/invalid_channel_args_test.cc | 12 +- test/core/surface/lame_client_test.cc | 20 +- ...num_external_connectivity_watchers_test.cc | 20 +- .../surface/secure_channel_create_test.cc | 8 +- .../surface/sequential_connectivity_test.cc | 34 +- test/core/surface/server_chttp2_test.cc | 16 +- test/core/surface/server_test.cc | 60 +- test/core/transport/byte_stream_test.cc | 10 +- .../transport/chttp2/hpack_encoder_test.cc | 14 +- .../transport/chttp2/hpack_parser_test.cc | 2 +- test/core/transport/chttp2/stream_map_test.cc | 26 +- .../core/transport/connectivity_state_test.cc | 2 +- .../core/transport/stream_owned_slice_test.cc | 2 +- test/core/tsi/fake_transport_security_test.cc | 4 +- test/core/tsi/ssl_transport_security_test.cc | 62 +- test/core/tsi/transport_security_test.cc | 176 +- test/core/tsi/transport_security_test_lib.cc | 116 +- test/core/util/debugger_macros.cc | 6 +- test/core/util/fuzzer_corpus_test.cc | 11 +- test/core/util/memory_counters.cc | 8 +- test/core/util/mock_endpoint.cc | 8 +- test/core/util/parse_hexstring.cc | 2 +- test/core/util/passthru_endpoint.cc | 12 +- test/core/util/port.cc | 10 +- test/core/util/port_server_client.cc | 10 +- test/core/util/reconnect_server.cc | 18 +- test/core/util/slice_splitter.cc | 2 +- test/core/util/test_config.cc | 18 +- test/core/util/test_tcp_server.cc | 8 +- test/core/util/trickle_endpoint.cc | 8 +- test/cpp/codegen/proto_utils_test.cc | 2 +- .../cpp/common/auth_property_iterator_test.cc | 2 +- test/cpp/common/secure_auth_context_test.cc | 4 +- test/cpp/end2end/async_end2end_test.cc | 2 +- test/cpp/end2end/client_lb_end2end_test.cc | 8 +- test/cpp/end2end/end2end_test.cc | 4 +- test/cpp/grpclb/grpclb_api_test.cc | 2 +- test/cpp/grpclb/grpclb_test.cc | 102 +- test/cpp/interop/http2_client.cc | 2 +- test/cpp/interop/stress_test.cc | 2 +- test/cpp/microbenchmarks/bm_call_create.cc | 82 +- test/cpp/microbenchmarks/bm_chttp2_hpack.cc | 6 +- .../microbenchmarks/bm_chttp2_transport.cc | 8 +- test/cpp/microbenchmarks/bm_closure.cc | 54 +- test/cpp/microbenchmarks/bm_cq.cc | 30 +- .../microbenchmarks/bm_cq_multiple_threads.cc | 8 +- test/cpp/microbenchmarks/bm_error.cc | 8 +- .../microbenchmarks/bm_fullstack_trickle.cc | 4 +- test/cpp/microbenchmarks/bm_metadata.cc | 18 +- test/cpp/microbenchmarks/bm_pollset.cc | 8 +- test/cpp/microbenchmarks/fullstack_fixtures.h | 8 +- test/cpp/naming/resolver_component_test.cc | 22 +- ...resolver_component_tests_runner_invoker.cc | 4 +- test/cpp/performance/writes_per_rpc_test.cc | 6 +- test/cpp/qps/json_run_localhost.cc | 6 +- test/cpp/qps/qps_json_driver.cc | 2 +- test/cpp/qps/server_async.cc | 2 +- test/cpp/qps/server_sync.cc | 2 +- .../cpp/thread_manager/thread_manager_test.cc | 2 +- test/cpp/util/grpc_tool.cc | 6 +- test/cpp/util/grpc_tool_test.cc | 16 +- tools/distrib/run_clang_tidy.py | 70 + tools/run_tests/sanity/check_clang_tidy.sh | 21 + tools/run_tests/sanity/sanity_tests.yaml | 3 +- 290 files changed, 5504 insertions(+), 6766 deletions(-) delete mode 100644 test/core/statistics/census_log_tests.cc delete mode 100644 test/core/statistics/hash_table_test.cc delete mode 100644 test/core/statistics/trace_test.cc delete mode 100644 test/core/statistics/window_stats_test.cc create mode 100755 tools/distrib/run_clang_tidy.py create mode 100755 tools/run_tests/sanity/check_clang_tidy.sh diff --git a/.clang_complete b/.clang_complete index 4c4a86f0be941..aa77554f4eec1 100644 --- a/.clang_complete +++ b/.clang_complete @@ -10,3 +10,8 @@ -Ithird_party/zlib -Ithird_party/protobuf/src -Ithird_party/abseil-cpp +-Ithird_party/cares/cares +-Ithird_party/cares +-Ithird_party/googletest/googletest/include +-Ithird_party/googletest/googlemock/include + 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 a3282b5d934ba..e9f17950793b4 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 @@ -449,8 +449,8 @@ 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) { @@ -563,7 +563,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; } 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 a5fb1f10e169f..0062aa561a0a7 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 #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 92c72c1bcbb92..4cb068a41dd23 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 @@ -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)); 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 af4493389d906..7271559432c6c 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 @@ -297,7 +297,7 @@ static void on_txt_done_cb(void* arg, int status, int timeouts, *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); @@ -334,7 +334,7 @@ static grpc_ares_request* grpc_dns_lookup_ares_impl( grpc_error* error = GRPC_ERROR_NONE; grpc_ares_hostbyname_request* hr = nullptr; grpc_ares_request* r = nullptr; - ares_channel* channel = NULL; + 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", diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index bd74e2e4b60bb..c92fdb7127780 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -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, @@ -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"); diff --git a/src/core/ext/transport/chttp2/transport/flow_control.h b/src/core/ext/transport/chttp2/transport/flow_control.h index c6ab2ca9aa33c..7dd348ed5f1da 100644 --- a/src/core/ext/transport/chttp2/transport/flow_control.h +++ b/src/core/ext/transport/chttp2/transport/flow_control.h @@ -41,7 +41,7 @@ class TrickledCHTTP2; // to make this a friend namespace grpc_core { namespace chttp2 { -static constexpr uint32_t;;;;;;;;;;;;; kDefaultWindow = 65535; +static constexpr uint32_t kDefaultWindow = 65535; class TransportFlowControl; class StreamFlowControl; diff --git a/src/core/ext/transport/chttp2/transport/stream_map.cc b/src/core/ext/transport/chttp2/transport/stream_map.cc index 3e7bc23bc1c78..e4f08f5a6c0ba 100644 --- a/src/core/ext/transport/chttp2/transport/stream_map.cc +++ b/src/core/ext/transport/chttp2/transport/stream_map.cc @@ -145,6 +145,7 @@ void* grpc_chttp2_stream_map_rand(grpc_chttp2_stream_map* map) { 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 3ade27982dd38..db9fb213339cd 100644 --- a/src/core/ext/transport/chttp2/transport/writing.cc +++ b/src/core/ext/transport/chttp2/transport/writing.cc @@ -397,7 +397,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()))); } diff --git a/src/core/lib/iomgr/error.h b/src/core/lib/iomgr/error.h index 36ba440c8a194..8d7aea4872ca1 100644 --- a/src/core/lib/iomgr/error.h +++ b/src/core/lib/iomgr/error.h @@ -24,6 +24,7 @@ #include #include +#include #include #include "src/core/lib/debug/trace.h" @@ -184,9 +185,15 @@ grpc_error* grpc_error_add_child(grpc_error* src, grpc_error* child) GRPC_MUST_USE_RESULT; grpc_error* grpc_os_error(const char* file, int line, int err, const char* call_name) GRPC_MUST_USE_RESULT; + +inline grpc_error* grpc_assert_never_ok(grpc_error* error) { + GPR_ASSERT(error != GRPC_ERROR_NONE); + return error; +} + /// create an error associated with errno!=0 (an 'operating system' error) #define GRPC_OS_ERROR(err, call_name) \ - grpc_os_error(__FILE__, __LINE__, err, call_name) + grpc_assert_never_ok(grpc_os_error(__FILE__, __LINE__, err, call_name)) grpc_error* grpc_wsa_error(const char* file, int line, int err, const char* call_name) GRPC_MUST_USE_RESULT; /// windows only: create an error associated with WSAGetLastError()!=0 diff --git a/src/core/lib/iomgr/error_internal.h b/src/core/lib/iomgr/error_internal.h index 14c15d44b2695..d5ccbae9e7686 100644 --- a/src/core/lib/iomgr/error_internal.h +++ b/src/core/lib/iomgr/error_internal.h @@ -23,6 +23,7 @@ #include // TODO, do we need this? #include +#include "src/core/lib/iomgr/error.h" #ifdef __cplusplus extern "C" { diff --git a/src/core/lib/iomgr/iocp_windows.h b/src/core/lib/iomgr/iocp_windows.h index ff9b31efe2145..3f3c8a18bc2da 100644 --- a/src/core/lib/iomgr/iocp_windows.h +++ b/src/core/lib/iomgr/iocp_windows.h @@ -21,6 +21,10 @@ #include +#include "src/core/lib/iomgr/port.h" + +#ifdef GRPC_WINSOCK_SOCKET + #include "src/core/lib/iomgr/socket_windows.h" #ifdef __cplusplus @@ -45,4 +49,5 @@ void grpc_iocp_add_socket(grpc_winsocket*); } #endif +#endif /* GRPC_WINSOCK_SOCKET */ #endif /* GRPC_CORE_LIB_IOMGR_IOCP_WINDOWS_H */ diff --git a/src/core/lib/iomgr/lockfree_event.h b/src/core/lib/iomgr/lockfree_event.h index a9f4de14dfa25..c667dcd3bc957 100644 --- a/src/core/lib/iomgr/lockfree_event.h +++ b/src/core/lib/iomgr/lockfree_event.h @@ -25,7 +25,7 @@ #include "src/core/lib/iomgr/exec_ctx.h" -namespace grpc_core; { +namespace grpc_core { class LockfreeEvent { public: diff --git a/src/core/lib/iomgr/pollset_windows.h b/src/core/lib/iomgr/pollset_windows.h index aaeb5f585f668..978976395d9ce 100644 --- a/src/core/lib/iomgr/pollset_windows.h +++ b/src/core/lib/iomgr/pollset_windows.h @@ -21,6 +21,9 @@ #include +#include "src/core/lib/iomgr/port.h" + +#ifdef GRPC_WINSOCK_SOCKET #include "src/core/lib/iomgr/socket_windows.h" #ifdef __cplusplus @@ -68,4 +71,5 @@ void grpc_pollset_global_shutdown(void); } #endif +#endif /* GRPC_WINSOCK_SOCKET */ #endif /* GRPC_CORE_LIB_IOMGR_POLLSET_WINDOWS_H */ diff --git a/src/core/lib/iomgr/sockaddr_windows.h b/src/core/lib/iomgr/sockaddr_windows.h index cf0f6b914d319..1e859006f0b09 100644 --- a/src/core/lib/iomgr/sockaddr_windows.h +++ b/src/core/lib/iomgr/sockaddr_windows.h @@ -19,10 +19,15 @@ #ifndef GRPC_CORE_LIB_IOMGR_SOCKADDR_WINDOWS_H #define GRPC_CORE_LIB_IOMGR_SOCKADDR_WINDOWS_H +#include "src/core/lib/iomgr/port.h" + +#ifdef GRPC_WINSOCK_SOCKET + #include #include // must be included after the above #include +#endif /* GRPC_WINSOCK_SOCKET */ #endif /* GRPC_CORE_LIB_IOMGR_SOCKADDR_WINDOWS_H */ diff --git a/src/core/lib/iomgr/socket_windows.h b/src/core/lib/iomgr/socket_windows.h index 6f6c7a70242bb..d7938691ceb6c 100644 --- a/src/core/lib/iomgr/socket_windows.h +++ b/src/core/lib/iomgr/socket_windows.h @@ -20,6 +20,9 @@ #define GRPC_CORE_LIB_IOMGR_SOCKET_WINDOWS_H #include +#include "src/core/lib/iomgr/port.h" + +#ifdef GRPC_WINSOCK_SOCKET #include #include @@ -115,4 +118,5 @@ void grpc_socket_become_ready(grpc_exec_ctx* exec_ctx, } #endif +#endif /* GRPC_WINSOCK_SOCKET */ #endif /* GRPC_CORE_LIB_IOMGR_SOCKET_WINDOWS_H */ diff --git a/src/core/lib/iomgr/tcp_uv.h b/src/core/lib/iomgr/tcp_uv.h index 8a4914935a957..708e8469e69ba 100644 --- a/src/core/lib/iomgr/tcp_uv.h +++ b/src/core/lib/iomgr/tcp_uv.h @@ -32,6 +32,10 @@ #include "src/core/lib/debug/trace.h" #include "src/core/lib/iomgr/endpoint.h" +#include "src/core/lib/iomgr/port.h" + +#ifdef GRPC_UV + #include extern grpc_tracer_flag grpc_tcp_trace; @@ -50,4 +54,6 @@ grpc_endpoint* grpc_tcp_create(uv_tcp_t* handle, } #endif +#endif /* GRPC_UV */ + #endif /* GRPC_CORE_LIB_IOMGR_TCP_UV_H */ diff --git a/src/core/lib/iomgr/tcp_windows.h b/src/core/lib/iomgr/tcp_windows.h index aea5bab47da6a..220b502ecdbf6 100644 --- a/src/core/lib/iomgr/tcp_windows.h +++ b/src/core/lib/iomgr/tcp_windows.h @@ -29,6 +29,9 @@ otherwise specified. */ +#include "src/core/lib/iomgr/port.h" + +#ifdef GRPC_WINSOCK_SOCKET #include "src/core/lib/iomgr/endpoint.h" #include "src/core/lib/iomgr/socket_windows.h" @@ -49,4 +52,5 @@ grpc_error* grpc_tcp_prepare_socket(SOCKET sock); } #endif +#endif /* GRPC_WINSOCK_SOCKET */ #endif /* GRPC_CORE_LIB_IOMGR_TCP_WINDOWS_H */ diff --git a/src/core/lib/iomgr/udp_server.cc b/src/core/lib/iomgr/udp_server.cc index 28f53f4fbf296..68ab9355ca3f6 100644 --- a/src/core/lib/iomgr/udp_server.cc +++ b/src/core/lib/iomgr/udp_server.cc @@ -508,6 +508,7 @@ int grpc_udp_server_get_fd(grpc_udp_server* s, unsigned port_index) { for (sp = s->head; sp && port_index != 0; sp = sp->next) { --port_index; } + GPR_ASSERT(sp); // if this fails, our check earlier was bogus return sp->fd; } diff --git a/src/core/lib/iomgr/unix_sockets_posix.cc b/src/core/lib/iomgr/unix_sockets_posix.cc index 154c58e98b8d6..af862c00dc5e7 100644 --- a/src/core/lib/iomgr/unix_sockets_posix.cc +++ b/src/core/lib/iomgr/unix_sockets_posix.cc @@ -39,7 +39,8 @@ void grpc_create_socketpair_if_unix(int sv[2]) { grpc_error* grpc_resolve_unix_domain_address(const char* name, grpc_resolved_addresses** addrs) { struct sockaddr_un* un; - if (strlen(name) > GPR_ARRAY_SIZE(((struct sockaddr_un*)nullptr)->sun_path) - 1) { + if (strlen(name) > + GPR_ARRAY_SIZE(((struct sockaddr_un*)nullptr)->sun_path) - 1) { char* err_msg; grpc_error* err; gpr_asprintf(&err_msg, @@ -56,7 +57,7 @@ grpc_error* grpc_resolve_unix_domain_address(const char* name, (grpc_resolved_address*)gpr_malloc(sizeof(grpc_resolved_address)); un = (struct sockaddr_un*)(*addrs)->addrs->addr; un->sun_family = AF_UNIX; - strcpy(un->sun_path, name); + strncpy(un->sun_path, name, sizeof(un->sun_path)); (*addrs)->addrs->len = strlen(un->sun_path) + sizeof(un->sun_family) + 1; return GRPC_ERROR_NONE; } diff --git a/src/core/lib/support/atomic_with_atm.h b/src/core/lib/support/atomic_with_atm.h index 5d675ff876748..fe00e9b5bc592 100644 --- a/src/core/lib/support/atomic_with_atm.h +++ b/src/core/lib/support/atomic_with_atm.h @@ -21,7 +21,7 @@ #include -namespace grpc_core;; { +namespace grpc_core { enum MemoryOrderRelaxed { memory_order_relaxed }; diff --git a/src/core/lib/support/memory.h b/src/core/lib/support/memory.h index 6b336681db2fd..695418e3e1e98 100644 --- a/src/core/lib/support/memory.h +++ b/src/core/lib/support/memory.h @@ -76,7 +76,7 @@ class Allocator { pointer address(reference x) const { return &x; } const_pointer address(const_reference x) const { return &x; } pointer allocate(std::size_t n, - std::allocator::const_pointer hint = 0) { + std::allocator::const_pointer hint = nullptr) { return static_cast(gpr_malloc(n * sizeof(T))); } void deallocate(T* p, std::size_t n) { gpr_free(p); } diff --git a/src/core/lib/surface/channel.cc b/src/core/lib/surface/channel.cc index 72e0b8bfb7862..8987768a7ec12 100644 --- a/src/core/lib/surface/channel.cc +++ b/src/core/lib/surface/channel.cc @@ -302,10 +302,10 @@ grpc_call* grpc_channel_create_call(grpc_channel* channel, GPR_ASSERT(!reserved); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_call* call = grpc_channel_create_call_internal( - &exec_ctx, channel, parent_call, propagation_mask, cq, NULL, + &exec_ctx, channel, parent_call, propagation_mask, cq, nullptr, grpc_mdelem_from_slices(&exec_ctx, GRPC_MDSTR_PATH, grpc_slice_ref_internal(method)), - host != NULL ? grpc_mdelem_from_slices(&exec_ctx, GRPC_MDSTR_AUTHORITY, + host != nullptr ? grpc_mdelem_from_slices(&exec_ctx, GRPC_MDSTR_AUTHORITY, grpc_slice_ref_internal(*host)) : GRPC_MDNULL, grpc_timespec_to_millis_round_up(deadline)); @@ -319,10 +319,10 @@ grpc_call* grpc_channel_create_pollset_set_call( const grpc_slice* host, grpc_millis deadline, void* reserved) { GPR_ASSERT(!reserved); return grpc_channel_create_call_internal( - exec_ctx, channel, parent_call, propagation_mask, NULL, pollset_set, + exec_ctx, channel, parent_call, propagation_mask, nullptr, pollset_set, grpc_mdelem_from_slices(exec_ctx, GRPC_MDSTR_PATH, grpc_slice_ref_internal(method)), - host != NULL ? grpc_mdelem_from_slices(exec_ctx, GRPC_MDSTR_AUTHORITY, + host != nullptr ? grpc_mdelem_from_slices(exec_ctx, GRPC_MDSTR_AUTHORITY, grpc_slice_ref_internal(*host)) : GRPC_MDNULL, deadline); diff --git a/src/core/lib/transport/bdp_estimator.h b/src/core/lib/transport/bdp_estimator.h index 984ba88ecb71c..f7b94a81d3ea5 100644 --- a/src/core/lib/transport/bdp_estimator.h +++ b/src/core/lib/transport/bdp_estimator.h @@ -33,7 +33,7 @@ extern grpc_tracer_flag grpc_bdp_estimator_trace; -namespace grpc_core; { +namespace grpc_core { class BdpEstimator { public: diff --git a/src/core/lib/transport/error_utils.cc b/src/core/lib/transport/error_utils.cc index 9bcff9f284439..19510b4c8d01f 100644 --- a/src/core/lib/transport/error_utils.cc +++ b/src/core/lib/transport/error_utils.cc @@ -90,8 +90,6 @@ void grpc_error_get_status(grpc_exec_ctx* exec_ctx, grpc_error* error, } } } - - if (found_error == nullptr) found_error = error; } bool grpc_error_has_clear_grpc_status(grpc_error* error) { diff --git a/src/core/lib/transport/transport_op_string.cc b/src/core/lib/transport/transport_op_string.cc index eb84391237033..e69ab02570720 100644 --- a/src/core/lib/transport/transport_op_string.cc +++ b/src/core/lib/transport/transport_op_string.cc @@ -189,7 +189,7 @@ char* grpc_transport_op_string(grpc_transport_op* op) { if (op->send_ping != nullptr) { if (!first) gpr_strvec_add(&b, gpr_strdup(" ")); - first = false; + // first = false; gpr_strvec_add(&b, gpr_strdup("SEND_PING")); } diff --git a/src/cpp/client/channel_cc.cc b/src/cpp/client/channel_cc.cc index 9df531066e2cc..08420817c87b2 100644 --- a/src/cpp/client/channel_cc.cc +++ b/src/cpp/client/channel_cc.cc @@ -61,11 +61,11 @@ namespace { grpc::string GetChannelInfoField(grpc_channel* channel, grpc_channel_info* channel_info, char*** channel_info_field) { - char* value = NULL; + char* value = nullptr; memset(channel_info, 0, sizeof(*channel_info)); *channel_info_field = &value; grpc_channel_get_info(channel, channel_info); - if (value == NULL) return ""; + if (value == nullptr) return ""; grpc::string result = value; gpr_free(value); return result; @@ -89,14 +89,14 @@ internal::Call Channel::CreateCall(const internal::RpcMethod& method, ClientContext* context, CompletionQueue* cq) { const bool kRegistered = method.channel_tag() && context->authority().empty(); - grpc_call* c_call = NULL; + grpc_call* c_call = nullptr; if (kRegistered) { c_call = grpc_channel_create_registered_call( c_channel_, context->propagate_from_call_, context->propagation_options_.c_bitmask(), cq->cq(), method.channel_tag(), context->raw_deadline(), nullptr); } else { - const char* host_str = NULL; + const char* host_str = nullptr; if (!context->authority().empty()) { host_str = context->authority_.c_str(); } else if (!host_.empty()) { @@ -134,7 +134,7 @@ void Channel::PerformOpsOnCall(internal::CallOpSetInterface* ops, void* Channel::RegisterMethod(const char* method) { return grpc_channel_register_call( - c_channel_, method, host_.empty() ? NULL : host_.c_str(), nullptr); + c_channel_, method, host_.empty() ? nullptr : host_.c_str(), nullptr); } grpc_connectivity_state Channel::GetState(bool try_to_connect) { @@ -171,10 +171,10 @@ bool Channel::WaitForStateChangeImpl(grpc_connectivity_state last_observed, gpr_timespec deadline) { CompletionQueue cq; bool ok = false; - void* tag = NULL; - NotifyOnStateChangeImpl(last_observed, deadline, &cq, NULL); + void* tag = nullptr; + NotifyOnStateChangeImpl(last_observed, deadline, &cq, nullptr); cq.Next(&tag, &ok); - GPR_ASSERT(tag == NULL); + GPR_ASSERT(tag == nullptr); return ok; } diff --git a/src/cpp/client/client_context.cc b/src/cpp/client/client_context.cc index 40e95f3c05de9..dafa8081e9932 100644 --- a/src/cpp/client/client_context.cc +++ b/src/cpp/client/client_context.cc @@ -127,7 +127,7 @@ grpc::string ClientContext::peer() const { void ClientContext::SetGlobalCallbacks(GlobalCallbacks* client_callbacks) { GPR_ASSERT(g_client_callbacks == &g_default_client_callbacks); - GPR_ASSERT(client_callbacks != NULL); + GPR_ASSERT(client_callbacks != nullptr); GPR_ASSERT(client_callbacks != &g_default_client_callbacks); g_client_callbacks = client_callbacks; } diff --git a/src/cpp/client/create_channel.cc b/src/cpp/client/create_channel.cc index de67281dd45bb..a445feab664d3 100644 --- a/src/cpp/client/create_channel.cc +++ b/src/cpp/client/create_channel.cc @@ -42,7 +42,7 @@ std::shared_ptr CreateCustomChannel( return creds ? creds->CreateChannel(target, args) : CreateChannelInternal("", grpc_lame_client_channel_create( - NULL, GRPC_STATUS_INVALID_ARGUMENT, + nullptr, GRPC_STATUS_INVALID_ARGUMENT, "Invalid credentials.")); } diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc index 6480482774ee4..4f8f4e06fccc2 100644 --- a/src/cpp/server/server_cc.cc +++ b/src/cpp/server/server_cc.cc @@ -76,7 +76,7 @@ class Server::UnimplementedAsyncRequest final public: UnimplementedAsyncRequest(Server* server, ServerCompletionQueue* cq) : GenericAsyncRequest(server, &server_context_, &generic_stream_, cq, cq, - NULL, false), + nullptr, false), server_(server), cq_(cq) {} diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index f2cb6363f5c25..f0cbbdb86dd46 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -90,7 +90,7 @@ void ServerContext::CompletionOp::FillOps(grpc_call* call, grpc_op* ops, ops->op = GRPC_OP_RECV_CLOSE_ON_SERVER; ops->data.recv_close_on_server.cancelled = &cancelled_; ops->flags = 0; - ops->reserved = NULL; + ops->reserved = nullptr; *nops = 1; } @@ -171,7 +171,7 @@ void ServerContext::AddTrailingMetadata(const grpc::string& key, void ServerContext::TryCancel() const { grpc_call_error err = grpc_call_cancel_with_status( - call_, GRPC_STATUS_CANCELLED, "Cancelled on the server side", NULL); + call_, GRPC_STATUS_CANCELLED, "Cancelled on the server side", nullptr); if (err != GRPC_CALL_OK) { gpr_log(GPR_ERROR, "TryCancel failed with: %d", err); } @@ -190,13 +190,13 @@ bool ServerContext::IsCancelled() const { void ServerContext::set_compression_algorithm( grpc_compression_algorithm algorithm) { - const char* algorithm_name = NULL; + const char* algorithm_name = nullptr; if (!grpc_compression_algorithm_name(algorithm, &algorithm_name)) { gpr_log(GPR_ERROR, "Name for compression algorithm '%d' unknown.", algorithm); abort(); } - GPR_ASSERT(algorithm_name != NULL); + GPR_ASSERT(algorithm_name != nullptr); AddInitialMetadata(GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY, algorithm_name); } diff --git a/src/cpp/server/server_posix.cc b/src/cpp/server/server_posix.cc index a3c58f777bdd9..d3ef5cb650ee0 100644 --- a/src/cpp/server/server_posix.cc +++ b/src/cpp/server/server_posix.cc @@ -25,7 +25,7 @@ namespace grpc { #ifdef GPR_SUPPORT_CHANNELS_FROM_FD void AddInsecureChannelFromFd(Server* server, int fd) { - grpc_server_add_insecure_channel_from_fd(server->c_server(), NULL, fd); + grpc_server_add_insecure_channel_from_fd(server->c_server(), nullptr, fd); } #endif // GPR_SUPPORT_CHANNELS_FROM_FD diff --git a/test/core/bad_client/bad_client.cc b/test/core/bad_client/bad_client.cc index b1944425ba8be..c8bd005d5c914 100644 --- a/test/core/bad_client/bad_client.cc +++ b/test/core/bad_client/bad_client.cc @@ -58,7 +58,7 @@ static void done_write(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) { static void server_setup_transport(void* ts, grpc_transport* transport) { thd_args* a = (thd_args*)ts; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_server_setup_transport(&exec_ctx, a->server, transport, NULL, + grpc_server_setup_transport(&exec_ctx, a->server, transport, nullptr, grpc_server_get_channel_args(a->server)); grpc_exec_ctx_finish(&exec_ctx); } @@ -101,23 +101,23 @@ void grpc_run_bad_client_test( grpc_init(); /* Create endpoints */ - sfd = grpc_iomgr_create_endpoint_pair("fixture", NULL); + sfd = grpc_iomgr_create_endpoint_pair("fixture", nullptr); /* Create server, completion events */ - a.server = grpc_server_create(NULL, NULL); - a.cq = grpc_completion_queue_create_for_next(NULL); + a.server = grpc_server_create(nullptr, nullptr); + a.cq = grpc_completion_queue_create_for_next(nullptr); gpr_event_init(&a.done_thd); gpr_event_init(&a.done_write); a.validator = server_validator; - grpc_server_register_completion_queue(a.server, a.cq, NULL); + grpc_server_register_completion_queue(a.server, a.cq, nullptr); a.registered_method = grpc_server_register_method(a.server, GRPC_BAD_CLIENT_REGISTERED_METHOD, GRPC_BAD_CLIENT_REGISTERED_HOST, GRPC_SRM_PAYLOAD_READ_INITIAL_BYTE_BUFFER, 0); grpc_server_start(a.server); - transport = grpc_create_chttp2_transport(&exec_ctx, NULL, sfd.server, 0); + transport = grpc_create_chttp2_transport(&exec_ctx, nullptr, sfd.server, 0); server_setup_transport(&a, transport); - grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL); + grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr); grpc_exec_ctx_finish(&exec_ctx); /* Bind everything into the same pollset */ @@ -128,7 +128,7 @@ void grpc_run_bad_client_test( GPR_ASSERT(grpc_server_has_open_connections(a.server)); /* Start validator */ - gpr_thd_new(&id, thd_func, &a, NULL); + gpr_thd_new(&id, thd_func, &a, nullptr); grpc_slice_buffer_init(&outgoing); grpc_slice_buffer_add(&outgoing, slice); @@ -152,14 +152,14 @@ void grpc_run_bad_client_test( GRPC_ERROR_CREATE_FROM_STATIC_STRING("Forced Disconnect")); grpc_endpoint_destroy(&exec_ctx, sfd.client); grpc_exec_ctx_finish(&exec_ctx); - sfd.client = NULL; + sfd.client = nullptr; } GPR_ASSERT(gpr_event_wait(&a.done_thd, grpc_timeout_seconds_to_deadline(5))); - if (sfd.client != NULL) { + if (sfd.client != nullptr) { // Validate client stream, if requested. - if (client_validator != NULL) { + if (client_validator != nullptr) { gpr_timespec deadline = grpc_timeout_seconds_to_deadline(5); grpc_slice_buffer incoming; grpc_slice_buffer_init(&incoming); @@ -176,7 +176,7 @@ void grpc_run_bad_client_test( do { GPR_ASSERT(gpr_time_cmp(deadline, gpr_now(deadline.clock_type)) > 0); GPR_ASSERT(grpc_completion_queue_next( - a.cq, grpc_timeout_milliseconds_to_deadline(100), NULL) + a.cq, grpc_timeout_milliseconds_to_deadline(100), nullptr) .type == GRPC_QUEUE_TIMEOUT); } while (!gpr_event_get(&read_done_event)); if (client_validator(&incoming)) break; @@ -196,10 +196,10 @@ void grpc_run_bad_client_test( GPR_ASSERT( gpr_event_wait(&a.done_write, grpc_timeout_seconds_to_deadline(1))); - shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); - grpc_server_shutdown_and_notify(a.server, shutdown_cq, NULL); + shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr); + grpc_server_shutdown_and_notify(a.server, shutdown_cq, nullptr); GPR_ASSERT(grpc_completion_queue_pluck( - shutdown_cq, NULL, grpc_timeout_seconds_to_deadline(1), NULL) + shutdown_cq, nullptr, grpc_timeout_seconds_to_deadline(1), nullptr) .type == GRPC_OP_COMPLETE); grpc_completion_queue_destroy(shutdown_cq); grpc_server_destroy(a.server); diff --git a/test/core/bad_client/tests/badreq.cc b/test/core/bad_client/tests/badreq.cc index 5273c831e503c..c30244e0cdd25 100644 --- a/test/core/bad_client/tests/badreq.cc +++ b/test/core/bad_client/tests/badreq.cc @@ -31,7 +31,7 @@ static void verifier(grpc_server* server, grpc_completion_queue* cq, void* registered_method) { while (grpc_server_has_open_connections(server)) { GPR_ASSERT(grpc_completion_queue_next( - cq, grpc_timeout_milliseconds_to_deadline(20), NULL) + cq, grpc_timeout_milliseconds_to_deadline(20), nullptr) .type == GRPC_QUEUE_TIMEOUT); } } @@ -41,7 +41,7 @@ int main(int argc, char** argv) { /* invalid content type */ GRPC_RUN_BAD_CLIENT_TEST( - verifier, NULL, + verifier, nullptr, PFX_STR "\x00\x00\xc2\x01\x04\x00\x00\x00\x01" "\x10\x05:path\x08/foo/bar" @@ -57,7 +57,7 @@ int main(int argc, char** argv) { /* invalid te */ GRPC_RUN_BAD_CLIENT_TEST( - verifier, NULL, + verifier, nullptr, PFX_STR "\x00\x00\xcb\x01\x04\x00\x00\x00\x01" "\x10\x05:path\x08/foo/bar" @@ -75,7 +75,7 @@ int main(int argc, char** argv) { /* two path headers */ GRPC_RUN_BAD_CLIENT_TEST( - verifier, NULL, + verifier, nullptr, PFX_STR "\x00\x00\xd9\x01\x04\x00\x00\x00\x01" "\x10\x05:path\x08/foo/bar" @@ -93,7 +93,7 @@ int main(int argc, char** argv) { /* bad accept-encoding algorithm */ GRPC_RUN_BAD_CLIENT_TEST( - verifier, NULL, + verifier, nullptr, PFX_STR "\x00\x00\xd2\x01\x04\x00\x00\x00\x01" "\x10\x05:path\x08/foo/bar" @@ -110,7 +110,7 @@ int main(int argc, char** argv) { /* bad grpc-encoding algorithm */ GRPC_RUN_BAD_CLIENT_TEST( - verifier, NULL, + verifier, nullptr, PFX_STR "\x00\x00\xf5\x01\x04\x00\x00\x00\x01" "\x10\x05:path\x08/foo/bar" diff --git a/test/core/bad_client/tests/connection_prefix.cc b/test/core/bad_client/tests/connection_prefix.cc index a4fd734e0408a..8ffc5a5be852b 100644 --- a/test/core/bad_client/tests/connection_prefix.cc +++ b/test/core/bad_client/tests/connection_prefix.cc @@ -23,7 +23,7 @@ static void verifier(grpc_server* server, grpc_completion_queue* cq, void* registered_method) { while (grpc_server_has_open_connections(server)) { GPR_ASSERT(grpc_completion_queue_next( - cq, grpc_timeout_milliseconds_to_deadline(20), NULL) + cq, grpc_timeout_milliseconds_to_deadline(20), nullptr) .type == GRPC_QUEUE_TIMEOUT); } } @@ -31,30 +31,30 @@ static void verifier(grpc_server* server, grpc_completion_queue* cq, int main(int argc, char** argv) { grpc_test_init(argc, argv); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "X", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PX", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRX", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRIX", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI X", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI *X", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * X", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HX", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTX", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTTX", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTTPX", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTTP/X", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTTP/2X", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTTP/2.X", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTTP/2.0X", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTTP/2.0\rX", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTTP/2.0\r\nX", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTTP/2.0\r\n\rX", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTTP/2.0\r\n\r\nX", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTTP/2.0\r\n\r\nSX", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTTP/2.0\r\n\r\nSMX", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTTP/2.0\r\n\r\nSM\rX", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTTP/2.0\r\n\r\nSM\r\nX", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, "PRI * HTTP/2.0\r\n\r\nSM\r\n\rX", + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "X", 0); + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PX", 0); + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRX", 0); + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRIX", 0); + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI X", 0); + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI *X", 0); + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * X", 0); + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HX", 0); + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTX", 0); + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTTX", 0); + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTTPX", 0); + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTTP/X", 0); + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTTP/2X", 0); + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTTP/2.X", 0); + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTTP/2.0X", 0); + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTTP/2.0\rX", 0); + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTTP/2.0\r\nX", 0); + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTTP/2.0\r\n\rX", 0); + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTTP/2.0\r\n\r\nX", 0); + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTTP/2.0\r\n\r\nSX", 0); + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTTP/2.0\r\n\r\nSMX", 0); + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTTP/2.0\r\n\r\nSM\rX", 0); + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTTP/2.0\r\n\r\nSM\r\nX", 0); + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, "PRI * HTTP/2.0\r\n\r\nSM\r\n\rX", 0); return 0; } diff --git a/test/core/bad_client/tests/head_of_line_blocking.cc b/test/core/bad_client/tests/head_of_line_blocking.cc index aad335cf5b4e6..bbc5611991408 100644 --- a/test/core/bad_client/tests/head_of_line_blocking.cc +++ b/test/core/bad_client/tests/head_of_line_blocking.cc @@ -74,7 +74,7 @@ static void verifier(grpc_server* server, grpc_completion_queue* cq, cq_verifier* cqv = cq_verifier_create(cq); grpc_metadata_array request_metadata_recv; gpr_timespec deadline; - grpc_byte_buffer* payload = NULL; + grpc_byte_buffer* payload = nullptr; grpc_metadata_array_init(&request_metadata_recv); @@ -85,7 +85,7 @@ static void verifier(grpc_server* server, grpc_completion_queue* cq, CQ_EXPECT_COMPLETION(cqv, tag(101), 1); cq_verify(cqv); - GPR_ASSERT(payload != NULL); + GPR_ASSERT(payload != nullptr); grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_unref(s); @@ -129,7 +129,7 @@ int main(int argc, char** argv) { addbuf(hdr, sizeof(hdr)); addbuf(msg, FRAME_SIZE); } - grpc_run_bad_client_test(verifier, NULL, g_buffer, g_count, 0); + grpc_run_bad_client_test(verifier, nullptr, g_buffer, g_count, 0); gpr_free(g_buffer); return 0; diff --git a/test/core/bad_client/tests/headers.cc b/test/core/bad_client/tests/headers.cc index f96c6f0028d8d..e0b77e043a9c8 100644 --- a/test/core/bad_client/tests/headers.cc +++ b/test/core/bad_client/tests/headers.cc @@ -27,7 +27,7 @@ static void verifier(grpc_server* server, grpc_completion_queue* cq, void* registered_method) { while (grpc_server_has_open_connections(server)) { GPR_ASSERT(grpc_completion_queue_next( - cq, grpc_timeout_milliseconds_to_deadline(20), NULL) + cq, grpc_timeout_milliseconds_to_deadline(20), nullptr) .type == GRPC_QUEUE_TIMEOUT); } } @@ -36,275 +36,275 @@ int main(int argc, char** argv) { grpc_test_init(argc, argv); /* partial http2 header prefixes */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00", + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x00", + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x00\x00", + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x00\x00\x01", + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x01", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x00\x00\x01\x00", + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x01\x00", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x00\x00\x01\x04", + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x01\x04", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x00\x00\x01\x05", + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x01\x05", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x00\x00\x01\x04\x00", + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x01\x04\x00", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x01\x04\x00\x00", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x01\x04\x00\x00\x00", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x01\x04\x00\x00\x00\x00", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x01\x04\x00\x00\x00\x01", GRPC_BAD_CLIENT_DISCONNECT); /* test adding prioritization data */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x01\x01\x24\x00\x00\x00\x01" "\x00", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x02\x01\x24\x00\x00\x00\x01" "\x00\x00", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x03\x01\x24\x00\x00\x00\x01" "\x00\x00\x00", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x04\x01\x24\x00\x00\x00\x01" "\x00\x00\x00\x00", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x05\x01\x24\x00\x00\x00\x01" "", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x05\x01\x24\x00\x00\x00\x01" "\x00", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x05\x01\x24\x00\x00\x00\x01" "\x00\x00", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x05\x01\x24\x00\x00\x00\x01" "\x00\x00\x00", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x05\x01\x24\x00\x00\x00\x01" "\x00\x00\x00\x00", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x05\x01\x24\x00\x00\x00\x01" "\x00\x00\x00\x00\x00", GRPC_BAD_CLIENT_DISCONNECT); /* test looking up an invalid index */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x01\x01\x04\x00\x00\x00\x01" "\xfe", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x04\x01\x04\x00\x00\x00\x01" "\x7f\x7f\x01" "a", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x04\x01\x04\x00\x00\x00\x01" "\x0f\x7f\x01" "a", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x04\x01\x04\x00\x00\x00\x01" "\x1f\x7f\x01" "a", 0); /* test nvr, not indexed in static table */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x03\x01\x04\x00\x00\x00\x01" "\x01\x01" "a", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x03\x01\x04\x00\x00\x00\x01" "\x11\x01" "a", GRPC_BAD_CLIENT_DISCONNECT); /* illegal op code */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x01\x01\x04\x00\x00\x00\x01" "\x80", 0); /* parse some long indices */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x02\x01\x04\x00\x00\x00\x01" "\xff\x00", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x03\x01\x04\x00\x00\x00\x01" "\xff\x80\x00", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x04\x01\x04\x00\x00\x00\x01" "\xff\x80\x80\x00", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x05\x01\x04\x00\x00\x00\x01" "\xff\x80\x80\x80\x00", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x06\x01\x04\x00\x00\x00\x01" "\xff\x80\x80\x80\x80\x00", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x07\x01\x04\x00\x00\x00\x01" "\xff\x80\x80\x80\x80\x80\x00", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x08\x01\x04\x00\x00\x00\x01" "\xff", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x08\x01\x04\x00\x00\x00\x01" "\xff\x80", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x08\x01\x04\x00\x00\x00\x01" "\xff\x80\x80", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x08\x01\x04\x00\x00\x00\x01" "\xff\x80\x80\x80", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x08\x01\x04\x00\x00\x00\x01" "\xff\x80\x80\x80\x80", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x08\x01\x04\x00\x00\x00\x01" "\xff\x80\x80\x80\x80\x80", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x08\x01\x04\x00\x00\x00\x01" "\xff\x80\x80\x80\x80\x80\x80", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x08\x01\x04\x00\x00\x00\x01" "\xff\x80\x80\x80\x80\x80\x80\x00", 0); /* overflow on byte 4 */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x06\x01\x04\x00\x00\x00\x01" "\xff\x80\x80\x80\x80\x7f", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x06\x01\x04\x00\x00\x00\x01" "\xff\xff\xff\xff\xff\x0f", GRPC_BAD_CLIENT_DISCONNECT); /* overflow after byte 4 */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x08\x01\x04\x00\x00\x00\x01" "\xff\x80\x80\x80\x80\x80\x80\x02", 0); /* end of headers mid-opcode */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x01\x01\x04\x00\x00\x00\x01" "\x01", GRPC_BAD_CLIENT_DISCONNECT); /* dynamic table size update: set to default */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x03\x01\x04\x00\x00\x00\x01" "\x3f\xe1\x1f", GRPC_BAD_CLIENT_DISCONNECT); /* dynamic table size update: set too large */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x03\x01\x04\x00\x00\x00\x01" "\x3f\xf1\x1f", 0); /* dynamic table size update: set twice */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x04\x01\x04\x00\x00\x00\x01" "\x20\x3f\xe1\x1f", GRPC_BAD_CLIENT_DISCONNECT); /* dynamic table size update: set thrice */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x03\x01\x04\x00\x00\x00\x01" "\x20\x20\x20", 0); /* non-ending header followed by continuation frame */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x01\x00\x00\x00\x00\x01" "\x00\x00\x00\x09\x04\x00\x00\x00\x01", GRPC_BAD_CLIENT_DISCONNECT); /* non-ending header followed by non-continuation frame */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x01\x00\x00\x00\x00\x01" "\x00\x00\x00\x00\x04\x00\x00\x00\x01", 0); /* non-ending header followed by a continuation frame for a different stream */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x01\x04\x00\x00\x00\x01" "\x00\x00\x00\x01\x00\x00\x00\x00\x03" "\x00\x00\x00\x09\x04\x00\x00\x00\x01", 0); /* opening with a continuation frame */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x09\x04\x00\x00\x00\x01", 0); /* three header frames */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x01\x04\x00\x00\x00\x01" "\x00\x00\x00\x01\x04\x00\x00\x00\x01" @@ -312,19 +312,19 @@ int main(int argc, char** argv) { GRPC_BAD_CLIENT_DISCONNECT); /* an invalid header found with fuzzing */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x01\x39\x67\xed\x1d\x64", GRPC_BAD_CLIENT_DISCONNECT); /* a badly encoded timeout value */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x19\x01\x04\x00\x00\x00\x01" "\x10\x0cgrpc-timeout\x0a" "15 seconds", GRPC_BAD_CLIENT_DISCONNECT); /* a badly encoded timeout value: twice (catches caching) */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x19\x01\x04\x00\x00\x00\x01" "\x10\x0cgrpc-timeout\x0a" diff --git a/test/core/bad_client/tests/initial_settings_frame.cc b/test/core/bad_client/tests/initial_settings_frame.cc index dde9d4b5d3722..4a01c9ee3ef66 100644 --- a/test/core/bad_client/tests/initial_settings_frame.cc +++ b/test/core/bad_client/tests/initial_settings_frame.cc @@ -26,7 +26,7 @@ static void verifier(grpc_server* server, grpc_completion_queue* cq, void* registered_method) { while (grpc_server_has_open_connections(server)) { GPR_ASSERT(grpc_completion_queue_next( - cq, grpc_timeout_milliseconds_to_deadline(20), NULL) + cq, grpc_timeout_milliseconds_to_deadline(20), nullptr) .type == GRPC_QUEUE_TIMEOUT); } } @@ -35,73 +35,73 @@ int main(int argc, char** argv) { grpc_test_init(argc, argv); /* various partial prefixes */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00", + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x00", + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x00\x00", + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x06", + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x06", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x06", + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x06", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x00\x06", + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x06", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x00\x00\x04", + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x04", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x00\x00\x04\x00", + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x04\x00", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x00\x00\x04\x01", + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x04\x01", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x00\x00\x04\xff", + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x04\xff", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR "\x00\x00\x00\x04\x00\x00", + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x04\x00\x00", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x04\x00\x00\x00", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x04\x00\x00\x00\x00", GRPC_BAD_CLIENT_DISCONNECT); /* must not send frames with stream id != 0 */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x04\x00\x00\x00\x00\x01", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x04\x00\x40\x00\x00\x00", 0); /* settings frame must be a multiple of six bytes long */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x01\x04\x00\x00\x00\x00\x00", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x02\x04\x00\x00\x00\x00\x00", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x03\x04\x00\x00\x00\x00\x00", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x04\x04\x00\x00\x00\x00\x00", 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x05\x04\x00\x00\x00\x00\x00", 0); /* some settings values are illegal */ /* max frame size = 0 */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR ONE_SETTING_HDR "\x00\x05\x00\x00\x00\x00", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR ONE_SETTING_HDR "\x00\x06\xff\xff\xff\xff", GRPC_BAD_CLIENT_DISCONNECT); /* update intiial window size */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR ONE_SETTING_HDR "\x00\x04\x00\x01\x00\x00", GRPC_BAD_CLIENT_DISCONNECT); /* ack with data */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x04\x00\x00\x00\x00\x00" "\x00\x00\x01\x04\x01\x00\x00\x00\x00", 0); /* settings frame with invalid flags */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x04\x10\x00\x00\x00\x00", 0); /* unknown settings should be ignored */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR ONE_SETTING_HDR "\x00\x99\x00\x00\x00\x00", GRPC_BAD_CLIENT_DISCONNECT); diff --git a/test/core/bad_client/tests/large_metadata.cc b/test/core/bad_client/tests/large_metadata.cc index df7dd8f4b3aa3..1ce0f28967cd5 100644 --- a/test/core/bad_client/tests/large_metadata.cc +++ b/test/core/bad_client/tests/large_metadata.cc @@ -154,8 +154,8 @@ static void server_verifier_sends_too_much_metadata(grpc_server* server, op.data.send_initial_metadata.count = 1; op.data.send_initial_metadata.metadata = &meta; op.flags = 0; - op.reserved = NULL; - error = grpc_call_start_batch(s, &op, 1, tag(102), NULL); + op.reserved = nullptr; + error = grpc_call_start_batch(s, &op, 1, tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 0); // Operation fails. cq_verify(cqv); diff --git a/test/core/bad_client/tests/server_registered_method.cc b/test/core/bad_client/tests/server_registered_method.cc index b1b11235de90b..6613c94b419fa 100644 --- a/test/core/bad_client/tests/server_registered_method.cc +++ b/test/core/bad_client/tests/server_registered_method.cc @@ -47,7 +47,7 @@ static void verifier_succeeds(grpc_server* server, grpc_completion_queue* cq, cq_verifier* cqv = cq_verifier_create(cq); grpc_metadata_array request_metadata_recv; gpr_timespec deadline; - grpc_byte_buffer* payload = NULL; + grpc_byte_buffer* payload = nullptr; grpc_metadata_array_init(&request_metadata_recv); @@ -58,7 +58,7 @@ static void verifier_succeeds(grpc_server* server, grpc_completion_queue* cq, CQ_EXPECT_COMPLETION(cqv, tag(101), 1); cq_verify(cqv); - GPR_ASSERT(payload != NULL); + GPR_ASSERT(payload != nullptr); grpc_metadata_array_destroy(&request_metadata_recv); grpc_call_unref(s); @@ -70,7 +70,7 @@ static void verifier_fails(grpc_server* server, grpc_completion_queue* cq, void* registered_method) { while (grpc_server_has_open_connections(server)) { GPR_ASSERT(grpc_completion_queue_next( - cq, grpc_timeout_milliseconds_to_deadline(20), NULL) + cq, grpc_timeout_milliseconds_to_deadline(20), nullptr) .type == GRPC_QUEUE_TIMEOUT); } } @@ -80,45 +80,45 @@ int main(int argc, char** argv) { /* body generated with * tools/codegen/core/gen_server_registered_method_bad_client_test_body.py */ - GRPC_RUN_BAD_CLIENT_TEST(verifier_fails, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier_fails, nullptr, PFX_STR "\x00\x00\x00\x00\x00\x00\x00\x00\x01", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier_fails, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier_fails, nullptr, PFX_STR "\x00\x00\x01\x00\x00\x00\x00\x00\x01\x00", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier_fails, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier_fails, nullptr, PFX_STR "\x00\x00\x02\x00\x00\x00\x00\x00\x01\x00\x00", GRPC_BAD_CLIENT_DISCONNECT); - GRPC_RUN_BAD_CLIENT_TEST(verifier_fails, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier_fails, nullptr, PFX_STR "\x00\x00\x03\x00\x00\x00\x00\x00\x01\x00\x00\x00", GRPC_BAD_CLIENT_DISCONNECT); GRPC_RUN_BAD_CLIENT_TEST( - verifier_fails, NULL, + verifier_fails, nullptr, PFX_STR "\x00\x00\x04\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00", GRPC_BAD_CLIENT_DISCONNECT); GRPC_RUN_BAD_CLIENT_TEST( - verifier_succeeds, NULL, + verifier_succeeds, nullptr, PFX_STR "\x00\x00\x05\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x00", 0); GRPC_RUN_BAD_CLIENT_TEST( - verifier_fails, NULL, + verifier_fails, nullptr, PFX_STR "\x00\x00\x05\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x01", GRPC_BAD_CLIENT_DISCONNECT); GRPC_RUN_BAD_CLIENT_TEST( - verifier_succeeds, NULL, + verifier_succeeds, nullptr, PFX_STR "\x00\x00\x06\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x01\x00", 0); GRPC_RUN_BAD_CLIENT_TEST( - verifier_fails, NULL, + verifier_fails, nullptr, PFX_STR "\x00\x00\x05\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x02", GRPC_BAD_CLIENT_DISCONNECT); GRPC_RUN_BAD_CLIENT_TEST( - verifier_fails, NULL, + verifier_fails, nullptr, PFX_STR "\x00\x00\x06\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x02\x00", GRPC_BAD_CLIENT_DISCONNECT); GRPC_RUN_BAD_CLIENT_TEST( - verifier_succeeds, NULL, + verifier_succeeds, nullptr, PFX_STR "\x00\x00\x07\x00\x01\x00\x00\x00\x01\x00\x00\x00\x00\x02\x00\x00", 0); diff --git a/test/core/bad_client/tests/simple_request.cc b/test/core/bad_client/tests/simple_request.cc index b9cc1e3259516..9f4a03e69b374 100644 --- a/test/core/bad_client/tests/simple_request.cc +++ b/test/core/bad_client/tests/simple_request.cc @@ -115,7 +115,7 @@ static void failure_verifier(grpc_server* server, grpc_completion_queue* cq, void* registered_method) { while (grpc_server_has_open_connections(server)) { GPR_ASSERT(grpc_completion_queue_next( - cq, grpc_timeout_milliseconds_to_deadline(20), NULL) + cq, grpc_timeout_milliseconds_to_deadline(20), nullptr) .type == GRPC_QUEUE_TIMEOUT); } } @@ -124,44 +124,44 @@ int main(int argc, char** argv) { grpc_test_init(argc, argv); /* basic request: check that things are working */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR, 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR_UNUSUAL, 0); - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, PFX_STR_UNUSUAL2, 0); + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR, 0); + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR_UNUSUAL, 0); + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR_UNUSUAL2, 0); /* push an illegal data frame */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x05\x00\x00\x00\x00\x00\x01" "\x34\x00\x00\x00\x00", 0); /* push a data frame with bad flags */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x00\x02\x00\x00\x00\x01", 0); /* push a window update with a bad length */ - GRPC_RUN_BAD_CLIENT_TEST(failure_verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(failure_verifier, nullptr, PFX_STR "\x00\x00\x01\x08\x00\x00\x00\x00\x01", 0); /* push a window update with bad flags */ - GRPC_RUN_BAD_CLIENT_TEST(failure_verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(failure_verifier, nullptr, PFX_STR "\x00\x00\x00\x08\x10\x00\x00\x00\x01", 0); /* push a window update with bad data */ - GRPC_RUN_BAD_CLIENT_TEST(failure_verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(failure_verifier, nullptr, PFX_STR "\x00\x00\x04\x08\x00\x00\x00\x00\x01" "\xff\xff\xff\xff", 0); /* push a short goaway */ - GRPC_RUN_BAD_CLIENT_TEST(failure_verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(failure_verifier, nullptr, PFX_STR "\x00\x00\x04\x07\x00\x00\x00\x00\x00", 0); /* disconnect before sending goaway */ - GRPC_RUN_BAD_CLIENT_TEST(failure_verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(failure_verifier, nullptr, PFX_STR "\x00\x01\x12\x07\x00\x00\x00\x00\x00", GRPC_BAD_CLIENT_DISCONNECT); /* push a rst_stream with a bad length */ - GRPC_RUN_BAD_CLIENT_TEST(failure_verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(failure_verifier, nullptr, PFX_STR "\x00\x00\x01\x03\x00\x00\x00\x00\x01", 0); /* push a rst_stream with bad flags */ - GRPC_RUN_BAD_CLIENT_TEST(failure_verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(failure_verifier, nullptr, PFX_STR "\x00\x00\x00\x03\x10\x00\x00\x00\x01", 0); return 0; diff --git a/test/core/bad_client/tests/unknown_frame.cc b/test/core/bad_client/tests/unknown_frame.cc index b8367a2b659b7..d962a4244d0ff 100644 --- a/test/core/bad_client/tests/unknown_frame.cc +++ b/test/core/bad_client/tests/unknown_frame.cc @@ -27,7 +27,7 @@ static void verifier(grpc_server* server, grpc_completion_queue* cq, void* registered_method) { while (grpc_server_has_open_connections(server)) { GPR_ASSERT(grpc_completion_queue_next( - cq, grpc_timeout_milliseconds_to_deadline(20), NULL) + cq, grpc_timeout_milliseconds_to_deadline(20), nullptr) .type == GRPC_QUEUE_TIMEOUT); } } @@ -36,7 +36,7 @@ int main(int argc, char** argv) { grpc_test_init(argc, argv); /* test adding prioritization data */ - GRPC_RUN_BAD_CLIENT_TEST(verifier, NULL, + GRPC_RUN_BAD_CLIENT_TEST(verifier, nullptr, PFX_STR "\x00\x00\x00\x88\x00\x00\x00\x00\x01", GRPC_BAD_CLIENT_DISCONNECT); diff --git a/test/core/bad_client/tests/window_overflow.cc b/test/core/bad_client/tests/window_overflow.cc index cb4b790de20e5..f4bd81828be1f 100644 --- a/test/core/bad_client/tests/window_overflow.cc +++ b/test/core/bad_client/tests/window_overflow.cc @@ -46,7 +46,7 @@ static void verifier(grpc_server* server, grpc_completion_queue* cq, void* registered_method) { while (grpc_server_has_open_connections(server)) { GPR_ASSERT(grpc_completion_queue_next( - cq, grpc_timeout_milliseconds_to_deadline(20), NULL) + cq, grpc_timeout_milliseconds_to_deadline(20), nullptr) .type == GRPC_QUEUE_TIMEOUT); } } @@ -90,7 +90,7 @@ int main(int argc, char** argv) { addbuf(message, sizeof(message)); } } - grpc_run_bad_client_test(verifier, NULL, g_buffer, g_count, + grpc_run_bad_client_test(verifier, nullptr, g_buffer, g_count, GRPC_BAD_CLIENT_LARGE_REQUEST); gpr_free(g_buffer); diff --git a/test/core/bad_ssl/bad_ssl_test.cc b/test/core/bad_ssl/bad_ssl_test.cc index 3cfa2a4a2b171..0e74a62f1928a 100644 --- a/test/core/bad_ssl/bad_ssl_test.cc +++ b/test/core/bad_ssl/bad_ssl_test.cc @@ -36,7 +36,7 @@ static void* tag(intptr_t t) { return (void*)t; } static void run_test(const char* target, size_t nops) { grpc_channel_credentials* ssl_creds = - grpc_ssl_credentials_create(NULL, NULL, NULL); + grpc_ssl_credentials_create(nullptr, nullptr, nullptr); grpc_channel* channel; grpc_call* c; @@ -46,7 +46,7 @@ static void run_test(const char* target, size_t nops) { grpc_status_code status; grpc_call_error error; gpr_timespec deadline = grpc_timeout_seconds_to_deadline(5); - grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL); + grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr); cq_verifier* cqv = cq_verifier_create(cq); grpc_op ops[6]; @@ -64,36 +64,36 @@ static void run_test(const char* target, size_t nops) { grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&trailing_metadata_recv); - channel = grpc_secure_channel_create(ssl_creds, target, &args, NULL); + channel = grpc_secure_channel_create(ssl_creds, target, &args, nullptr); grpc_slice host = grpc_slice_from_static_string("foo.test.google.fr:1234"); - c = grpc_channel_create_call(channel, NULL, GRPC_PROPAGATE_DEFAULTS, cq, + c = grpc_channel_create_call(channel, nullptr, GRPC_PROPAGATE_DEFAULTS, cq, grpc_slice_from_static_string("/foo"), &host, - deadline, NULL); + deadline, nullptr); memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = GRPC_INITIAL_METADATA_WAIT_FOR_READY; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, nops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, nops, tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(1), 1); diff --git a/test/core/bad_ssl/server_common.cc b/test/core/bad_ssl/server_common.cc index 0110ed5ad2731..068d707306516 100644 --- a/test/core/bad_ssl/server_common.cc +++ b/test/core/bad_ssl/server_common.cc @@ -34,7 +34,7 @@ static void sigint_handler(int x) { got_sigint = 1; } const char* bad_ssl_addr(int argc, char** argv) { gpr_cmdline* cl; - const char* addr = NULL; + const char* addr = nullptr; cl = gpr_cmdline_create("test server"); gpr_cmdline_add_string(cl, "bind", "Bind host:port", &addr); gpr_cmdline_parse(cl, argc, argv); @@ -48,17 +48,17 @@ void bad_ssl_run(grpc_server* server) { int shutdown_finished = 0; grpc_event ev; grpc_call_error error; - grpc_call* s = NULL; + grpc_call* s = nullptr; grpc_call_details call_details; grpc_metadata_array request_metadata_recv; - grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL); + grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr); grpc_completion_queue* shutdown_cq; grpc_call_details_init(&call_details); grpc_metadata_array_init(&request_metadata_recv); - grpc_server_register_completion_queue(server, cq, NULL); + grpc_server_register_completion_queue(server, cq, nullptr); grpc_server_start(server); error = grpc_server_request_call(server, &s, &call_details, @@ -69,11 +69,11 @@ void bad_ssl_run(grpc_server* server) { while (!shutdown_finished) { if (got_sigint && !shutdown_started) { gpr_log(GPR_INFO, "Shutting down due to SIGINT"); - shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); - grpc_server_shutdown_and_notify(server, shutdown_cq, NULL); + shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr); + grpc_server_shutdown_and_notify(server, shutdown_cq, nullptr); GPR_ASSERT( - grpc_completion_queue_pluck(shutdown_cq, NULL, - grpc_timeout_seconds_to_deadline(5), NULL) + grpc_completion_queue_pluck(shutdown_cq, nullptr, + grpc_timeout_seconds_to_deadline(5), nullptr) .type == GRPC_OP_COMPLETE); grpc_completion_queue_destroy(shutdown_cq); grpc_completion_queue_shutdown(cq); @@ -83,7 +83,7 @@ void bad_ssl_run(grpc_server* server) { cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_micros(1000000, GPR_TIMESPAN)), - NULL); + nullptr); switch (ev.type) { case GRPC_OP_COMPLETE: GPR_ASSERT(ev.tag == (void*)1); @@ -98,7 +98,7 @@ void bad_ssl_run(grpc_server* server) { } } - GPR_ASSERT(s == NULL); + GPR_ASSERT(s == nullptr); grpc_call_details_destroy(&call_details); grpc_metadata_array_destroy(&request_metadata_recv); } diff --git a/test/core/bad_ssl/servers/alpn.cc b/test/core/bad_ssl/servers/alpn.cc index a207516a72fe4..591f0f2eefe1b 100644 --- a/test/core/bad_ssl/servers/alpn.cc +++ b/test/core/bad_ssl/servers/alpn.cc @@ -59,8 +59,8 @@ int main(int argc, char** argv) { grpc_init(); ssl_creds = - grpc_ssl_server_credentials_create(NULL, &pem_key_cert_pair, 1, 0, NULL); - server = grpc_server_create(NULL, NULL); + grpc_ssl_server_credentials_create(nullptr, &pem_key_cert_pair, 1, 0, nullptr); + server = grpc_server_create(nullptr, nullptr); GPR_ASSERT(grpc_server_add_secure_http2_port(server, addr, ssl_creds)); grpc_server_credentials_release(ssl_creds); diff --git a/test/core/bad_ssl/servers/cert.cc b/test/core/bad_ssl/servers/cert.cc index 4a8ac93452483..49895d902d1d4 100644 --- a/test/core/bad_ssl/servers/cert.cc +++ b/test/core/bad_ssl/servers/cert.cc @@ -50,8 +50,8 @@ int main(int argc, char** argv) { pem_key_cert_pair.cert_chain = (const char*)GRPC_SLICE_START_PTR(cert_slice); ssl_creds = - grpc_ssl_server_credentials_create(NULL, &pem_key_cert_pair, 1, 0, NULL); - server = grpc_server_create(NULL, NULL); + grpc_ssl_server_credentials_create(nullptr, &pem_key_cert_pair, 1, 0, nullptr); + server = grpc_server_create(nullptr, nullptr); GPR_ASSERT(grpc_server_add_secure_http2_port(server, addr, ssl_creds)); grpc_server_credentials_release(ssl_creds); diff --git a/test/core/channel/channel_args_test.cc b/test/core/channel/channel_args_test.cc index 4b4bd3e718ece..e8b33341851fb 100644 --- a/test/core/channel/channel_args_test.cc +++ b/test/core/channel/channel_args_test.cc @@ -43,7 +43,7 @@ static void test_create(void) { to_add[0] = arg_int; to_add[1] = arg_string; - ch_args = grpc_channel_args_copy_and_add(NULL, to_add, 2); + ch_args = grpc_channel_args_copy_and_add(nullptr, to_add, 2); GPR_ASSERT(ch_args->num_args == 2); GPR_ASSERT(strcmp(ch_args->args[0].key, arg_int.key) == 0); @@ -64,7 +64,7 @@ static void test_set_compression_algorithm(void) { grpc_channel_args* ch_args; ch_args = - grpc_channel_args_set_compression_algorithm(NULL, GRPC_COMPRESS_GZIP); + grpc_channel_args_set_compression_algorithm(nullptr, GRPC_COMPRESS_GZIP); GPR_ASSERT(ch_args->num_args == 1); GPR_ASSERT(strcmp(ch_args->args[0].key, GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM) == 0); @@ -80,7 +80,7 @@ static void test_compression_algorithm_states(void) { unsigned states_bitset; size_t i; - ch_args = grpc_channel_args_copy_and_add(NULL, NULL, 0); + ch_args = grpc_channel_args_copy_and_add(nullptr, nullptr, 0); /* by default, all enabled */ states_bitset = (unsigned)grpc_channel_args_compression_algorithm_get_states(ch_args); @@ -129,9 +129,9 @@ static void test_compression_algorithm_states(void) { static void test_set_socket_mutator(void) { grpc_channel_args* ch_args; grpc_socket_mutator mutator; - grpc_socket_mutator_init(&mutator, NULL); + grpc_socket_mutator_init(&mutator, nullptr); - ch_args = grpc_channel_args_set_socket_mutator(NULL, &mutator); + ch_args = grpc_channel_args_set_socket_mutator(nullptr, &mutator); GPR_ASSERT(ch_args->num_args == 1); GPR_ASSERT(strcmp(ch_args->args[0].key, GRPC_ARG_SOCKET_MUTATOR) == 0); GPR_ASSERT(ch_args->args[0].type == GRPC_ARG_POINTER); diff --git a/test/core/channel/channel_stack_builder_test.cc b/test/core/channel/channel_stack_builder_test.cc index 1571f6ec0966b..a67f0efafebe9 100644 --- a/test/core/channel/channel_stack_builder_test.cc +++ b/test/core/channel/channel_stack_builder_test.cc @@ -71,8 +71,8 @@ void set_arg_once_fn(grpc_channel_stack* channel_stack, static void test_channel_stack_builder_filter_replace(void) { grpc_channel* channel = - grpc_insecure_channel_create("target name isn't used", NULL, NULL); - GPR_ASSERT(channel != NULL); + grpc_insecure_channel_create("target name isn't used", nullptr, nullptr); + GPR_ASSERT(channel != nullptr); // Make sure the high priority filter has been created. GPR_ASSERT(g_replacement_fn_called); // ... and that the low priority one hasn't. diff --git a/test/core/channel/channel_stack_test.cc b/test/core/channel/channel_stack_test.cc index 1b661ac2f4268..988ea9bac9d25 100644 --- a/test/core/channel/channel_stack_test.cc +++ b/test/core/channel/channel_stack_test.cc @@ -74,8 +74,8 @@ static void free_channel(grpc_exec_ctx* exec_ctx, void* arg, } static void free_call(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) { - grpc_call_stack_destroy(exec_ctx, static_cast(arg), NULL, - NULL); + grpc_call_stack_destroy(exec_ctx, static_cast(arg), nullptr, + nullptr); gpr_free(arg); } @@ -114,7 +114,7 @@ static void test_create_channel_stack(void) { channel_stack = static_cast( gpr_malloc(grpc_channel_stack_size(&filters, 1))); grpc_channel_stack_init(&exec_ctx, 1, free_channel, channel_stack, &filters, - 1, &chan_args, NULL, "test", channel_stack); + 1, &chan_args, nullptr, "test", channel_stack); GPR_ASSERT(channel_stack->count == 1); channel_elem = grpc_channel_stack_element(channel_stack, 0); channel_data = (int*)channel_elem->channel_data; diff --git a/test/core/channel/minimal_stack_is_minimal_test.cc b/test/core/channel/minimal_stack_is_minimal_test.cc index c54ff2e01b76b..f6d7339ea1485 100644 --- a/test/core/channel/minimal_stack_is_minimal_test.cc +++ b/test/core/channel/minimal_stack_is_minimal_test.cc @@ -79,26 +79,26 @@ int main(int argc, char** argv) { "http-client", "connected", NULL); errors += CHECK_STACK("chttp2", &minimal_stack_args, GRPC_SERVER_CHANNEL, "server", "http-server", "connected", NULL); - errors += CHECK_STACK(NULL, &minimal_stack_args, GRPC_CLIENT_CHANNEL, + errors += CHECK_STACK(nullptr, &minimal_stack_args, GRPC_CLIENT_CHANNEL, "client-channel", NULL); // tests with a default stack - errors += CHECK_STACK("unknown", NULL, GRPC_CLIENT_DIRECT_CHANNEL, + errors += CHECK_STACK("unknown", nullptr, GRPC_CLIENT_DIRECT_CHANNEL, "message_size", "deadline", "connected", NULL); - errors += CHECK_STACK("unknown", NULL, GRPC_CLIENT_SUBCHANNEL, "message_size", + errors += CHECK_STACK("unknown", nullptr, GRPC_CLIENT_SUBCHANNEL, "message_size", "connected", NULL); - errors += CHECK_STACK("unknown", NULL, GRPC_SERVER_CHANNEL, "server", + errors += CHECK_STACK("unknown", nullptr, GRPC_SERVER_CHANNEL, "server", "message_size", "deadline", "connected", NULL); - errors += CHECK_STACK("chttp2", NULL, GRPC_CLIENT_DIRECT_CHANNEL, + errors += CHECK_STACK("chttp2", nullptr, GRPC_CLIENT_DIRECT_CHANNEL, "message_size", "deadline", "http-client", "message_compress", "connected", NULL); - errors += CHECK_STACK("chttp2", NULL, GRPC_CLIENT_SUBCHANNEL, "message_size", + errors += CHECK_STACK("chttp2", nullptr, GRPC_CLIENT_SUBCHANNEL, "message_size", "http-client", "message_compress", "connected", NULL); - errors += CHECK_STACK("chttp2", NULL, GRPC_SERVER_CHANNEL, "server", + errors += CHECK_STACK("chttp2", nullptr, GRPC_SERVER_CHANNEL, "server", "message_size", "deadline", "http-server", "message_compress", "connected", NULL); errors += - CHECK_STACK(NULL, NULL, GRPC_CLIENT_CHANNEL, "client-channel", NULL); + CHECK_STACK(nullptr, nullptr, GRPC_CLIENT_CHANNEL, "client-channel", NULL); GPR_ASSERT(errors == 0); grpc_shutdown(); @@ -120,7 +120,7 @@ static int check_stack(const char* file, int line, const char* transport_name, grpc_transport fake_transport = {&fake_transport_vtable}; grpc_channel_stack_builder_set_target(builder, "foo.test.google.fr"); grpc_channel_args* channel_args = grpc_channel_args_copy(init_args); - if (transport_name != NULL) { + if (transport_name != nullptr) { grpc_channel_stack_builder_set_transport(builder, &fake_transport); } { @@ -139,12 +139,12 @@ static int check_stack(const char* file, int line, const char* transport_name, va_start(args, channel_stack_type); for (;;) { char* a = va_arg(args, char*); - if (a == NULL) break; + if (a == nullptr) break; if (v.count != 0) gpr_strvec_add(&v, gpr_strdup(", ")); gpr_strvec_add(&v, gpr_strdup(a)); } va_end(args); - char* expect = gpr_strvec_flatten(&v, NULL); + char* expect = gpr_strvec_flatten(&v, nullptr); gpr_strvec_destroy(&v); // build up our "got" list @@ -153,11 +153,11 @@ static int check_stack(const char* file, int line, const char* transport_name, grpc_channel_stack_builder_create_iterator_at_first(builder); while (grpc_channel_stack_builder_move_next(it)) { const char* name = grpc_channel_stack_builder_iterator_filter_name(it); - if (name == NULL) continue; + if (name == nullptr) continue; if (v.count != 0) gpr_strvec_add(&v, gpr_strdup(", ")); gpr_strvec_add(&v, gpr_strdup(name)); } - char* got = gpr_strvec_flatten(&v, NULL); + char* got = gpr_strvec_flatten(&v, nullptr); gpr_strvec_destroy(&v); grpc_channel_stack_builder_iterator_destroy(it); @@ -189,7 +189,7 @@ static int check_stack(const char* file, int line, const char* transport_name, } } gpr_strvec_add(&v, gpr_strdup("}")); - char* args_str = gpr_strvec_flatten(&v, NULL); + char* args_str = gpr_strvec_flatten(&v, nullptr); gpr_strvec_destroy(&v); gpr_log(file, line, GPR_LOG_SEVERITY_ERROR, diff --git a/test/core/client_channel/lb_policies_test.cc b/test/core/client_channel/lb_policies_test.cc index 3b907487b745f..486ad2c212103 100644 --- a/test/core/client_channel/lb_policies_test.cc +++ b/test/core/client_channel/lb_policies_test.cc @@ -126,19 +126,19 @@ static gpr_timespec n_millis_time(int n) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, n_millis_time(5000), NULL); + ev = grpc_completion_queue_next(cq, n_millis_time(5000), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void kill_server(const servers_fixture* f, size_t i) { gpr_log(GPR_INFO, "KILLING SERVER %" PRIuPTR, i); - GPR_ASSERT(f->servers[i] != NULL); + GPR_ASSERT(f->servers[i] != nullptr); grpc_server_shutdown_and_notify(f->servers[i], f->shutdown_cq, tag(10000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(10000), - n_millis_time(5000), NULL) + n_millis_time(5000), nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->servers[i]); - f->servers[i] = NULL; + f->servers[i] = nullptr; } typedef struct request_data { @@ -153,12 +153,12 @@ static void revive_server(const servers_fixture* f, request_data* rdata, size_t i) { int got_port; gpr_log(GPR_INFO, "RAISE AGAIN SERVER %" PRIuPTR, i); - GPR_ASSERT(f->servers[i] == NULL); + GPR_ASSERT(f->servers[i] == nullptr); gpr_log(GPR_DEBUG, "revive: %s", f->servers_hostports[i]); - f->servers[i] = grpc_server_create(NULL, NULL); - grpc_server_register_completion_queue(f->servers[i], f->cq, NULL); + f->servers[i] = grpc_server_create(nullptr, nullptr); + grpc_server_register_completion_queue(f->servers[i], f->cq, nullptr); GPR_ASSERT((got_port = grpc_server_add_insecure_http2_port( f->servers[i], f->servers_hostports[i])) > 0); grpc_server_start(f->servers[i]); @@ -187,13 +187,13 @@ static servers_fixture* setup_servers(const char* server_host, gpr_malloc(sizeof(grpc_server*) * num_servers)); f->servers_hostports = static_cast(gpr_malloc(sizeof(char*) * num_servers)); - f->cq = grpc_completion_queue_create_for_next(NULL); - f->shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); + f->cq = grpc_completion_queue_create_for_next(nullptr); + f->shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr); for (i = 0; i < num_servers; i++) { grpc_metadata_array_init(&f->request_metadata_recv[i]); gpr_join_host_port(&f->servers_hostports[i], server_host, grpc_pick_unused_port_or_die()); - f->servers[i] = 0; + f->servers[i] = nullptr; revive_server(f, rdata, i); } return f; @@ -203,10 +203,10 @@ static void teardown_servers(servers_fixture* f) { size_t i; /* Destroy server. */ for (i = 0; i < f->num_servers; i++) { - if (f->servers[i] == NULL) continue; + if (f->servers[i] == nullptr) continue; grpc_server_shutdown_and_notify(f->servers[i], f->shutdown_cq, tag(10000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(10000), - n_millis_time(5000), NULL) + n_millis_time(5000), nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->servers[i]); } @@ -286,9 +286,9 @@ static request_sequences perform_request(servers_fixture* f, memset(s_valid, 0, f->num_servers * sizeof(int)); grpc_slice host = grpc_slice_from_static_string("foo.test.google.fr"); - c = grpc_channel_create_call(client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq, + c = grpc_channel_create_call(client, nullptr, GRPC_PROPAGATE_DEFAULTS, f->cq, grpc_slice_from_static_string("/foo"), &host, - gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); GPR_ASSERT(c); completed_client = 0; @@ -297,17 +297,17 @@ static request_sequences perform_request(servers_fixture* f, 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_SEND_CLOSE_FROM_CLIENT; 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 = &rdata->initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = @@ -315,15 +315,15 @@ static request_sequences perform_request(servers_fixture* f, op->data.recv_status_on_client.status = &rdata->status; op->data.recv_status_on_client.status_details = &rdata->details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_OK == - grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL)); + grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr)); s_idx = -1; while ( (ev = grpc_completion_queue_next( - f->cq, grpc_timeout_milliseconds_to_deadline(RETRY_TIMEOUT), NULL)) + f->cq, grpc_timeout_milliseconds_to_deadline(RETRY_TIMEOUT), nullptr)) .type != GRPC_QUEUE_TIMEOUT) { GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); read_tag = ((int)(intptr_t)ev.tag); @@ -352,7 +352,7 @@ static request_sequences perform_request(servers_fixture* f, 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_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -360,16 +360,16 @@ static request_sequences perform_request(servers_fixture* f, grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(f->server_calls[s_idx], ops, (size_t)(op - ops), - tag(102), NULL)); + tag(102), nullptr)); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); if (!completed_client) { @@ -394,7 +394,7 @@ static request_sequences perform_request(servers_fixture* f, &f->request_metadata_recv[s_idx], f->cq, f->cq, tag(1000 + (int)s_idx))); } else { /* no response from server */ - grpc_call_cancel(c, NULL); + grpc_call_cancel(c, nullptr); if (!completed_client) { CQ_EXPECT_COMPLETION(cqv, tag(1), 1); cq_verify(cqv); @@ -403,7 +403,7 @@ static request_sequences perform_request(servers_fixture* f, GPR_ASSERT( grpc_completion_queue_next( - f->cq, grpc_timeout_milliseconds_to_deadline(RETRY_TIMEOUT), NULL) + f->cq, grpc_timeout_milliseconds_to_deadline(RETRY_TIMEOUT), nullptr) .type == GRPC_QUEUE_TIMEOUT); grpc_metadata_array_destroy(&rdata->initial_metadata_recv); @@ -443,22 +443,22 @@ static grpc_call** perform_multirequest(servers_fixture* f, 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_SEND_CLOSE_FROM_CLIENT; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; grpc_slice host = grpc_slice_from_static_string("foo.test.google.fr"); for (i = 0; i < concurrent_calls; i++) { calls[i] = - grpc_channel_create_call(client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq, + grpc_channel_create_call(client, nullptr, GRPC_PROPAGATE_DEFAULTS, f->cq, grpc_slice_from_static_string("/foo"), &host, - gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); GPR_ASSERT(calls[i]); GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(calls[i], ops, (size_t)(op - ops), tag(1), - NULL)); + nullptr)); } return calls; @@ -478,7 +478,7 @@ void run_spec(const test_spec* spec) { /* Create client. */ servers_hostports_str = gpr_strjoin_sep((const char**)f->servers_hostports, - f->num_servers, ",", NULL); + f->num_servers, ",", nullptr); gpr_asprintf(&client_hostport, "ipv4:%s", servers_hostports_str); arg_array[0].type = GRPC_ARG_INTEGER; @@ -491,7 +491,7 @@ void run_spec(const test_spec* spec) { args.num_args = 2; args.args = arg_array; - client = grpc_insecure_channel_create(client_hostport, &args, NULL); + client = grpc_insecure_channel_create(client_hostport, &args, nullptr); gpr_log(GPR_INFO, "Testing '%s' with servers=%s client=%s", spec->description, servers_hostports_str, client_hostport); @@ -517,7 +517,7 @@ static grpc_channel* create_client(const servers_fixture* f) { grpc_channel_args args; servers_hostports_str = gpr_strjoin_sep((const char**)f->servers_hostports, - f->num_servers, ",", NULL); + f->num_servers, ",", nullptr); gpr_asprintf(&client_hostport, "ipv4:%s", servers_hostports_str); arg_array[0].type = GRPC_ARG_INTEGER; @@ -534,7 +534,7 @@ static grpc_channel* create_client(const servers_fixture* f) { args.num_args = GPR_ARRAY_SIZE(arg_array); args.args = arg_array; - client = grpc_insecure_channel_create(client_hostport, &args, NULL); + client = grpc_insecure_channel_create(client_hostport, &args, nullptr); gpr_free(client_hostport); gpr_free(servers_hostports_str); @@ -557,7 +557,7 @@ static void test_ping() { client = create_client(f); - grpc_channel_ping(client, f->cq, tag(0), NULL); + grpc_channel_ping(client, f->cq, tag(0), nullptr); CQ_EXPECT_COMPLETION(cqv, tag(0), 0); /* check that we're still in idle, and start connecting */ @@ -577,7 +577,7 @@ static void test_ping() { } for (i = 1; i <= 5; i++) { - grpc_channel_ping(client, f->cq, tag(i), NULL); + grpc_channel_ping(client, f->cq, tag(i), nullptr); CQ_EXPECT_COMPLETION(cqv, tag(i), 1); cq_verify(cqv); } @@ -604,7 +604,7 @@ static void test_pending_calls(size_t concurrent_calls) { calls = perform_multirequest(f, client, concurrent_calls); grpc_call_cancel( calls[0], - NULL); /* exercise the cancel pick path whilst there are pending picks */ + nullptr); /* exercise the cancel pick path whilst there are pending picks */ gpr_free(rdata.call_details); @@ -621,7 +621,7 @@ static void test_pending_calls(size_t concurrent_calls) { static void test_get_channel_info() { grpc_channel* channel = - grpc_insecure_channel_create("ipv4:127.0.0.1:1234", NULL, NULL); + grpc_insecure_channel_create("ipv4:127.0.0.1:1234", nullptr, nullptr); // Ensures that resolver returns. grpc_channel_check_connectivity_state(channel, true /* try_to_connect */); // First, request no fields. This is a no-op. @@ -629,10 +629,10 @@ static void test_get_channel_info() { memset(&channel_info, 0, sizeof(channel_info)); grpc_channel_get_info(channel, &channel_info); // Request LB policy name. - char* lb_policy_name = NULL; + char* lb_policy_name = nullptr; channel_info.lb_policy_name = &lb_policy_name; grpc_channel_get_info(channel, &channel_info); - GPR_ASSERT(lb_policy_name != NULL); + GPR_ASSERT(lb_policy_name != nullptr); GPR_ASSERT(strcmp(lb_policy_name, "pick_first") == 0); gpr_free(lb_policy_name); // Request service config, which does not exist, so we'll get nothing back. @@ -640,7 +640,7 @@ static void test_get_channel_info() { char* service_config_json = const_cast("dummy_string"); channel_info.service_config_json = &service_config_json; grpc_channel_get_info(channel, &channel_info); - GPR_ASSERT(service_config_json == NULL); + GPR_ASSERT(service_config_json == nullptr); // Recreate the channel such that it has a service config. grpc_channel_destroy(channel); grpc_arg arg; @@ -648,8 +648,8 @@ static void test_get_channel_info() { arg.key = const_cast(GRPC_ARG_SERVICE_CONFIG); arg.value.string = const_cast("{\"loadBalancingPolicy\": \"ROUND_ROBIN\"}"); - grpc_channel_args* args = grpc_channel_args_copy_and_add(NULL, &arg, 1); - channel = grpc_insecure_channel_create("ipv4:127.0.0.1:1234", args, NULL); + grpc_channel_args* args = grpc_channel_args_copy_and_add(nullptr, &arg, 1); + channel = grpc_insecure_channel_create("ipv4:127.0.0.1:1234", args, nullptr); { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_channel_args_destroy(&exec_ctx, args); @@ -659,7 +659,7 @@ static void test_get_channel_info() { grpc_channel_check_connectivity_state(channel, true /* try_to_connect */); // Now request the service config again. grpc_channel_get_info(channel, &channel_info); - GPR_ASSERT(service_config_json != NULL); + GPR_ASSERT(service_config_json != nullptr); GPR_ASSERT(strcmp(service_config_json, arg.value.string) == 0); gpr_free(service_config_json); // Clean up. @@ -884,7 +884,7 @@ static void dump_array(const char* desc, const int* data, const size_t count) { gpr_asprintf(&tmp, " %d", data[i]); gpr_strvec_add(&s, tmp); } - tmp = gpr_strvec_flatten(&s, NULL); + tmp = gpr_strvec_flatten(&s, nullptr); gpr_strvec_destroy(&s); gpr_log(GPR_DEBUG, "%s", tmp); gpr_free(tmp); @@ -970,8 +970,8 @@ int main(int argc, char** argv) { grpc_tracer_set_enabled("round_robin", 1); GPR_ASSERT(grpc_lb_policy_create(&exec_ctx, "this-lb-policy-does-not-exist", - NULL) == NULL); - GPR_ASSERT(grpc_lb_policy_create(&exec_ctx, NULL, NULL) == NULL); + nullptr) == nullptr); + GPR_ASSERT(grpc_lb_policy_create(&exec_ctx, nullptr, nullptr) == nullptr); spec = test_spec_create(NUM_ITERS, NUM_SERVERS); /* everything is fine, all servers stay up the whole time and life's peachy diff --git a/test/core/client_channel/parse_address_test.cc b/test/core/client_channel/parse_address_test.cc index 5ad6c6d015f5f..938cef309e04c 100644 --- a/test/core/client_channel/parse_address_test.cc +++ b/test/core/client_channel/parse_address_test.cc @@ -62,7 +62,7 @@ static void test_grpc_parse_ipv4(const char* uri_text, const char* host, GPR_ASSERT(1 == grpc_parse_ipv4(uri, &addr)); struct sockaddr_in* addr_in = (struct sockaddr_in*)addr.addr; GPR_ASSERT(AF_INET == addr_in->sin_family); - GPR_ASSERT(NULL != grpc_inet_ntop(AF_INET, &addr_in->sin_addr, ntop_buf, + GPR_ASSERT(nullptr != grpc_inet_ntop(AF_INET, &addr_in->sin_addr, ntop_buf, sizeof(ntop_buf))); GPR_ASSERT(0 == strcmp(ntop_buf, host)); GPR_ASSERT(ntohs(addr_in->sin_port) == port); @@ -81,7 +81,7 @@ static void test_grpc_parse_ipv6(const char* uri_text, const char* host, GPR_ASSERT(1 == grpc_parse_ipv6(uri, &addr)); struct sockaddr_in6* addr_in6 = (struct sockaddr_in6*)addr.addr; GPR_ASSERT(AF_INET6 == addr_in6->sin6_family); - GPR_ASSERT(NULL != grpc_inet_ntop(AF_INET6, &addr_in6->sin6_addr, ntop_buf, + GPR_ASSERT(nullptr != grpc_inet_ntop(AF_INET6, &addr_in6->sin6_addr, ntop_buf, sizeof(ntop_buf))); GPR_ASSERT(0 == strcmp(ntop_buf, host)); GPR_ASSERT(ntohs(addr_in6->sin6_port) == port); diff --git a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc index a388b826cf22c..f377abc26956b 100644 --- a/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc +++ b/test/core/client_channel/resolvers/dns_resolver_connectivity_test.cc @@ -72,11 +72,11 @@ static grpc_ares_request* my_dns_lookup_ares( error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Forced Failure"); } else { gpr_mu_unlock(&g_mu); - *lb_addrs = grpc_lb_addresses_create(1, NULL); - grpc_lb_addresses_set_address(*lb_addrs, 0, NULL, 0, false, NULL, NULL); + *lb_addrs = grpc_lb_addresses_create(1, nullptr); + grpc_lb_addresses_set_address(*lb_addrs, 0, nullptr, 0, false, nullptr, nullptr); } GRPC_CLOSURE_SCHED(exec_ctx, on_done, error); - return NULL; + return nullptr; } static grpc_resolver* create_resolver(grpc_exec_ctx* exec_ctx, @@ -107,7 +107,7 @@ static bool wait_loop(int deadline_seconds, gpr_event* ev) { deadline_seconds--; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_timer_check(&exec_ctx, NULL); + grpc_timer_check(&exec_ctx, nullptr); grpc_exec_ctx_finish(&exec_ctx); } return false; @@ -161,7 +161,7 @@ int main(int argc, char** argv) { GRPC_CLOSURE_CREATE(on_done, &ev1, grpc_schedule_on_exec_ctx)); grpc_exec_ctx_flush(&exec_ctx); GPR_ASSERT(wait_loop(5, &ev1)); - GPR_ASSERT(result == NULL); + GPR_ASSERT(result == nullptr); gpr_event ev2; gpr_event_init(&ev2); @@ -170,7 +170,7 @@ int main(int argc, char** argv) { GRPC_CLOSURE_CREATE(on_done, &ev2, grpc_schedule_on_exec_ctx)); grpc_exec_ctx_flush(&exec_ctx); GPR_ASSERT(wait_loop(30, &ev2)); - GPR_ASSERT(result != NULL); + GPR_ASSERT(result != nullptr); grpc_channel_args_destroy(&exec_ctx, result); GRPC_RESOLVER_UNREF(&exec_ctx, resolver, "test"); diff --git a/test/core/client_channel/resolvers/dns_resolver_test.cc b/test/core/client_channel/resolvers/dns_resolver_test.cc index ef3c1b8216ddf..4c040caeb92a5 100644 --- a/test/core/client_channel/resolvers/dns_resolver_test.cc +++ b/test/core/client_channel/resolvers/dns_resolver_test.cc @@ -39,7 +39,7 @@ static void test_succeeds(grpc_resolver_factory* factory, const char* string) { args.uri = uri; args.combiner = g_combiner; resolver = grpc_resolver_factory_create_resolver(&exec_ctx, factory, &args); - GPR_ASSERT(resolver != NULL); + GPR_ASSERT(resolver != nullptr); GRPC_RESOLVER_UNREF(&exec_ctx, resolver, "test_succeeds"); grpc_uri_destroy(uri); grpc_exec_ctx_finish(&exec_ctx); @@ -57,7 +57,7 @@ static void test_fails(grpc_resolver_factory* factory, const char* string) { args.uri = uri; args.combiner = g_combiner; resolver = grpc_resolver_factory_create_resolver(&exec_ctx, factory, &args); - GPR_ASSERT(resolver == NULL); + GPR_ASSERT(resolver == nullptr); grpc_uri_destroy(uri); grpc_exec_ctx_finish(&exec_ctx); } diff --git a/test/core/client_channel/resolvers/fake_resolver_test.cc b/test/core/client_channel/resolvers/fake_resolver_test.cc index 06e8ebdc88948..d5538e9621752 100644 --- a/test/core/client_channel/resolvers/fake_resolver_test.cc +++ b/test/core/client_channel/resolvers/fake_resolver_test.cc @@ -79,23 +79,23 @@ static void test_fake_resolver() { grpc_fake_resolver_response_generator_create(); grpc_resolver* resolver = build_fake_resolver(&exec_ctx, combiner, response_generator); - GPR_ASSERT(resolver != NULL); + GPR_ASSERT(resolver != nullptr); // Setup expectations. grpc_uri* uris[] = {grpc_uri_parse(&exec_ctx, "ipv4:10.2.1.1:1234", true), grpc_uri_parse(&exec_ctx, "ipv4:127.0.0.1:4321", true)}; const char* balancer_names[] = {"name1", "name2"}; const bool is_balancer[] = {true, false}; - grpc_lb_addresses* addresses = grpc_lb_addresses_create(3, NULL); + grpc_lb_addresses* addresses = grpc_lb_addresses_create(3, nullptr); for (size_t i = 0; i < GPR_ARRAY_SIZE(uris); ++i) { grpc_lb_addresses_set_address_from_uri( - addresses, i, uris[i], is_balancer[i], balancer_names[i], NULL); + addresses, i, uris[i], is_balancer[i], balancer_names[i], nullptr); grpc_uri_destroy(uris[i]); } const grpc_arg addresses_arg = grpc_lb_addresses_create_channel_arg(addresses); grpc_channel_args* results = - grpc_channel_args_copy_and_add(NULL, &addresses_arg, 1); + grpc_channel_args_copy_and_add(nullptr, &addresses_arg, 1); grpc_lb_addresses_destroy(&exec_ctx, addresses); on_resolution_arg on_res_arg; memset(&on_res_arg, 0, sizeof(on_res_arg)); @@ -112,25 +112,25 @@ static void test_fake_resolver() { on_resolution); grpc_exec_ctx_flush(&exec_ctx); GPR_ASSERT(gpr_event_wait(&on_res_arg.ev, - grpc_timeout_seconds_to_deadline(5)) != NULL); + grpc_timeout_seconds_to_deadline(5)) != nullptr); // Setup update. grpc_uri* uris_update[] = { grpc_uri_parse(&exec_ctx, "ipv4:192.168.1.0:31416", true)}; const char* balancer_names_update[] = {"name3"}; const bool is_balancer_update[] = {false}; - grpc_lb_addresses* addresses_update = grpc_lb_addresses_create(1, NULL); + grpc_lb_addresses* addresses_update = grpc_lb_addresses_create(1, nullptr); for (size_t i = 0; i < GPR_ARRAY_SIZE(uris_update); ++i) { grpc_lb_addresses_set_address_from_uri(addresses_update, i, uris_update[i], is_balancer_update[i], - balancer_names_update[i], NULL); + balancer_names_update[i], nullptr); grpc_uri_destroy(uris_update[i]); } grpc_arg addresses_update_arg = grpc_lb_addresses_create_channel_arg(addresses_update); grpc_channel_args* results_update = - grpc_channel_args_copy_and_add(NULL, &addresses_update_arg, 1); + grpc_channel_args_copy_and_add(nullptr, &addresses_update_arg, 1); grpc_lb_addresses_destroy(&exec_ctx, addresses_update); // Setup expectations for the update. @@ -148,7 +148,7 @@ static void test_fake_resolver() { &on_res_arg_update.resolver_result, on_resolution); grpc_exec_ctx_flush(&exec_ctx); GPR_ASSERT(gpr_event_wait(&on_res_arg_update.ev, - grpc_timeout_seconds_to_deadline(5)) != NULL); + grpc_timeout_seconds_to_deadline(5)) != nullptr); // Requesting a new resolution without re-senting the response shouldn't // trigger the resolution callback. @@ -158,7 +158,7 @@ static void test_fake_resolver() { grpc_exec_ctx_flush(&exec_ctx); GPR_ASSERT(gpr_event_wait(&on_res_arg.ev, grpc_timeout_milliseconds_to_deadline(100)) == - NULL); + nullptr); GRPC_COMBINER_UNREF(&exec_ctx, combiner, "test_fake_resolver"); GRPC_RESOLVER_UNREF(&exec_ctx, resolver, "test_fake_resolver"); diff --git a/test/core/client_channel/resolvers/sockaddr_resolver_test.cc b/test/core/client_channel/resolvers/sockaddr_resolver_test.cc index 028a786059750..dfa2d12b5e865 100644 --- a/test/core/client_channel/resolvers/sockaddr_resolver_test.cc +++ b/test/core/client_channel/resolvers/sockaddr_resolver_test.cc @@ -52,7 +52,7 @@ static void test_succeeds(grpc_resolver_factory* factory, const char* string) { args.uri = uri; args.combiner = g_combiner; resolver = grpc_resolver_factory_create_resolver(&exec_ctx, factory, &args); - GPR_ASSERT(resolver != NULL); + GPR_ASSERT(resolver != nullptr); on_resolution_arg on_res_arg; memset(&on_res_arg, 0, sizeof(on_res_arg)); @@ -79,7 +79,7 @@ static void test_fails(grpc_resolver_factory* factory, const char* string) { args.uri = uri; args.combiner = g_combiner; resolver = grpc_resolver_factory_create_resolver(&exec_ctx, factory, &args); - GPR_ASSERT(resolver == NULL); + GPR_ASSERT(resolver == nullptr); grpc_uri_destroy(uri); grpc_exec_ctx_finish(&exec_ctx); } diff --git a/test/core/client_channel/uri_parser_test.cc b/test/core/client_channel/uri_parser_test.cc index 0bdf57ce4b009..30183f9f57853 100644 --- a/test/core/client_channel/uri_parser_test.cc +++ b/test/core/client_channel/uri_parser_test.cc @@ -42,7 +42,7 @@ static void test_succeeds(const char* uri_text, const char* scheme, static void test_fails(const char* uri_text) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - GPR_ASSERT(NULL == grpc_uri_parse(&exec_ctx, uri_text, 0)); + GPR_ASSERT(nullptr == grpc_uri_parse(&exec_ctx, uri_text, 0)); grpc_exec_ctx_finish(&exec_ctx); } @@ -60,7 +60,7 @@ static void test_query_parts() { GPR_ASSERT(4 == uri->num_query_parts); GPR_ASSERT(0 == strcmp("a", uri->query_parts[0])); - GPR_ASSERT(NULL == uri->query_parts_values[0]); + GPR_ASSERT(nullptr == uri->query_parts_values[0]); GPR_ASSERT(0 == strcmp("b", uri->query_parts[1])); GPR_ASSERT(0 == strcmp("B", uri->query_parts_values[1])); @@ -69,12 +69,12 @@ static void test_query_parts() { GPR_ASSERT(0 == strcmp("", uri->query_parts_values[2])); GPR_ASSERT(0 == strcmp("", uri->query_parts[3])); - GPR_ASSERT(NULL == uri->query_parts_values[3]); + GPR_ASSERT(nullptr == uri->query_parts_values[3]); - GPR_ASSERT(NULL == grpc_uri_get_query_arg(uri, "a")); + GPR_ASSERT(nullptr == grpc_uri_get_query_arg(uri, "a")); GPR_ASSERT(0 == strcmp("B", grpc_uri_get_query_arg(uri, "b"))); GPR_ASSERT(0 == strcmp("", grpc_uri_get_query_arg(uri, "c"))); - GPR_ASSERT(NULL == grpc_uri_get_query_arg(uri, "")); + GPR_ASSERT(nullptr == grpc_uri_get_query_arg(uri, "")); GPR_ASSERT(0 == strcmp("frag", uri->fragment)); grpc_exec_ctx_finish(&exec_ctx); @@ -111,8 +111,8 @@ static void test_query_parts() { GPR_ASSERT(0 == strcmp("/path", uri->path)); GPR_ASSERT(0 == strcmp("", uri->query)); GPR_ASSERT(0 == uri->num_query_parts); - GPR_ASSERT(NULL == uri->query_parts); - GPR_ASSERT(NULL == uri->query_parts_values); + GPR_ASSERT(nullptr == uri->query_parts); + GPR_ASSERT(nullptr == uri->query_parts_values); GPR_ASSERT(0 == strcmp("", uri->fragment)); grpc_exec_ctx_finish(&exec_ctx); grpc_uri_destroy(uri); diff --git a/test/core/compression/algorithm_test.cc b/test/core/compression/algorithm_test.cc index bc3af410c59b3..2f1d8bc8ebb9e 100644 --- a/test/core/compression/algorithm_test.cc +++ b/test/core/compression/algorithm_test.cc @@ -68,11 +68,11 @@ static void test_algorithm_failure(void) { gpr_log(GPR_DEBUG, "test_algorithm_failure"); GPR_ASSERT(grpc_compression_algorithm_name(GRPC_COMPRESS_ALGORITHMS_COUNT, - NULL) == 0); + nullptr) == 0); GPR_ASSERT( grpc_compression_algorithm_name(static_cast( GRPC_COMPRESS_ALGORITHMS_COUNT + 1), - NULL) == 0); + nullptr) == 0); mdstr = grpc_slice_from_static_string("this-is-an-invalid-algorithm"); GPR_ASSERT(grpc_compression_algorithm_from_slice(mdstr) == GRPC_COMPRESS_ALGORITHMS_COUNT); diff --git a/test/core/compression/stream_compression_test.cc b/test/core/compression/stream_compression_test.cc index 7cb583b88d781..2f30b7fc193fb 100644 --- a/test/core/compression/stream_compression_test.cc +++ b/test/core/compression/stream_compression_test.cc @@ -66,7 +66,7 @@ static void test_stream_compression_simple_compress_decompress() { GRPC_STREAM_COMPRESSION_GZIP_DECOMPRESS); grpc_slice slice = grpc_slice_from_static_string(test_str); grpc_slice_buffer_add(&source, slice); - GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, NULL, + GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, nullptr, ~(size_t)0, GRPC_STREAM_COMPRESSION_FLUSH_FINISH)); bool end_of_context; @@ -99,7 +99,7 @@ test_stream_compression_simple_compress_decompress_with_output_size_constraint() GRPC_STREAM_COMPRESSION_GZIP_DECOMPRESS); grpc_slice slice = grpc_slice_from_static_string(test_str); grpc_slice_buffer_add(&source, slice); - GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, NULL, + GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, nullptr, ~(size_t)0, GRPC_STREAM_COMPRESSION_FLUSH_FINISH)); grpc_stream_compression_context_destroy(compress_ctx); @@ -149,7 +149,7 @@ test_stream_compression_simple_compress_decompress_with_large_data() { GRPC_STREAM_COMPRESSION_GZIP_DECOMPRESS); grpc_slice slice = grpc_slice_from_static_string(test_str); grpc_slice_buffer_add(&source, slice); - GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, NULL, + GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, nullptr, ~(size_t)0, GRPC_STREAM_COMPRESSION_FLUSH_FINISH)); bool end_of_context; @@ -180,7 +180,7 @@ static void test_stream_compression_drop_context() { GRPC_STREAM_COMPRESSION_GZIP_COMPRESS); grpc_slice slice = grpc_slice_from_static_string(test_str); grpc_slice_buffer_add(&source, slice); - GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, NULL, + GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, nullptr, ~(size_t)0, GRPC_STREAM_COMPRESSION_FLUSH_FINISH)); grpc_stream_compression_context_destroy(compress_ctx); @@ -189,7 +189,7 @@ static void test_stream_compression_drop_context() { GRPC_STREAM_COMPRESSION_GZIP_COMPRESS); slice = grpc_slice_from_static_string(test_str2); grpc_slice_buffer_add(&source, slice); - GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, NULL, + GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, nullptr, ~(size_t)0, GRPC_STREAM_COMPRESSION_FLUSH_FINISH)); grpc_stream_compression_context_destroy(compress_ctx); @@ -249,7 +249,7 @@ static void test_stream_compression_sync_flush() { GRPC_STREAM_COMPRESSION_GZIP_COMPRESS); grpc_slice slice = grpc_slice_from_static_string(test_str); grpc_slice_buffer_add(&source, slice); - GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, NULL, + GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, nullptr, ~(size_t)0, GRPC_STREAM_COMPRESSION_FLUSH_SYNC)); @@ -268,7 +268,7 @@ static void test_stream_compression_sync_flush() { grpc_slice_buffer_init(&sink); slice = grpc_slice_from_static_string(test_str2); grpc_slice_buffer_add(&source, slice); - GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, NULL, + GPR_ASSERT(grpc_stream_compress(compress_ctx, &source, &relay, nullptr, ~(size_t)0, GRPC_STREAM_COMPRESSION_FLUSH_FINISH)); grpc_stream_compression_context_destroy(compress_ctx); diff --git a/test/core/end2end/bad_server_response_test.cc b/test/core/end2end/bad_server_response_test.cc index ea7857d8d7efe..04275e2c2a792 100644 --- a/test/core/end2end/bad_server_response_test.cc +++ b/test/core/end2end/bad_server_response_test.cc @@ -135,8 +135,8 @@ static void on_connect(grpc_exec_ctx* exec_ctx, void* arg, grpc_endpoint* tcp, grpc_tcp_server_acceptor* acceptor) { gpr_free(acceptor); test_tcp_server* server = (test_tcp_server*)arg; - GRPC_CLOSURE_INIT(&on_read, handle_read, NULL, grpc_schedule_on_exec_ctx); - GRPC_CLOSURE_INIT(&on_write, done_write, NULL, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&on_read, handle_read, nullptr, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&on_write, done_write, nullptr, grpc_schedule_on_exec_ctx); grpc_slice_buffer_init(&state.temp_incoming_buffer); grpc_slice_buffer_init(&state.outgoing_buffer); state.tcp = tcp; @@ -161,15 +161,15 @@ static void start_rpc(int target_port, grpc_status_code expected_status, cq_verifier* cqv; grpc_slice details; - state.cq = grpc_completion_queue_create_for_next(NULL); + state.cq = grpc_completion_queue_create_for_next(nullptr); cqv = cq_verifier_create(state.cq); gpr_join_host_port(&state.target, "127.0.0.1", target_port); - state.channel = grpc_insecure_channel_create(state.target, NULL, NULL); + state.channel = grpc_insecure_channel_create(state.target, nullptr, nullptr); grpc_slice host = grpc_slice_from_static_string("localhost"); state.call = grpc_channel_create_call( - state.channel, NULL, GRPC_PROPAGATE_DEFAULTS, state.cq, + state.channel, nullptr, GRPC_PROPAGATE_DEFAULTS, state.cq, grpc_slice_from_static_string("/Service/Method"), &host, - gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&trailing_metadata_recv); @@ -179,26 +179,26 @@ static void start_rpc(int target_port, grpc_status_code expected_status, 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_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; error = - grpc_call_start_batch(state.call, ops, (size_t)(op - ops), tag(1), NULL); + grpc_call_start_batch(state.call, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); @@ -206,7 +206,7 @@ static void start_rpc(int target_port, grpc_status_code expected_status, cq_verify(cqv); GPR_ASSERT(status == expected_status); - if (expected_detail != NULL) { + if (expected_detail != nullptr) { GPR_ASSERT(-1 != grpc_slice_slice(details, grpc_slice_from_static_string( expected_detail))); } @@ -224,7 +224,7 @@ static void cleanup_rpc(grpc_exec_ctx* exec_ctx) { grpc_call_unref(state.call); grpc_completion_queue_shutdown(state.cq); do { - ev = grpc_completion_queue_next(state.cq, n_sec_deadline(1), NULL); + ev = grpc_completion_queue_next(state.cq, n_sec_deadline(1), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); grpc_completion_queue_destroy(state.cq); grpc_channel_destroy(state.channel); @@ -262,7 +262,7 @@ static void poll_server_until_read_done(test_tcp_server* server, poll_args* pa = (poll_args*)gpr_malloc(sizeof(*pa)); pa->server = server; pa->signal_when_done = signal_when_done; - gpr_thd_new(&id, actually_poll_server, pa, NULL); + gpr_thd_new(&id, actually_poll_server, pa, nullptr); } static void run_test(const char* response_payload, @@ -331,7 +331,7 @@ int main(int argc, char** argv) { /* unparseable response */ run_test(UNPARSEABLE_RESP, sizeof(UNPARSEABLE_RESP) - 1, GRPC_STATUS_UNKNOWN, - NULL); + nullptr); /* http1 response */ run_test(HTTP1_RESP, sizeof(HTTP1_RESP) - 1, GRPC_STATUS_UNAVAILABLE, diff --git a/test/core/end2end/connection_refused_test.cc b/test/core/end2end/connection_refused_test.cc index cea06ae282878..7fc36706f8235 100644 --- a/test/core/end2end/connection_refused_test.cc +++ b/test/core/end2end/connection_refused_test.cc @@ -53,11 +53,11 @@ static void run_test(bool wait_for_ready, bool use_service_config) { grpc_metadata_array_init(&trailing_metadata_recv); - cq = grpc_completion_queue_create_for_next(NULL); + cq = grpc_completion_queue_create_for_next(nullptr); cqv = cq_verifier_create(cq); /* if using service config, create channel args */ - grpc_channel_args* args = NULL; + grpc_channel_args* args = nullptr; if (use_service_config) { GPR_ASSERT(wait_for_ready); grpc_arg arg; @@ -80,12 +80,12 @@ static void run_test(bool wait_for_ready, bool use_service_config) { char* addr; gpr_join_host_port(&addr, "127.0.0.1", port); gpr_log(GPR_INFO, "server: %s", addr); - chan = grpc_insecure_channel_create(addr, args, NULL); + chan = grpc_insecure_channel_create(addr, args, nullptr); grpc_slice host = grpc_slice_from_static_string("nonexistant"); gpr_timespec deadline = grpc_timeout_seconds_to_deadline(2); call = grpc_channel_create_call( - chan, NULL, GRPC_PROPAGATE_DEFAULTS, cq, - grpc_slice_from_static_string("/service/method"), &host, deadline, NULL); + chan, nullptr, GRPC_PROPAGATE_DEFAULTS, cq, + grpc_slice_from_static_string("/service/method"), &host, deadline, nullptr); gpr_free(addr); @@ -96,17 +96,17 @@ static void run_test(bool wait_for_ready, bool use_service_config) { op->flags = (wait_for_ready && !use_service_config) ? GRPC_INITIAL_METADATA_WAIT_FOR_READY : 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch( - call, ops, (size_t)(op - ops), tag(1), NULL)); + call, ops, (size_t)(op - ops), tag(1), nullptr)); /* verify that all tags get completed */ CQ_EXPECT_COMPLETION(cqv, tag(1), 1); cq_verify(cqv); @@ -119,7 +119,7 @@ static void run_test(bool wait_for_ready, bool use_service_config) { grpc_completion_queue_shutdown(cq); while ( - grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL) + grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr) .type != GRPC_QUEUE_SHUTDOWN) ; grpc_completion_queue_destroy(cq); @@ -132,7 +132,7 @@ static void run_test(bool wait_for_ready, bool use_service_config) { { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - if (args != NULL) grpc_channel_args_destroy(&exec_ctx, args); + if (args != nullptr) grpc_channel_args_destroy(&exec_ctx, args); grpc_exec_ctx_finish(&exec_ctx); } diff --git a/test/core/end2end/cq_verifier.cc b/test/core/end2end/cq_verifier.cc index fd5193f42c202..d595124c00508 100644 --- a/test/core/end2end/cq_verifier.cc +++ b/test/core/end2end/cq_verifier.cc @@ -64,7 +64,7 @@ struct cq_verifier { cq_verifier* cq_verifier_create(grpc_completion_queue* cq) { cq_verifier* v = (cq_verifier*)gpr_malloc(sizeof(cq_verifier)); v->cq = cq; - v->first_expectation = NULL; + v->first_expectation = nullptr; return v; } @@ -203,7 +203,7 @@ static void expectation_to_strvec(gpr_strvec* buf, expectation* e) { static void expectations_to_strvec(gpr_strvec* buf, cq_verifier* v) { expectation* e; - for (e = v->first_expectation; e != NULL; e = e->next) { + for (e = v->first_expectation; e != nullptr; e = e->next) { expectation_to_strvec(buf, e); gpr_strvec_add(buf, gpr_strdup("\n")); } @@ -215,7 +215,7 @@ static void fail_no_event_received(cq_verifier* v) { gpr_strvec_init(&buf); gpr_strvec_add(&buf, gpr_strdup("no event received, but expected:\n")); expectations_to_strvec(&buf, v); - msg = gpr_strvec_flatten(&buf, NULL); + msg = gpr_strvec_flatten(&buf, nullptr); gpr_log(GPR_ERROR, "%s", msg); gpr_strvec_destroy(&buf); gpr_free(msg); @@ -230,7 +230,7 @@ static void verify_matches(expectation* e, grpc_event* ev) { gpr_strvec expected; gpr_strvec_init(&expected); expectation_to_strvec(&expected, e); - char* s = gpr_strvec_flatten(&expected, NULL); + char* s = gpr_strvec_flatten(&expected, nullptr); gpr_strvec_destroy(&expected); gpr_log(GPR_ERROR, "actual success does not match expected: %s", s); gpr_free(s); @@ -250,32 +250,32 @@ static void verify_matches(expectation* e, grpc_event* ev) { void cq_verify(cq_verifier* v) { const gpr_timespec deadline = grpc_timeout_seconds_to_deadline(10); - while (v->first_expectation != NULL) { - grpc_event ev = grpc_completion_queue_next(v->cq, deadline, NULL); + while (v->first_expectation != nullptr) { + grpc_event ev = grpc_completion_queue_next(v->cq, deadline, nullptr); if (ev.type == GRPC_QUEUE_TIMEOUT) { fail_no_event_received(v); break; } expectation* e; - expectation* prev = NULL; - for (e = v->first_expectation; e != NULL; e = e->next) { + expectation* prev = nullptr; + for (e = v->first_expectation; e != nullptr; e = e->next) { if (e->tag == ev.tag) { verify_matches(e, &ev); if (e == v->first_expectation) v->first_expectation = e->next; - if (prev != NULL) prev->next = e->next; + if (prev != nullptr) prev->next = e->next; gpr_free(e); break; } prev = e; } - if (e == NULL) { + if (e == nullptr) { char* s = grpc_event_string(&ev); gpr_log(GPR_ERROR, "cq returned unexpected event: %s", s); gpr_free(s); gpr_strvec expectations; gpr_strvec_init(&expectations); expectations_to_strvec(&expectations, v); - s = gpr_strvec_flatten(&expectations, NULL); + s = gpr_strvec_flatten(&expectations, nullptr); gpr_strvec_destroy(&expectations); gpr_log(GPR_ERROR, "expected tags:\n%s", s); gpr_free(s); @@ -290,9 +290,9 @@ void cq_verify_empty_timeout(cq_verifier* v, int timeout_sec) { gpr_time_from_seconds(timeout_sec, GPR_TIMESPAN)); grpc_event ev; - GPR_ASSERT(v->first_expectation == NULL && "expectation queue must be empty"); + GPR_ASSERT(v->first_expectation == nullptr && "expectation queue must be empty"); - ev = grpc_completion_queue_next(v->cq, deadline, NULL); + ev = grpc_completion_queue_next(v->cq, deadline, nullptr); if (ev.type != GRPC_QUEUE_TIMEOUT) { char* s = grpc_event_string(&ev); gpr_log(GPR_ERROR, "unexpected event (expected nothing): %s", s); diff --git a/test/core/end2end/cq_verifier_native.cc b/test/core/end2end/cq_verifier_native.cc index a0a7c832e5432..e93956b188143 100644 --- a/test/core/end2end/cq_verifier_native.cc +++ b/test/core/end2end/cq_verifier_native.cc @@ -19,6 +19,8 @@ /* This check is for testing only. */ #ifndef GRPC_UV +#include + #include "test/core/end2end/cq_verifier_internal.h" /* the verifier itself */ @@ -27,13 +29,12 @@ struct cq_verifier { grpc_completion_queue* cq; /* start of expectation list */ expectation* first_expectation; - uv_timer_t timer; }; cq_verifier* cq_verifier_create(grpc_completion_queue* cq) { cq_verifier* v = static_cast(gpr_malloc(sizeof(cq_verifier))); v->cq = cq; - cq_verifier_set_first_expectation(v, NULL); + cq_verifier_set_first_expectation(v, nullptr); return v; } @@ -53,7 +54,7 @@ void cq_verifier_set_first_expectation(cq_verifier* v, expectation* e) { grpc_event cq_verifier_next_event(cq_verifier* v, int timeout_seconds) { const gpr_timespec deadline = grpc_timeout_seconds_to_deadline(timeout_seconds); - return grpc_completion_queue_next(v->cq, deadline, NULL); + return grpc_completion_queue_next(v->cq, deadline, nullptr); } #endif /* GRPC_UV */ diff --git a/test/core/end2end/dualstack_socket_test.cc b/test/core/end2end/dualstack_socket_test.cc index 1e02116e4c067..2c7a6cfbbc807 100644 --- a/test/core/end2end/dualstack_socket_test.cc +++ b/test/core/end2end/dualstack_socket_test.cc @@ -48,7 +48,7 @@ static gpr_timespec ms_from_now(int ms) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, ms_from_now(5000), NULL); + ev = grpc_completion_queue_next(cq, ms_from_now(5000), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -93,9 +93,9 @@ void test_connect(const char* server_host, const char* client_host, int port, grpc_call_details_init(&call_details); /* Create server. */ - cq = grpc_completion_queue_create_for_next(NULL); - server = grpc_server_create(NULL, NULL); - grpc_server_register_completion_queue(server, cq, NULL); + cq = grpc_completion_queue_create_for_next(nullptr); + server = grpc_server_create(nullptr, nullptr); + grpc_server_register_completion_queue(server, cq, nullptr); GPR_ASSERT((got_port = grpc_server_add_insecure_http2_port( server, server_hostport)) > 0); if (port == 0) { @@ -126,7 +126,7 @@ void test_connect(const char* server_host, const char* client_host, int port, gpr_free(uri_part_str); } client_hostport = gpr_strjoin_sep((const char**)hosts_with_port, - uri_parts.count, ",", NULL); + uri_parts.count, ",", nullptr); for (i = 0; i < uri_parts.count; i++) { gpr_free(hosts_with_port[i]); } @@ -136,7 +136,7 @@ void test_connect(const char* server_host, const char* client_host, int port, } else { gpr_join_host_port(&client_hostport, client_host, port); } - client = grpc_insecure_channel_create(client_hostport, NULL, NULL); + client = grpc_insecure_channel_create(client_hostport, nullptr, nullptr); gpr_log(GPR_INFO, "Testing with server=%s client=%s (expecting %s)", server_hostport, client_hostport, expect_ok ? "success" : "failure"); @@ -155,9 +155,9 @@ void test_connect(const char* server_host, const char* client_host, int port, /* Send a trivial request. */ grpc_slice host = grpc_slice_from_static_string("foo.test.google.fr"); - c = grpc_channel_create_call(client, NULL, GRPC_PROPAGATE_DEFAULTS, cq, + c = grpc_channel_create_call(client, nullptr, GRPC_PROPAGATE_DEFAULTS, cq, grpc_slice_from_static_string("/foo"), &host, - deadline, NULL); + deadline, nullptr); GPR_ASSERT(c); memset(ops, 0, sizeof(ops)); @@ -165,25 +165,25 @@ void test_connect(const char* server_host, const char* client_host, int port, op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = expect_ok ? GRPC_INITIAL_METADATA_WAIT_FOR_READY : 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); if (expect_ok) { @@ -211,7 +211,7 @@ void test_connect(const char* server_host, const char* client_host, int port, op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -246,11 +246,11 @@ void test_connect(const char* server_host, const char* client_host, int port, grpc_channel_destroy(client); /* Destroy server. */ - shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); + shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr); grpc_server_shutdown_and_notify(server, shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(server); grpc_completion_queue_destroy(shutdown_cq); @@ -270,10 +270,10 @@ void test_connect(const char* server_host, const char* client_host, int port, } int external_dns_works(const char* host) { - grpc_resolved_addresses* res = NULL; + grpc_resolved_addresses* res = nullptr; grpc_error* error = grpc_blocking_resolve_address(host, "80", &res); GRPC_ERROR_UNREF(error); - if (res != NULL) { + if (res != nullptr) { grpc_resolved_addresses_destroy(res); return 1; } diff --git a/test/core/end2end/end2end_test_utils.cc b/test/core/end2end/end2end_test_utils.cc index 35f086a7f6712..51d2730f0e3e0 100644 --- a/test/core/end2end/end2end_test_utils.cc +++ b/test/core/end2end/end2end_test_utils.cc @@ -27,19 +27,19 @@ const char* get_host_override_string(const char* str, if (config.feature_mask & FEATURE_MASK_SUPPORTS_AUTHORITY_HEADER) { return str; } else { - return NULL; + return nullptr; } } const grpc_slice* get_host_override_slice(const char* str, grpc_end2end_test_config config) { const char* r = get_host_override_string(str, config); - if (r != NULL) { + if (r != nullptr) { static grpc_slice ret; ret = grpc_slice_from_static_string(r); return &ret; } - return NULL; + return nullptr; } void validate_host_override_string(const char* pattern, grpc_slice str, diff --git a/test/core/end2end/fixtures/h2_census.cc b/test/core/end2end/fixtures/h2_census.cc index 4213140f4adf6..89d992cf526ff 100644 --- a/test/core/end2end/fixtures/h2_census.cc +++ b/test/core/end2end/fixtures/h2_census.cc @@ -51,8 +51,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create_for_next(NULL); - f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); + f.cq = grpc_completion_queue_create_for_next(nullptr); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr); return f; } @@ -71,7 +71,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f, static_cast(f->fixture_data); grpc_arg arg = make_census_enable_arg(); client_args = grpc_channel_args_copy_and_add(client_args, &arg, 1); - f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL); + f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, nullptr); GPR_ASSERT(f->client); { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; @@ -89,13 +89,13 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f, grpc_server_destroy(f->server); } server_args = grpc_channel_args_copy_and_add(server_args, &arg, 1); - f->server = grpc_server_create(server_args, NULL); + f->server = grpc_server_create(server_args, nullptr); { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_channel_args_destroy(&exec_ctx, server_args); grpc_exec_ctx_finish(&exec_ctx); } - grpc_server_register_completion_queue(f->server, f->cq, NULL); + grpc_server_register_completion_queue(f->server, f->cq, nullptr); GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr)); grpc_server_start(f->server); } diff --git a/test/core/end2end/fixtures/h2_compress.cc b/test/core/end2end/fixtures/h2_compress.cc index 64e028b9508c9..fbf4d2061b446 100644 --- a/test/core/end2end/fixtures/h2_compress.cc +++ b/test/core/end2end/fixtures/h2_compress.cc @@ -55,8 +55,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack_compression( memset(&f, 0, sizeof(f)); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create_for_next(NULL); - f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); + f.cq = grpc_completion_queue_create_for_next(nullptr); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr); return f; } @@ -65,7 +65,7 @@ void chttp2_init_client_fullstack_compression(grpc_end2end_test_fixture* f, grpc_channel_args* client_args) { fullstack_compression_fixture_data* ffd = static_cast(f->fixture_data); - if (ffd->client_args_compression != NULL) { + if (ffd->client_args_compression != nullptr) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_channel_args_destroy(&exec_ctx, ffd->client_args_compression); grpc_exec_ctx_finish(&exec_ctx); @@ -73,14 +73,14 @@ void chttp2_init_client_fullstack_compression(grpc_end2end_test_fixture* f, ffd->client_args_compression = grpc_channel_args_set_compression_algorithm( client_args, GRPC_COMPRESS_GZIP); f->client = grpc_insecure_channel_create(ffd->localaddr, - ffd->client_args_compression, NULL); + ffd->client_args_compression, nullptr); } void chttp2_init_server_fullstack_compression(grpc_end2end_test_fixture* f, grpc_channel_args* server_args) { fullstack_compression_fixture_data* ffd = static_cast(f->fixture_data); - if (ffd->server_args_compression != NULL) { + if (ffd->server_args_compression != nullptr) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_channel_args_destroy(&exec_ctx, ffd->server_args_compression); grpc_exec_ctx_finish(&exec_ctx); @@ -90,8 +90,8 @@ void chttp2_init_server_fullstack_compression(grpc_end2end_test_fixture* f, if (f->server) { grpc_server_destroy(f->server); } - f->server = grpc_server_create(ffd->server_args_compression, NULL); - grpc_server_register_completion_queue(f->server, f->cq, NULL); + f->server = grpc_server_create(ffd->server_args_compression, nullptr); + grpc_server_register_completion_queue(f->server, f->cq, nullptr); GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr)); grpc_server_start(f->server); } diff --git a/test/core/end2end/fixtures/h2_fakesec.cc b/test/core/end2end/fixtures/h2_fakesec.cc index fbf2f497290f8..570d040976479 100644 --- a/test/core/end2end/fixtures/h2_fakesec.cc +++ b/test/core/end2end/fixtures/h2_fakesec.cc @@ -46,8 +46,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create_for_next(NULL); - f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); + f.cq = grpc_completion_queue_create_for_next(nullptr); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr); return f; } @@ -56,8 +56,8 @@ static void process_auth_failure(void* state, grpc_auth_context* ctx, const grpc_metadata* md, size_t md_count, grpc_process_auth_metadata_done_cb cb, void* user_data) { - GPR_ASSERT(state == NULL); - cb(user_data, NULL, 0, NULL, 0, GRPC_STATUS_UNAUTHENTICATED, NULL); + GPR_ASSERT(state == nullptr); + cb(user_data, nullptr, 0, nullptr, 0, GRPC_STATUS_UNAUTHENTICATED, nullptr); } static void chttp2_init_client_secure_fullstack( @@ -66,8 +66,8 @@ static void chttp2_init_client_secure_fullstack( fullstack_secure_fixture_data* ffd = static_cast(f->fixture_data); f->client = - grpc_secure_channel_create(creds, ffd->localaddr, client_args, NULL); - GPR_ASSERT(f->client != NULL); + grpc_secure_channel_create(creds, ffd->localaddr, client_args, nullptr); + GPR_ASSERT(f->client != nullptr); grpc_channel_credentials_release(creds); } @@ -79,8 +79,8 @@ static void chttp2_init_server_secure_fullstack( if (f->server) { grpc_server_destroy(f->server); } - f->server = grpc_server_create(server_args, NULL); - grpc_server_register_completion_queue(f->server, f->cq, NULL); + f->server = grpc_server_create(server_args, nullptr); + grpc_server_register_completion_queue(f->server, f->cq, nullptr); GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr, server_creds)); grpc_server_credentials_release(server_creds); @@ -103,7 +103,7 @@ static void chttp2_init_client_fake_secure_fullstack( static int fail_server_auth_check(grpc_channel_args* server_args) { size_t i; - if (server_args == NULL) return 0; + if (server_args == nullptr) return 0; for (i = 0; i < server_args->num_args; i++) { if (strcmp(server_args->args[i].key, FAIL_AUTH_CHECK_SERVER_ARG_NAME) == 0) { @@ -118,7 +118,7 @@ static void chttp2_init_server_fake_secure_fullstack( grpc_server_credentials* fake_ts_creds = grpc_fake_transport_security_server_credentials_create(); if (fail_server_auth_check(server_args)) { - grpc_auth_metadata_processor processor = {process_auth_failure, NULL, NULL}; + grpc_auth_metadata_processor processor = {process_auth_failure, nullptr, nullptr}; grpc_server_credentials_set_auth_metadata_processor(fake_ts_creds, processor); } diff --git a/test/core/end2end/fixtures/h2_fd.cc b/test/core/end2end/fixtures/h2_fd.cc index 7005b969a037e..97f4b71bf0167 100644 --- a/test/core/end2end/fixtures/h2_fd.cc +++ b/test/core/end2end/fixtures/h2_fd.cc @@ -58,8 +58,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( grpc_end2end_test_fixture f; memset(&f, 0, sizeof(f)); f.fixture_data = fixture_data; - f.cq = grpc_completion_queue_create_for_next(NULL); - f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); + f.cq = grpc_completion_queue_create_for_next(nullptr); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr); create_sockets(fixture_data->fd_pair); @@ -84,12 +84,12 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f, grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; sp_fixture_data* sfd = static_cast(f->fixture_data); GPR_ASSERT(!f->server); - f->server = grpc_server_create(server_args, NULL); + f->server = grpc_server_create(server_args, nullptr); GPR_ASSERT(f->server); - grpc_server_register_completion_queue(f->server, f->cq, NULL); + grpc_server_register_completion_queue(f->server, f->cq, nullptr); grpc_server_start(f->server); - grpc_server_add_insecure_channel_from_fd(f->server, NULL, sfd->fd_pair[1]); + grpc_server_add_insecure_channel_from_fd(f->server, nullptr, sfd->fd_pair[1]); grpc_exec_ctx_finish(&exec_ctx); } diff --git a/test/core/end2end/fixtures/h2_full+pipe.cc b/test/core/end2end/fixtures/h2_full+pipe.cc index 0dd650b8e0214..306c85871be2b 100644 --- a/test/core/end2end/fixtures/h2_full+pipe.cc +++ b/test/core/end2end/fixtures/h2_full+pipe.cc @@ -56,8 +56,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create_for_next(NULL); - f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); + f.cq = grpc_completion_queue_create_for_next(nullptr); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr); return f; } @@ -66,7 +66,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f, grpc_channel_args* client_args) { fullstack_fixture_data* ffd = static_cast(f->fixture_data); - f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL); + f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, nullptr); GPR_ASSERT(f->client); } @@ -77,8 +77,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f, if (f->server) { grpc_server_destroy(f->server); } - f->server = grpc_server_create(server_args, NULL); - grpc_server_register_completion_queue(f->server, f->cq, NULL); + f->server = grpc_server_create(server_args, nullptr); + grpc_server_register_completion_queue(f->server, f->cq, nullptr); GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr)); grpc_server_start(f->server); } diff --git a/test/core/end2end/fixtures/h2_full+trace.cc b/test/core/end2end/fixtures/h2_full+trace.cc index 21372c6deea27..589bf1d7e4605 100644 --- a/test/core/end2end/fixtures/h2_full+trace.cc +++ b/test/core/end2end/fixtures/h2_full+trace.cc @@ -56,8 +56,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create_for_next(NULL); - f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); + f.cq = grpc_completion_queue_create_for_next(nullptr); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr); return f; } @@ -66,7 +66,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f, grpc_channel_args* client_args) { fullstack_fixture_data* ffd = static_cast(f->fixture_data); - f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL); + f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, nullptr); GPR_ASSERT(f->client); } @@ -77,8 +77,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f, if (f->server) { grpc_server_destroy(f->server); } - f->server = grpc_server_create(server_args, NULL); - grpc_server_register_completion_queue(f->server, f->cq, NULL); + f->server = grpc_server_create(server_args, nullptr); + grpc_server_register_completion_queue(f->server, f->cq, nullptr); GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr)); grpc_server_start(f->server); } diff --git a/test/core/end2end/fixtures/h2_full+workarounds.cc b/test/core/end2end/fixtures/h2_full+workarounds.cc index ebffe2125c5a1..ffe2623c44978 100644 --- a/test/core/end2end/fixtures/h2_full+workarounds.cc +++ b/test/core/end2end/fixtures/h2_full+workarounds.cc @@ -54,8 +54,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create_for_next(NULL); - f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); + f.cq = grpc_completion_queue_create_for_next(nullptr); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr); return f; } @@ -64,7 +64,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f, grpc_channel_args* client_args) { fullstack_fixture_data* ffd = static_cast(f->fixture_data); - f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL); + f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, nullptr); GPR_ASSERT(f->client); } @@ -85,8 +85,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f, if (f->server) { grpc_server_destroy(f->server); } - f->server = grpc_server_create(server_args_new, NULL); - grpc_server_register_completion_queue(f->server, f->cq, NULL); + f->server = grpc_server_create(server_args_new, nullptr); + grpc_server_register_completion_queue(f->server, f->cq, nullptr); GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr)); grpc_server_start(f->server); grpc_channel_args_destroy(&exec_ctx, server_args_new); diff --git a/test/core/end2end/fixtures/h2_full.cc b/test/core/end2end/fixtures/h2_full.cc index 895af679304f6..c0a9524cc63b2 100644 --- a/test/core/end2end/fixtures/h2_full.cc +++ b/test/core/end2end/fixtures/h2_full.cc @@ -50,8 +50,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create_for_next(NULL); - f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); + f.cq = grpc_completion_queue_create_for_next(nullptr); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr); return f; } @@ -60,7 +60,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f, grpc_channel_args* client_args) { fullstack_fixture_data* ffd = static_cast(f->fixture_data); - f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL); + f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, nullptr); GPR_ASSERT(f->client); } @@ -71,8 +71,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f, if (f->server) { grpc_server_destroy(f->server); } - f->server = grpc_server_create(server_args, NULL); - grpc_server_register_completion_queue(f->server, f->cq, NULL); + f->server = grpc_server_create(server_args, nullptr); + grpc_server_register_completion_queue(f->server, f->cq, nullptr); GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr)); grpc_server_start(f->server); } diff --git a/test/core/end2end/fixtures/h2_http_proxy.cc b/test/core/end2end/fixtures/h2_http_proxy.cc index a67ce82064b4a..45f6cb56acf6c 100644 --- a/test/core/end2end/fixtures/h2_http_proxy.cc +++ b/test/core/end2end/fixtures/h2_http_proxy.cc @@ -57,8 +57,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( ffd->proxy = grpc_end2end_http_proxy_create(client_args); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create_for_next(NULL); - f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); + f.cq = grpc_completion_queue_create_for_next(nullptr); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr); return f; } @@ -72,7 +72,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f, /* If testing for proxy auth, add credentials to proxy uri */ const grpc_arg* proxy_auth_arg = grpc_channel_args_find(client_args, GRPC_ARG_HTTP_PROXY_AUTH_CREDS); - if (proxy_auth_arg == NULL || proxy_auth_arg->type != GRPC_ARG_STRING) { + if (proxy_auth_arg == nullptr || proxy_auth_arg->type != GRPC_ARG_STRING) { gpr_asprintf(&proxy_uri, "http://%s", grpc_end2end_http_proxy_get_proxy_name(ffd->proxy)); } else { @@ -81,7 +81,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f, } gpr_setenv("http_proxy", proxy_uri); gpr_free(proxy_uri); - f->client = grpc_insecure_channel_create(ffd->server_addr, client_args, NULL); + f->client = grpc_insecure_channel_create(ffd->server_addr, client_args, nullptr); GPR_ASSERT(f->client); } @@ -92,8 +92,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f, if (f->server) { grpc_server_destroy(f->server); } - f->server = grpc_server_create(server_args, NULL); - grpc_server_register_completion_queue(f->server, f->cq, NULL); + f->server = grpc_server_create(server_args, nullptr); + grpc_server_register_completion_queue(f->server, f->cq, nullptr); GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->server_addr)); grpc_server_start(f->server); } diff --git a/test/core/end2end/fixtures/h2_load_reporting.cc b/test/core/end2end/fixtures/h2_load_reporting.cc index b402fc56209b6..c0aa8ebdce613 100644 --- a/test/core/end2end/fixtures/h2_load_reporting.cc +++ b/test/core/end2end/fixtures/h2_load_reporting.cc @@ -52,8 +52,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_load_reporting( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create_for_next(NULL); - f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); + f.cq = grpc_completion_queue_create_for_next(nullptr); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr); return f; } @@ -62,7 +62,7 @@ void chttp2_init_client_load_reporting(grpc_end2end_test_fixture* f, grpc_channel_args* client_args) { load_reporting_fixture_data* ffd = static_cast(f->fixture_data); - f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL); + f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, nullptr); GPR_ASSERT(f->client); } @@ -75,13 +75,13 @@ void chttp2_init_server_load_reporting(grpc_end2end_test_fixture* f, grpc_server_destroy(f->server); } server_args = grpc_channel_args_copy_and_add(server_args, &arg, 1); - f->server = grpc_server_create(server_args, NULL); + f->server = grpc_server_create(server_args, nullptr); { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_channel_args_destroy(&exec_ctx, server_args); grpc_exec_ctx_finish(&exec_ctx); } - grpc_server_register_completion_queue(f->server, f->cq, NULL); + grpc_server_register_completion_queue(f->server, f->cq, nullptr); GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr)); grpc_server_start(f->server); } diff --git a/test/core/end2end/fixtures/h2_oauth2.cc b/test/core/end2end/fixtures/h2_oauth2.cc index 88e590a15f54f..474a1b4b9eb85 100644 --- a/test/core/end2end/fixtures/h2_oauth2.cc +++ b/test/core/end2end/fixtures/h2_oauth2.cc @@ -49,7 +49,7 @@ static const grpc_metadata* find_metadata(const grpc_metadata* md, return &md[i]; } } - return NULL; + return nullptr; } typedef struct { @@ -64,15 +64,15 @@ static void process_oauth2_success(void* state, grpc_auth_context* ctx, find_metadata(md, md_count, "authorization", oauth2_md); test_processor_state* s; - GPR_ASSERT(state != NULL); + GPR_ASSERT(state != nullptr); s = (test_processor_state*)state; GPR_ASSERT(s->pseudo_refcount == 1); - GPR_ASSERT(oauth2 != NULL); + GPR_ASSERT(oauth2 != nullptr); grpc_auth_context_add_cstring_property(ctx, client_identity_property_name, client_identity); GPR_ASSERT(grpc_auth_context_set_peer_identity_property_name( ctx, client_identity_property_name) == 1); - cb(user_data, oauth2, 1, NULL, 0, GRPC_STATUS_OK, NULL); + cb(user_data, oauth2, 1, nullptr, 0, GRPC_STATUS_OK, nullptr); } static void process_oauth2_failure(void* state, grpc_auth_context* ctx, @@ -82,11 +82,11 @@ static void process_oauth2_failure(void* state, grpc_auth_context* ctx, const grpc_metadata* oauth2 = find_metadata(md, md_count, "authorization", oauth2_md); test_processor_state* s; - GPR_ASSERT(state != NULL); + GPR_ASSERT(state != nullptr); s = (test_processor_state*)state; GPR_ASSERT(s->pseudo_refcount == 1); - GPR_ASSERT(oauth2 != NULL); - cb(user_data, oauth2, 1, NULL, 0, GRPC_STATUS_UNAUTHENTICATED, NULL); + GPR_ASSERT(oauth2 != nullptr); + cb(user_data, oauth2, 1, nullptr, 0, GRPC_STATUS_UNAUTHENTICATED, nullptr); } static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( @@ -101,8 +101,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create_for_next(NULL); - f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); + f.cq = grpc_completion_queue_create_for_next(nullptr); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr); return f; } @@ -113,8 +113,8 @@ static void chttp2_init_client_secure_fullstack( fullstack_secure_fixture_data* ffd = static_cast(f->fixture_data); f->client = - grpc_secure_channel_create(creds, ffd->localaddr, client_args, NULL); - GPR_ASSERT(f->client != NULL); + grpc_secure_channel_create(creds, ffd->localaddr, client_args, nullptr); + GPR_ASSERT(f->client != nullptr); grpc_channel_credentials_release(creds); } @@ -126,8 +126,8 @@ static void chttp2_init_server_secure_fullstack( if (f->server) { grpc_server_destroy(f->server); } - f->server = grpc_server_create(server_args, NULL); - grpc_server_register_completion_queue(f->server, f->cq, NULL); + f->server = grpc_server_create(server_args, nullptr); + grpc_server_register_completion_queue(f->server, f->cq, nullptr); GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr, server_creds)); grpc_server_credentials_release(server_creds); @@ -145,11 +145,11 @@ static void chttp2_init_client_simple_ssl_with_oauth2_secure_fullstack( grpc_end2end_test_fixture* f, grpc_channel_args* client_args) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_channel_credentials* ssl_creds = - grpc_ssl_credentials_create(test_root_cert, NULL, NULL); + grpc_ssl_credentials_create(test_root_cert, nullptr, nullptr); grpc_call_credentials* oauth2_creds = grpc_md_only_test_credentials_create( &exec_ctx, "authorization", oauth2_md, true /* is_async */); grpc_channel_credentials* ssl_oauth2_creds = - grpc_composite_channel_credentials_create(ssl_creds, oauth2_creds, NULL); + grpc_composite_channel_credentials_create(ssl_creds, oauth2_creds, nullptr); grpc_arg ssl_name_override = { GRPC_ARG_STRING, const_cast(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG), @@ -165,7 +165,7 @@ static void chttp2_init_client_simple_ssl_with_oauth2_secure_fullstack( static int fail_server_auth_check(grpc_channel_args* server_args) { size_t i; - if (server_args == NULL) return 0; + if (server_args == nullptr) return 0; for (i = 0; i < server_args->num_args; i++) { if (strcmp(server_args->args[i].key, FAIL_AUTH_CHECK_SERVER_ARG_NAME) == 0) { @@ -201,7 +201,7 @@ static void chttp2_init_server_simple_ssl_secure_fullstack( grpc_ssl_pem_key_cert_pair pem_key_cert_pair = {test_server1_key, test_server1_cert}; grpc_server_credentials* ssl_creds = - grpc_ssl_server_credentials_create(NULL, &pem_key_cert_pair, 1, 0, NULL); + grpc_ssl_server_credentials_create(nullptr, &pem_key_cert_pair, 1, 0, nullptr); grpc_server_credentials_set_auth_metadata_processor( ssl_creds, test_processor_create(fail_server_auth_check(server_args))); chttp2_init_server_secure_fullstack(f, server_args, ssl_creds); diff --git a/test/core/end2end/fixtures/h2_proxy.cc b/test/core/end2end/fixtures/h2_proxy.cc index 03ffa02e17fd7..295654cb6ab9b 100644 --- a/test/core/end2end/fixtures/h2_proxy.cc +++ b/test/core/end2end/fixtures/h2_proxy.cc @@ -42,14 +42,14 @@ typedef struct fullstack_fixture_data { static grpc_server* create_proxy_server(const char* port, grpc_channel_args* server_args) { - grpc_server* s = grpc_server_create(server_args, NULL); + grpc_server* s = grpc_server_create(server_args, nullptr); GPR_ASSERT(grpc_server_add_insecure_http2_port(s, port)); return s; } static grpc_channel* create_proxy_client(const char* target, grpc_channel_args* client_args) { - return grpc_insecure_channel_create(target, client_args, NULL); + return grpc_insecure_channel_create(target, client_args, nullptr); } static const grpc_end2end_proxy_def proxy_def = {create_proxy_server, @@ -65,8 +65,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( ffd->proxy = grpc_end2end_proxy_create(&proxy_def, client_args, server_args); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create_for_next(NULL); - f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); + f.cq = grpc_completion_queue_create_for_next(nullptr); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr); return f; } @@ -76,7 +76,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f, fullstack_fixture_data* ffd = static_cast(f->fixture_data); f->client = grpc_insecure_channel_create( - grpc_end2end_proxy_get_client_target(ffd->proxy), client_args, NULL); + grpc_end2end_proxy_get_client_target(ffd->proxy), client_args, nullptr); GPR_ASSERT(f->client); } @@ -87,8 +87,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f, if (f->server) { grpc_server_destroy(f->server); } - f->server = grpc_server_create(server_args, NULL); - grpc_server_register_completion_queue(f->server, f->cq, NULL); + f->server = grpc_server_create(server_args, nullptr); + grpc_server_register_completion_queue(f->server, f->cq, nullptr); GPR_ASSERT(grpc_server_add_insecure_http2_port( f->server, grpc_end2end_proxy_get_server_port(ffd->proxy))); grpc_server_start(f->server); diff --git a/test/core/end2end/fixtures/h2_sockpair+trace.cc b/test/core/end2end/fixtures/h2_sockpair+trace.cc index c5dfe40391725..fe4ab74843374 100644 --- a/test/core/end2end/fixtures/h2_sockpair+trace.cc +++ b/test/core/end2end/fixtures/h2_sockpair+trace.cc @@ -53,7 +53,7 @@ static void server_setup_transport(void* ts, grpc_transport* transport) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_endpoint_pair* sfd = static_cast(f->fixture_data); grpc_endpoint_add_to_pollset(&exec_ctx, sfd->server, grpc_cq_pollset(f->cq)); - grpc_server_setup_transport(&exec_ctx, f->server, transport, NULL, + grpc_server_setup_transport(&exec_ctx, f->server, transport, nullptr, grpc_server_get_channel_args(f->server)); grpc_exec_ctx_finish(&exec_ctx); } @@ -80,10 +80,10 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( grpc_end2end_test_fixture f; memset(&f, 0, sizeof(f)); f.fixture_data = sfd; - f.cq = grpc_completion_queue_create_for_next(NULL); - f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); + f.cq = grpc_completion_queue_create_for_next(nullptr); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr); - *sfd = grpc_iomgr_create_endpoint_pair("fixture", NULL); + *sfd = grpc_iomgr_create_endpoint_pair("fixture", nullptr); return f; } @@ -100,7 +100,7 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture* f, grpc_create_chttp2_transport(&exec_ctx, client_args, sfd->client, 1); client_setup_transport(&exec_ctx, &cs, transport); GPR_ASSERT(f->client); - grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL); + grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr); grpc_exec_ctx_finish(&exec_ctx); } @@ -110,13 +110,13 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f, grpc_endpoint_pair* sfd = static_cast(f->fixture_data); grpc_transport* transport; GPR_ASSERT(!f->server); - f->server = grpc_server_create(server_args, NULL); - grpc_server_register_completion_queue(f->server, f->cq, NULL); + f->server = grpc_server_create(server_args, nullptr); + grpc_server_register_completion_queue(f->server, f->cq, nullptr); grpc_server_start(f->server); transport = grpc_create_chttp2_transport(&exec_ctx, server_args, sfd->server, 0); server_setup_transport(f, transport); - grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL); + grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr); grpc_exec_ctx_finish(&exec_ctx); } diff --git a/test/core/end2end/fixtures/h2_sockpair.cc b/test/core/end2end/fixtures/h2_sockpair.cc index f07722e52d98a..59a3a6db31928 100644 --- a/test/core/end2end/fixtures/h2_sockpair.cc +++ b/test/core/end2end/fixtures/h2_sockpair.cc @@ -47,7 +47,7 @@ static void server_setup_transport(void* ts, grpc_transport* transport) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_endpoint_pair* sfd = static_cast(f->fixture_data); grpc_endpoint_add_to_pollset(&exec_ctx, sfd->server, grpc_cq_pollset(f->cq)); - grpc_server_setup_transport(&exec_ctx, f->server, transport, NULL, + grpc_server_setup_transport(&exec_ctx, f->server, transport, nullptr, grpc_server_get_channel_args(f->server)); grpc_exec_ctx_finish(&exec_ctx); } @@ -74,10 +74,10 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( grpc_end2end_test_fixture f; memset(&f, 0, sizeof(f)); f.fixture_data = sfd; - f.cq = grpc_completion_queue_create_for_next(NULL); - f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); + f.cq = grpc_completion_queue_create_for_next(nullptr); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr); - *sfd = grpc_iomgr_create_endpoint_pair("fixture", NULL); + *sfd = grpc_iomgr_create_endpoint_pair("fixture", nullptr); return f; } @@ -94,7 +94,7 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture* f, grpc_create_chttp2_transport(&exec_ctx, client_args, sfd->client, 1); client_setup_transport(&exec_ctx, &cs, transport); GPR_ASSERT(f->client); - grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL); + grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr); grpc_exec_ctx_finish(&exec_ctx); } @@ -104,13 +104,13 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f, grpc_endpoint_pair* sfd = static_cast(f->fixture_data); grpc_transport* transport; GPR_ASSERT(!f->server); - f->server = grpc_server_create(server_args, NULL); - grpc_server_register_completion_queue(f->server, f->cq, NULL); + f->server = grpc_server_create(server_args, nullptr); + grpc_server_register_completion_queue(f->server, f->cq, nullptr); grpc_server_start(f->server); transport = grpc_create_chttp2_transport(&exec_ctx, server_args, sfd->server, 0); server_setup_transport(f, transport); - grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL); + grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr); grpc_exec_ctx_finish(&exec_ctx); } diff --git a/test/core/end2end/fixtures/h2_sockpair_1byte.cc b/test/core/end2end/fixtures/h2_sockpair_1byte.cc index 7d00c69a18db0..d935efbbac4fe 100644 --- a/test/core/end2end/fixtures/h2_sockpair_1byte.cc +++ b/test/core/end2end/fixtures/h2_sockpair_1byte.cc @@ -47,7 +47,7 @@ static void server_setup_transport(void* ts, grpc_transport* transport) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_endpoint_pair* sfd = static_cast(f->fixture_data); grpc_endpoint_add_to_pollset(&exec_ctx, sfd->server, grpc_cq_pollset(f->cq)); - grpc_server_setup_transport(&exec_ctx, f->server, transport, NULL, + grpc_server_setup_transport(&exec_ctx, f->server, transport, nullptr, grpc_server_get_channel_args(f->server)); grpc_exec_ctx_finish(&exec_ctx); } @@ -74,8 +74,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_socketpair( grpc_end2end_test_fixture f; memset(&f, 0, sizeof(f)); f.fixture_data = sfd; - f.cq = grpc_completion_queue_create_for_next(NULL); - f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); + f.cq = grpc_completion_queue_create_for_next(nullptr); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr); grpc_arg a[3]; a[0].key = const_cast(GRPC_ARG_TCP_READ_CHUNK_SIZE); @@ -105,7 +105,7 @@ static void chttp2_init_client_socketpair(grpc_end2end_test_fixture* f, grpc_create_chttp2_transport(&exec_ctx, client_args, sfd->client, 1); client_setup_transport(&exec_ctx, &cs, transport); GPR_ASSERT(f->client); - grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL); + grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr); grpc_exec_ctx_finish(&exec_ctx); } @@ -115,13 +115,13 @@ static void chttp2_init_server_socketpair(grpc_end2end_test_fixture* f, grpc_endpoint_pair* sfd = static_cast(f->fixture_data); grpc_transport* transport; GPR_ASSERT(!f->server); - f->server = grpc_server_create(server_args, NULL); - grpc_server_register_completion_queue(f->server, f->cq, NULL); + f->server = grpc_server_create(server_args, nullptr); + grpc_server_register_completion_queue(f->server, f->cq, nullptr); grpc_server_start(f->server); transport = grpc_create_chttp2_transport(&exec_ctx, server_args, sfd->server, 0); server_setup_transport(f, transport); - grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL); + grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr); grpc_exec_ctx_finish(&exec_ctx); } diff --git a/test/core/end2end/fixtures/h2_ssl.cc b/test/core/end2end/fixtures/h2_ssl.cc index 70daefd333dfe..047b5d751014e 100644 --- a/test/core/end2end/fixtures/h2_ssl.cc +++ b/test/core/end2end/fixtures/h2_ssl.cc @@ -50,8 +50,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create_for_next(NULL); - f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); + f.cq = grpc_completion_queue_create_for_next(nullptr); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr); return f; } @@ -60,8 +60,8 @@ static void process_auth_failure(void* state, grpc_auth_context* ctx, const grpc_metadata* md, size_t md_count, grpc_process_auth_metadata_done_cb cb, void* user_data) { - GPR_ASSERT(state == NULL); - cb(user_data, NULL, 0, NULL, 0, GRPC_STATUS_UNAUTHENTICATED, NULL); + GPR_ASSERT(state == nullptr); + cb(user_data, nullptr, 0, nullptr, 0, GRPC_STATUS_UNAUTHENTICATED, nullptr); } static void chttp2_init_client_secure_fullstack( @@ -70,8 +70,8 @@ static void chttp2_init_client_secure_fullstack( fullstack_secure_fixture_data* ffd = static_cast(f->fixture_data); f->client = - grpc_secure_channel_create(creds, ffd->localaddr, client_args, NULL); - GPR_ASSERT(f->client != NULL); + grpc_secure_channel_create(creds, ffd->localaddr, client_args, nullptr); + GPR_ASSERT(f->client != nullptr); grpc_channel_credentials_release(creds); } @@ -83,8 +83,8 @@ static void chttp2_init_server_secure_fullstack( if (f->server) { grpc_server_destroy(f->server); } - f->server = grpc_server_create(server_args, NULL); - grpc_server_register_completion_queue(f->server, f->cq, NULL); + f->server = grpc_server_create(server_args, nullptr); + grpc_server_register_completion_queue(f->server, f->cq, nullptr); GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr, server_creds)); grpc_server_credentials_release(server_creds); @@ -101,7 +101,7 @@ void chttp2_tear_down_secure_fullstack(grpc_end2end_test_fixture* f) { static void chttp2_init_client_simple_ssl_secure_fullstack( grpc_end2end_test_fixture* f, grpc_channel_args* client_args) { grpc_channel_credentials* ssl_creds = - grpc_ssl_credentials_create(NULL, NULL, NULL); + grpc_ssl_credentials_create(nullptr, nullptr, nullptr); grpc_arg ssl_name_override = { GRPC_ARG_STRING, const_cast(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG), @@ -118,7 +118,7 @@ static void chttp2_init_client_simple_ssl_secure_fullstack( static int fail_server_auth_check(grpc_channel_args* server_args) { size_t i; - if (server_args == NULL) return 0; + if (server_args == nullptr) return 0; for (i = 0; i < server_args->num_args; i++) { if (strcmp(server_args->args[i].key, FAIL_AUTH_CHECK_SERVER_ARG_NAME) == 0) { @@ -133,9 +133,9 @@ static void chttp2_init_server_simple_ssl_secure_fullstack( grpc_ssl_pem_key_cert_pair pem_cert_key_pair = {test_server1_key, test_server1_cert}; grpc_server_credentials* ssl_creds = - grpc_ssl_server_credentials_create(NULL, &pem_cert_key_pair, 1, 0, NULL); + grpc_ssl_server_credentials_create(nullptr, &pem_cert_key_pair, 1, 0, nullptr); if (fail_server_auth_check(server_args)) { - grpc_auth_metadata_processor processor = {process_auth_failure, NULL, NULL}; + grpc_auth_metadata_processor processor = {process_auth_failure, nullptr, nullptr}; grpc_server_credentials_set_auth_metadata_processor(ssl_creds, processor); } chttp2_init_server_secure_fullstack(f, server_args, ssl_creds); @@ -166,8 +166,8 @@ int main(int argc, char** argv) { /* Set the SSL roots env var. */ roots_file = gpr_tmpfile("chttp2_simple_ssl_fullstack_test", &roots_filename); - GPR_ASSERT(roots_filename != NULL); - GPR_ASSERT(roots_file != NULL); + GPR_ASSERT(roots_filename != nullptr); + GPR_ASSERT(roots_file != nullptr); GPR_ASSERT(fwrite(test_root_cert, 1, roots_size, roots_file) == roots_size); fclose(roots_file); gpr_setenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR, roots_filename); diff --git a/test/core/end2end/fixtures/h2_ssl_proxy.cc b/test/core/end2end/fixtures/h2_ssl_proxy.cc index b3488a29e520c..7191210261d88 100644 --- a/test/core/end2end/fixtures/h2_ssl_proxy.cc +++ b/test/core/end2end/fixtures/h2_ssl_proxy.cc @@ -41,11 +41,11 @@ typedef struct fullstack_secure_fixture_data { static grpc_server* create_proxy_server(const char* port, grpc_channel_args* server_args) { - grpc_server* s = grpc_server_create(server_args, NULL); + grpc_server* s = grpc_server_create(server_args, nullptr); grpc_ssl_pem_key_cert_pair pem_cert_key_pair = {test_server1_key, test_server1_cert}; grpc_server_credentials* ssl_creds = - grpc_ssl_server_credentials_create(NULL, &pem_cert_key_pair, 1, 0, NULL); + grpc_ssl_server_credentials_create(nullptr, &pem_cert_key_pair, 1, 0, nullptr); GPR_ASSERT(grpc_server_add_secure_http2_port(s, port, ssl_creds)); grpc_server_credentials_release(ssl_creds); return s; @@ -55,7 +55,7 @@ static grpc_channel* create_proxy_client(const char* target, grpc_channel_args* client_args) { grpc_channel* channel; grpc_channel_credentials* ssl_creds = - grpc_ssl_credentials_create(NULL, NULL, NULL); + grpc_ssl_credentials_create(nullptr, nullptr, nullptr); grpc_arg ssl_name_override = { GRPC_ARG_STRING, const_cast(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG), @@ -63,7 +63,7 @@ static grpc_channel* create_proxy_client(const char* target, grpc_channel_args* new_client_args = grpc_channel_args_copy_and_add(client_args, &ssl_name_override, 1); channel = - grpc_secure_channel_create(ssl_creds, target, new_client_args, NULL); + grpc_secure_channel_create(ssl_creds, target, new_client_args, nullptr); grpc_channel_credentials_release(ssl_creds); { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; @@ -87,8 +87,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( ffd->proxy = grpc_end2end_proxy_create(&proxy_def, client_args, server_args); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create_for_next(NULL); - f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); + f.cq = grpc_completion_queue_create_for_next(nullptr); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr); return f; } @@ -97,8 +97,8 @@ static void process_auth_failure(void* state, grpc_auth_context* ctx, const grpc_metadata* md, size_t md_count, grpc_process_auth_metadata_done_cb cb, void* user_data) { - GPR_ASSERT(state == NULL); - cb(user_data, NULL, 0, NULL, 0, GRPC_STATUS_UNAUTHENTICATED, NULL); + GPR_ASSERT(state == nullptr); + cb(user_data, nullptr, 0, nullptr, 0, GRPC_STATUS_UNAUTHENTICATED, nullptr); } static void chttp2_init_client_secure_fullstack( @@ -108,8 +108,8 @@ static void chttp2_init_client_secure_fullstack( static_cast(f->fixture_data); f->client = grpc_secure_channel_create( creds, grpc_end2end_proxy_get_client_target(ffd->proxy), client_args, - NULL); - GPR_ASSERT(f->client != NULL); + nullptr); + GPR_ASSERT(f->client != nullptr); grpc_channel_credentials_release(creds); } @@ -121,8 +121,8 @@ static void chttp2_init_server_secure_fullstack( if (f->server) { grpc_server_destroy(f->server); } - f->server = grpc_server_create(server_args, NULL); - grpc_server_register_completion_queue(f->server, f->cq, NULL); + f->server = grpc_server_create(server_args, nullptr); + grpc_server_register_completion_queue(f->server, f->cq, nullptr); GPR_ASSERT(grpc_server_add_secure_http2_port( f->server, grpc_end2end_proxy_get_server_port(ffd->proxy), server_creds)); grpc_server_credentials_release(server_creds); @@ -139,7 +139,7 @@ void chttp2_tear_down_secure_fullstack(grpc_end2end_test_fixture* f) { static void chttp2_init_client_simple_ssl_secure_fullstack( grpc_end2end_test_fixture* f, grpc_channel_args* client_args) { grpc_channel_credentials* ssl_creds = - grpc_ssl_credentials_create(NULL, NULL, NULL); + grpc_ssl_credentials_create(nullptr, nullptr, nullptr); grpc_arg ssl_name_override = { GRPC_ARG_STRING, const_cast(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG), @@ -156,7 +156,7 @@ static void chttp2_init_client_simple_ssl_secure_fullstack( static int fail_server_auth_check(grpc_channel_args* server_args) { size_t i; - if (server_args == NULL) return 0; + if (server_args == nullptr) return 0; for (i = 0; i < server_args->num_args; i++) { if (strcmp(server_args->args[i].key, FAIL_AUTH_CHECK_SERVER_ARG_NAME) == 0) { @@ -171,9 +171,9 @@ static void chttp2_init_server_simple_ssl_secure_fullstack( grpc_ssl_pem_key_cert_pair pem_cert_key_pair = {test_server1_key, test_server1_cert}; grpc_server_credentials* ssl_creds = - grpc_ssl_server_credentials_create(NULL, &pem_cert_key_pair, 1, 0, NULL); + grpc_ssl_server_credentials_create(nullptr, &pem_cert_key_pair, 1, 0, nullptr); if (fail_server_auth_check(server_args)) { - grpc_auth_metadata_processor processor = {process_auth_failure, NULL, NULL}; + grpc_auth_metadata_processor processor = {process_auth_failure, nullptr, nullptr}; grpc_server_credentials_set_auth_metadata_processor(ssl_creds, processor); } chttp2_init_server_secure_fullstack(f, server_args, ssl_creds); @@ -205,8 +205,8 @@ int main(int argc, char** argv) { /* Set the SSL roots env var. */ roots_file = gpr_tmpfile("chttp2_simple_ssl_fullstack_test", &roots_filename); - GPR_ASSERT(roots_filename != NULL); - GPR_ASSERT(roots_file != NULL); + GPR_ASSERT(roots_filename != nullptr); + GPR_ASSERT(roots_file != nullptr); GPR_ASSERT(fwrite(test_root_cert, 1, roots_size, roots_file) == roots_size); fclose(roots_file); gpr_setenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR, roots_filename); diff --git a/test/core/end2end/fixtures/h2_uds.cc b/test/core/end2end/fixtures/h2_uds.cc index ba433df57b813..553244f800600 100644 --- a/test/core/end2end/fixtures/h2_uds.cc +++ b/test/core/end2end/fixtures/h2_uds.cc @@ -56,8 +56,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_fullstack( unique++); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create_for_next(NULL); - f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); + f.cq = grpc_completion_queue_create_for_next(nullptr); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr); return f; } @@ -66,7 +66,7 @@ void chttp2_init_client_fullstack(grpc_end2end_test_fixture* f, grpc_channel_args* client_args) { fullstack_fixture_data* ffd = static_cast(f->fixture_data); - f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, NULL); + f->client = grpc_insecure_channel_create(ffd->localaddr, client_args, nullptr); } void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f, @@ -76,8 +76,8 @@ void chttp2_init_server_fullstack(grpc_end2end_test_fixture* f, if (f->server) { grpc_server_destroy(f->server); } - f->server = grpc_server_create(server_args, NULL); - grpc_server_register_completion_queue(f->server, f->cq, NULL); + f->server = grpc_server_create(server_args, nullptr); + grpc_server_register_completion_queue(f->server, f->cq, nullptr); GPR_ASSERT(grpc_server_add_insecure_http2_port(f->server, ffd->localaddr)); grpc_server_start(f->server); } diff --git a/test/core/end2end/fixtures/http_proxy_fixture.cc b/test/core/end2end/fixtures/http_proxy_fixture.cc index d29401fdc3af6..ab4197e95ca46 100644 --- a/test/core/end2end/fixtures/http_proxy_fixture.cc +++ b/test/core/end2end/fixtures/http_proxy_fixture.cc @@ -108,7 +108,7 @@ static void proxy_connection_unref(grpc_exec_ctx* exec_ctx, gpr_log(GPR_DEBUG, "endpoints: %p %p", conn->client_endpoint, conn->server_endpoint); grpc_endpoint_destroy(exec_ctx, conn->client_endpoint); - if (conn->server_endpoint != NULL) { + if (conn->server_endpoint != nullptr) { grpc_endpoint_destroy(exec_ctx, conn->server_endpoint); } grpc_pollset_set_destroy(exec_ctx, conn->pollset_set); @@ -137,7 +137,7 @@ static void proxy_connection_failed(grpc_exec_ctx* exec_ctx, grpc_endpoint_shutdown(exec_ctx, conn->client_endpoint, GRPC_ERROR_REF(error)); - if (conn->server_endpoint != NULL) { + if (conn->server_endpoint != nullptr) { grpc_endpoint_shutdown(exec_ctx, conn->server_endpoint, GRPC_ERROR_REF(error)); } @@ -315,8 +315,8 @@ static void on_server_connect_done(grpc_exec_ctx* exec_ctx, void* arg, static bool proxy_auth_header_matches(grpc_exec_ctx* exec_ctx, char* proxy_auth_header_val, char* expected_cred) { - GPR_ASSERT(proxy_auth_header_val != NULL); - GPR_ASSERT(expected_cred != NULL); + GPR_ASSERT(proxy_auth_header_val != nullptr); + GPR_ASSERT(expected_cred != nullptr); if (strncmp(proxy_auth_header_val, "Basic ", 6) != 0) { return false; } @@ -349,7 +349,7 @@ static void on_read_request_done(grpc_exec_ctx* exec_ctx, void* arg, for (size_t i = 0; i < conn->client_read_buffer.count; ++i) { if (GRPC_SLICE_LENGTH(conn->client_read_buffer.slices[i]) > 0) { error = grpc_http_parser_parse(&conn->http_parser, - conn->client_read_buffer.slices[i], NULL); + conn->client_read_buffer.slices[i], nullptr); if (error != GRPC_ERROR_NONE) { proxy_connection_failed(exec_ctx, conn, true /* is_client */, "HTTP proxy request parse", error); @@ -380,7 +380,7 @@ static void on_read_request_done(grpc_exec_ctx* exec_ctx, void* arg, // If proxy auth is being used, check if the header is present and as expected const grpc_arg* proxy_auth_arg = grpc_channel_args_find( conn->proxy->channel_args, GRPC_ARG_HTTP_PROXY_AUTH_CREDS); - if (proxy_auth_arg != NULL && proxy_auth_arg->type == GRPC_ARG_STRING) { + if (proxy_auth_arg != nullptr && proxy_auth_arg->type == GRPC_ARG_STRING) { bool client_authenticated = false; for (size_t i = 0; i < conn->http_request.hdr_count; i++) { if (strcmp(conn->http_request.hdrs[i].key, "Proxy-Authorization") == 0) { @@ -400,7 +400,7 @@ static void on_read_request_done(grpc_exec_ctx* exec_ctx, void* arg, } } // Resolve address. - grpc_resolved_addresses* resolved_addresses = NULL; + grpc_resolved_addresses* resolved_addresses = nullptr; error = grpc_blocking_resolve_address(conn->http_request.path, "80", &resolved_addresses); if (error != GRPC_ERROR_NONE) { @@ -415,7 +415,7 @@ static void on_read_request_done(grpc_exec_ctx* exec_ctx, void* arg, const grpc_millis deadline = grpc_exec_ctx_now(exec_ctx) + 10 * GPR_MS_PER_SEC; grpc_tcp_client_connect(exec_ctx, &conn->on_server_connect_done, - &conn->server_endpoint, conn->pollset_set, NULL, + &conn->server_endpoint, conn->pollset_set, nullptr, &resolved_addresses->addrs[0], deadline); grpc_resolved_addresses_destroy(resolved_addresses); } @@ -469,7 +469,7 @@ static void thread_main(void* arg) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; do { gpr_ref(&proxy->users); - grpc_pollset_worker* worker = NULL; + grpc_pollset_worker* worker = nullptr; gpr_mu_lock(proxy->mu); GRPC_LOG_IF_ERROR( "grpc_pollset_work", @@ -496,7 +496,7 @@ grpc_end2end_http_proxy* grpc_end2end_http_proxy_create( // Create TCP server. proxy->channel_args = grpc_channel_args_copy(args); grpc_error* error = grpc_tcp_server_create( - &exec_ctx, NULL, proxy->channel_args, &proxy->server); + &exec_ctx, nullptr, proxy->channel_args, &proxy->server); GPR_ASSERT(error == GRPC_ERROR_NONE); // Bind to port. grpc_resolved_address resolved_addr; diff --git a/test/core/end2end/fixtures/inproc.cc b/test/core/end2end/fixtures/inproc.cc index 5107ed201882a..b748fbf09a015 100644 --- a/test/core/end2end/fixtures/inproc.cc +++ b/test/core/end2end/fixtures/inproc.cc @@ -47,15 +47,15 @@ static grpc_end2end_test_fixture inproc_create_fixture( memset(&f, 0, sizeof(f)); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create_for_next(NULL); - f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); + f.cq = grpc_completion_queue_create_for_next(nullptr); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr); return f; } void inproc_init_client(grpc_end2end_test_fixture* f, grpc_channel_args* client_args) { - f->client = grpc_inproc_channel_create(f->server, client_args, NULL); + f->client = grpc_inproc_channel_create(f->server, client_args, nullptr); GPR_ASSERT(f->client); } @@ -64,8 +64,8 @@ void inproc_init_server(grpc_end2end_test_fixture* f, if (f->server) { grpc_server_destroy(f->server); } - f->server = grpc_server_create(server_args, NULL); - grpc_server_register_completion_queue(f->server, f->cq, NULL); + f->server = grpc_server_create(server_args, nullptr); + grpc_server_register_completion_queue(f->server, f->cq, nullptr); grpc_server_start(f->server); } diff --git a/test/core/end2end/fixtures/proxy.cc b/test/core/end2end/fixtures/proxy.cc index 01c9e13538973..3d3eed495c964 100644 --- a/test/core/end2end/fixtures/proxy.cc +++ b/test/core/end2end/fixtures/proxy.cc @@ -89,11 +89,11 @@ grpc_end2end_proxy* grpc_end2end_proxy_create(const grpc_end2end_proxy_def* def, gpr_log(GPR_DEBUG, "PROXY ADDR:%s BACKEND:%s", proxy->proxy_port, proxy->server_port); - proxy->cq = grpc_completion_queue_create_for_next(NULL); + proxy->cq = grpc_completion_queue_create_for_next(nullptr); proxy->server = def->create_server(proxy->proxy_port, server_args); proxy->client = def->create_client(proxy->server_port, client_args); - grpc_server_register_completion_queue(proxy->server, proxy->cq, NULL); + grpc_server_register_completion_queue(proxy->server, proxy->cq, nullptr); grpc_server_start(proxy->server); grpc_call_details_init(&proxy->new_call_details); @@ -159,12 +159,12 @@ static void on_p2s_recv_initial_metadata(void* arg, int success) { if (!pc->proxy->shutdown) { op.op = GRPC_OP_SEND_INITIAL_METADATA; op.flags = 0; - op.reserved = NULL; + op.reserved = nullptr; op.data.send_initial_metadata.count = pc->p2s_initial_metadata.count; op.data.send_initial_metadata.metadata = pc->p2s_initial_metadata.metadata; refpc(pc, "on_c2p_sent_initial_metadata"); err = grpc_call_start_batch( - pc->c2p, &op, 1, new_closure(on_c2p_sent_initial_metadata, pc), NULL); + pc->c2p, &op, 1, new_closure(on_c2p_sent_initial_metadata, pc), nullptr); GPR_ASSERT(err == GRPC_CALL_OK); } @@ -187,11 +187,11 @@ static void on_p2s_sent_message(void* arg, int success) { if (!pc->proxy->shutdown && success) { op.op = GRPC_OP_RECV_MESSAGE; op.flags = 0; - op.reserved = NULL; + op.reserved = nullptr; op.data.recv_message.recv_message = &pc->c2p_msg; refpc(pc, "on_c2p_recv_msg"); err = grpc_call_start_batch(pc->c2p, &op, 1, - new_closure(on_c2p_recv_msg, pc), NULL); + new_closure(on_c2p_recv_msg, pc), nullptr); GPR_ASSERT(err == GRPC_CALL_OK); } @@ -209,26 +209,26 @@ static void on_c2p_recv_msg(void* arg, int success) { grpc_call_error err; if (!pc->proxy->shutdown && success) { - if (pc->c2p_msg != NULL) { + if (pc->c2p_msg != nullptr) { op.op = GRPC_OP_SEND_MESSAGE; op.flags = 0; - op.reserved = NULL; + op.reserved = nullptr; op.data.send_message.send_message = pc->c2p_msg; refpc(pc, "on_p2s_sent_message"); err = grpc_call_start_batch(pc->p2s, &op, 1, - new_closure(on_p2s_sent_message, pc), NULL); + new_closure(on_p2s_sent_message, pc), nullptr); GPR_ASSERT(err == GRPC_CALL_OK); } else { op.op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op.flags = 0; - op.reserved = NULL; + op.reserved = nullptr; refpc(pc, "on_p2s_sent_close"); err = grpc_call_start_batch(pc->p2s, &op, 1, - new_closure(on_p2s_sent_close, pc), NULL); + new_closure(on_p2s_sent_close, pc), nullptr); GPR_ASSERT(err == GRPC_CALL_OK); } } else { - if (pc->c2p_msg != NULL) { + if (pc->c2p_msg != nullptr) { grpc_byte_buffer_destroy(pc->c2p_msg); } } @@ -247,11 +247,11 @@ static void on_c2p_sent_message(void* arg, int success) { if (!pc->proxy->shutdown && success) { op.op = GRPC_OP_RECV_MESSAGE; op.flags = 0; - op.reserved = NULL; + op.reserved = nullptr; op.data.recv_message.recv_message = &pc->p2s_msg; refpc(pc, "on_p2s_recv_msg"); err = grpc_call_start_batch(pc->p2s, &op, 1, - new_closure(on_p2s_recv_msg, pc), NULL); + new_closure(on_p2s_recv_msg, pc), nullptr); GPR_ASSERT(err == GRPC_CALL_OK); } @@ -266,11 +266,11 @@ static void on_p2s_recv_msg(void* arg, int success) { if (!pc->proxy->shutdown && success && pc->p2s_msg) { op.op = GRPC_OP_SEND_MESSAGE; op.flags = 0; - op.reserved = NULL; + op.reserved = nullptr; op.data.send_message.send_message = pc->p2s_msg; refpc(pc, "on_c2p_sent_message"); err = grpc_call_start_batch(pc->c2p, &op, 1, - new_closure(on_c2p_sent_message, pc), NULL); + new_closure(on_c2p_sent_message, pc), nullptr); GPR_ASSERT(err == GRPC_CALL_OK); } else { grpc_byte_buffer_destroy(pc->p2s_msg); @@ -292,7 +292,7 @@ static void on_p2s_status(void* arg, int success) { GPR_ASSERT(success); op.op = GRPC_OP_SEND_STATUS_FROM_SERVER; op.flags = 0; - op.reserved = NULL; + op.reserved = nullptr; op.data.send_status_from_server.trailing_metadata_count = pc->p2s_trailing_metadata.count; op.data.send_status_from_server.trailing_metadata = @@ -301,7 +301,7 @@ static void on_p2s_status(void* arg, int success) { op.data.send_status_from_server.status_details = &pc->p2s_status_details; refpc(pc, "on_c2p_sent_status"); err = grpc_call_start_batch(pc->c2p, &op, 1, - new_closure(on_c2p_sent_status, pc), NULL); + new_closure(on_c2p_sent_status, pc), nullptr); GPR_ASSERT(err == GRPC_CALL_OK); } @@ -329,10 +329,10 @@ static void on_new_call(void* arg, int success) { pc->p2s = grpc_channel_create_call( proxy->client, pc->c2p, GRPC_PROPAGATE_DEFAULTS, proxy->cq, proxy->new_call_details.method, &proxy->new_call_details.host, - proxy->new_call_details.deadline, NULL); + proxy->new_call_details.deadline, nullptr); gpr_ref_init(&pc->refs, 1); - op.reserved = NULL; + op.reserved = nullptr; op.op = GRPC_OP_RECV_INITIAL_METADATA; op.flags = 0; @@ -340,7 +340,7 @@ static void on_new_call(void* arg, int success) { &pc->p2s_initial_metadata; refpc(pc, "on_p2s_recv_initial_metadata"); err = grpc_call_start_batch( - pc->p2s, &op, 1, new_closure(on_p2s_recv_initial_metadata, pc), NULL); + pc->p2s, &op, 1, new_closure(on_p2s_recv_initial_metadata, pc), nullptr); GPR_ASSERT(err == GRPC_CALL_OK); op.op = GRPC_OP_SEND_INITIAL_METADATA; @@ -349,7 +349,7 @@ static void on_new_call(void* arg, int success) { op.data.send_initial_metadata.metadata = pc->c2p_initial_metadata.metadata; refpc(pc, "on_p2s_sent_initial_metadata"); err = grpc_call_start_batch( - pc->p2s, &op, 1, new_closure(on_p2s_sent_initial_metadata, pc), NULL); + pc->p2s, &op, 1, new_closure(on_p2s_sent_initial_metadata, pc), nullptr); GPR_ASSERT(err == GRPC_CALL_OK); op.op = GRPC_OP_RECV_MESSAGE; @@ -357,7 +357,7 @@ static void on_new_call(void* arg, int success) { op.data.recv_message.recv_message = &pc->c2p_msg; refpc(pc, "on_c2p_recv_msg"); err = grpc_call_start_batch(pc->c2p, &op, 1, - new_closure(on_c2p_recv_msg, pc), NULL); + new_closure(on_c2p_recv_msg, pc), nullptr); GPR_ASSERT(err == GRPC_CALL_OK); op.op = GRPC_OP_RECV_MESSAGE; @@ -365,7 +365,7 @@ static void on_new_call(void* arg, int success) { op.data.recv_message.recv_message = &pc->p2s_msg; refpc(pc, "on_p2s_recv_msg"); err = grpc_call_start_batch(pc->p2s, &op, 1, - new_closure(on_p2s_recv_msg, pc), NULL); + new_closure(on_p2s_recv_msg, pc), nullptr); GPR_ASSERT(err == GRPC_CALL_OK); op.op = GRPC_OP_RECV_STATUS_ON_CLIENT; @@ -376,7 +376,7 @@ static void on_new_call(void* arg, int success) { op.data.recv_status_on_client.status_details = &pc->p2s_status_details; refpc(pc, "on_p2s_status"); err = grpc_call_start_batch(pc->p2s, &op, 1, new_closure(on_p2s_status, pc), - NULL); + nullptr); GPR_ASSERT(err == GRPC_CALL_OK); op.op = GRPC_OP_RECV_CLOSE_ON_SERVER; @@ -384,7 +384,7 @@ static void on_new_call(void* arg, int success) { op.data.recv_close_on_server.cancelled = &pc->c2p_server_cancelled; refpc(pc, "on_c2p_closed"); err = grpc_call_start_batch(pc->c2p, &op, 1, new_closure(on_c2p_closed, pc), - NULL); + nullptr); GPR_ASSERT(err == GRPC_CALL_OK); request_call(proxy); @@ -394,12 +394,12 @@ static void on_new_call(void* arg, int success) { unrefpc(pc, "init"); } else { - GPR_ASSERT(proxy->new_call == NULL); + GPR_ASSERT(proxy->new_call == nullptr); } } static void request_call(grpc_end2end_proxy* proxy) { - proxy->new_call = NULL; + proxy->new_call = nullptr; GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( proxy->server, &proxy->new_call, &proxy->new_call_details, @@ -412,7 +412,7 @@ static void thread_main(void* arg) { closure* cl; for (;;) { grpc_event ev = grpc_completion_queue_next( - proxy->cq, gpr_inf_future(GPR_CLOCK_MONOTONIC), NULL); + proxy->cq, gpr_inf_future(GPR_CLOCK_MONOTONIC), nullptr); switch (ev.type) { case GRPC_QUEUE_TIMEOUT: gpr_log(GPR_ERROR, "Should never reach here"); diff --git a/test/core/end2end/fuzzers/api_fuzzer.cc b/test/core/end2end/fuzzers/api_fuzzer.cc index 69a5670d22298..4ee063fc84aa4 100644 --- a/test/core/end2end/fuzzers/api_fuzzer.cc +++ b/test/core/end2end/fuzzers/api_fuzzer.cc @@ -84,7 +84,7 @@ static uint8_t next_byte(input_stream* inp) { static void end(input_stream* inp) { inp->cur = inp->end; } static char* read_string(input_stream* inp, bool* special) { - char* str = NULL; + char* str = nullptr; size_t cap = 0; size_t sz = 0; char c; @@ -96,7 +96,7 @@ static char* read_string(input_stream* inp, bool* special) { c = (char)next_byte(inp); str[sz++] = c; } while (c != 0 && c != 1); - if (special != NULL) { + if (special != nullptr) { *special = (c == 1); } if (c == 1) { @@ -109,10 +109,10 @@ static void read_buffer(input_stream* inp, char** buffer, size_t* length, bool* special) { *length = next_byte(inp); if (*length == 255) { - if (special != NULL) *special = true; + if (special != nullptr) *special = true; *length = next_byte(inp); } else { - if (special != NULL) *special = false; + if (special != nullptr) *special = false; } *buffer = static_cast(gpr_malloc(*length)); for (size_t i = 0; i < *length; i++) { @@ -201,12 +201,12 @@ static grpc_channel_args* read_args(input_stream* inp) { switch (next_byte(inp)) { case 1: args[i].type = GRPC_ARG_STRING; - args[i].key = read_string(inp, NULL); - args[i].value.string = read_string(inp, NULL); + args[i].key = read_string(inp, nullptr); + args[i].value.string = read_string(inp, nullptr); break; case 2: args[i].type = GRPC_ARG_INTEGER; - args[i].key = read_string(inp, NULL); + args[i].key = read_string(inp, nullptr); args[i].value.integer = read_int(inp); break; case 3: @@ -248,11 +248,11 @@ static const char* read_cred_artifact(cred_artifact_ctx* ctx, input_stream* inp, const char** builtins, size_t num_builtins) { uint8_t b = next_byte(inp); - if (b == 0) return NULL; - if (b == 1) return ctx->release[ctx->num_release++] = read_string(inp, NULL); + if (b == 0) return nullptr; + if (b == 1) return ctx->release[ctx->num_release++] = read_string(inp, nullptr); if (b >= num_builtins + 1) { end(inp); - return NULL; + return nullptr; } return builtins[b - 1]; } @@ -272,8 +272,8 @@ static grpc_channel_credentials* read_ssl_channel_creds(input_stream* inp) { GPR_ARRAY_SIZE(builtin_cert_chains)); grpc_ssl_pem_key_cert_pair key_cert_pair = {private_key, certs}; grpc_channel_credentials* creds = grpc_ssl_credentials_create( - root_certs, private_key != NULL && certs != NULL ? &key_cert_pair : NULL, - NULL); + root_certs, private_key != nullptr && certs != nullptr ? &key_cert_pair : nullptr, + nullptr); cred_artifact_ctx_finish(&ctx); return creds; } @@ -282,45 +282,45 @@ static grpc_call_credentials* read_call_creds(input_stream* inp) { switch (next_byte(inp)) { default: end(inp); - return NULL; + return nullptr; case 0: - return NULL; + return nullptr; case 1: { grpc_call_credentials* c1 = read_call_creds(inp); grpc_call_credentials* c2 = read_call_creds(inp); - if (c1 != NULL && c2 != NULL) { + if (c1 != nullptr && c2 != nullptr) { grpc_call_credentials* out = - grpc_composite_call_credentials_create(c1, c2, NULL); + grpc_composite_call_credentials_create(c1, c2, nullptr); grpc_call_credentials_release(c1); grpc_call_credentials_release(c2); return out; - } else if (c1 != NULL) { + } else if (c1 != nullptr) { return c1; - } else if (c2 != NULL) { + } else if (c2 != nullptr) { return c2; } else { - return NULL; + return nullptr; } - GPR_UNREACHABLE_CODE(return NULL); + GPR_UNREACHABLE_CODE(return nullptr); } case 2: { cred_artifact_ctx ctx = CRED_ARTIFACT_CTX_INIT; - const char* access_token = read_cred_artifact(&ctx, inp, NULL, 0); + const char* access_token = read_cred_artifact(&ctx, inp, nullptr, 0); grpc_call_credentials* out = - access_token == NULL - ? NULL - : grpc_access_token_credentials_create(access_token, NULL); + access_token == nullptr + ? nullptr + : grpc_access_token_credentials_create(access_token, nullptr); cred_artifact_ctx_finish(&ctx); return out; } case 3: { cred_artifact_ctx ctx = CRED_ARTIFACT_CTX_INIT; - const char* auth_token = read_cred_artifact(&ctx, inp, NULL, 0); - const char* auth_selector = read_cred_artifact(&ctx, inp, NULL, 0); - grpc_call_credentials* out = auth_token == NULL || auth_selector == NULL - ? NULL + const char* auth_token = read_cred_artifact(&ctx, inp, nullptr, 0); + const char* auth_selector = read_cred_artifact(&ctx, inp, nullptr, 0); + grpc_call_credentials* out = auth_token == nullptr || auth_selector == nullptr + ? nullptr : grpc_google_iam_credentials_create( - auth_token, auth_selector, NULL); + auth_token, auth_selector, nullptr); cred_artifact_ctx_finish(&ctx); return out; } @@ -336,9 +336,9 @@ static grpc_channel_credentials* read_channel_creds(input_stream* inp) { case 1: { grpc_channel_credentials* c1 = read_channel_creds(inp); grpc_call_credentials* c2 = read_call_creds(inp); - if (c1 != NULL && c2 != NULL) { + if (c1 != nullptr && c2 != nullptr) { grpc_channel_credentials* out = - grpc_composite_channel_credentials_create(c1, c2, NULL); + grpc_composite_channel_credentials_create(c1, c2, nullptr); grpc_channel_credentials_release(c1); grpc_call_credentials_release(c2); return out; @@ -346,17 +346,17 @@ static grpc_channel_credentials* read_channel_creds(input_stream* inp) { return c1; } else if (c2) { grpc_call_credentials_release(c2); - return NULL; + return nullptr; } else { - return NULL; + return nullptr; } - GPR_UNREACHABLE_CODE(return NULL); + GPR_UNREACHABLE_CODE(return nullptr); } case 2: - return NULL; + return nullptr; default: end(inp); - return NULL; + return nullptr; } } @@ -378,7 +378,7 @@ static void finish_resolve(grpc_exec_ctx* exec_ctx, void* arg, addr_req* r = static_cast(arg); if (error == GRPC_ERROR_NONE && 0 == strcmp(r->addr, "server")) { - if (r->addrs != NULL) { + if (r->addrs != nullptr) { grpc_resolved_addresses* addrs = static_cast(gpr_malloc(sizeof(*addrs))); addrs->naddrs = 1; @@ -386,9 +386,9 @@ static void finish_resolve(grpc_exec_ctx* exec_ctx, void* arg, gpr_malloc(sizeof(*addrs->addrs))); addrs->addrs[0].len = 0; *r->addrs = addrs; - } else if (r->lb_addrs != NULL) { - grpc_lb_addresses* lb_addrs = grpc_lb_addresses_create(1, NULL); - grpc_lb_addresses_set_address(lb_addrs, 0, NULL, 0, false, NULL, NULL); + } else if (r->lb_addrs != nullptr) { + grpc_lb_addresses* lb_addrs = grpc_lb_addresses_create(1, nullptr); + grpc_lb_addresses_set_address(lb_addrs, 0, nullptr, 0, false, nullptr, nullptr); *r->lb_addrs = lb_addrs; } GRPC_CLOSURE_SCHED(exec_ctx, r->on_done, GRPC_ERROR_NONE); @@ -411,7 +411,7 @@ void my_resolve_address(grpc_exec_ctx* exec_ctx, const char* addr, r->addr = gpr_strdup(addr); r->on_done = on_done; r->addrs = addresses; - r->lb_addrs = NULL; + r->lb_addrs = nullptr; grpc_timer_init( exec_ctx, &r->timer, GPR_MS_PER_SEC + grpc_exec_ctx_now(exec_ctx), GRPC_CLOSURE_CREATE(finish_resolve, r, grpc_schedule_on_exec_ctx)); @@ -425,12 +425,12 @@ grpc_ares_request* my_dns_lookup_ares( addr_req* r = static_cast(gpr_malloc(sizeof(*r))); r->addr = gpr_strdup(addr); r->on_done = on_done; - r->addrs = NULL; + r->addrs = nullptr; r->lb_addrs = lb_addrs; grpc_timer_init( exec_ctx, &r->timer, GPR_MS_PER_SEC + grpc_exec_ctx_now(exec_ctx), GRPC_CLOSURE_CREATE(finish_resolve, r, grpc_schedule_on_exec_ctx)); - return NULL; + return nullptr; } //////////////////////////////////////////////////////////////////////////////// @@ -455,18 +455,18 @@ typedef struct { static void do_connect(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) { future_connect* fc = static_cast(arg); if (error != GRPC_ERROR_NONE) { - *fc->ep = NULL; + *fc->ep = nullptr; GRPC_CLOSURE_SCHED(exec_ctx, fc->closure, GRPC_ERROR_REF(error)); - } else if (g_server != NULL) { + } else if (g_server != nullptr) { grpc_endpoint* client; grpc_endpoint* server; - grpc_passthru_endpoint_create(&client, &server, g_resource_quota, NULL); + grpc_passthru_endpoint_create(&client, &server, g_resource_quota, nullptr); *fc->ep = client; grpc_transport* transport = - grpc_create_chttp2_transport(exec_ctx, NULL, server, 0); - grpc_server_setup_transport(exec_ctx, g_server, transport, NULL, NULL); - grpc_chttp2_transport_start_reading(exec_ctx, transport, NULL); + grpc_create_chttp2_transport(exec_ctx, nullptr, server, 0); + grpc_server_setup_transport(exec_ctx, g_server, transport, nullptr, nullptr); + grpc_chttp2_transport_start_reading(exec_ctx, transport, nullptr); GRPC_CLOSURE_SCHED(exec_ctx, fc->closure, GRPC_ERROR_NONE); } else { @@ -478,7 +478,7 @@ static void do_connect(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) { static void sched_connect(grpc_exec_ctx* exec_ctx, grpc_closure* closure, grpc_endpoint** ep, gpr_timespec deadline) { if (gpr_time_cmp(deadline, gpr_now(deadline.clock_type)) < 0) { - *ep = NULL; + *ep = nullptr; GRPC_CLOSURE_SCHED( exec_ctx, closure, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Connect deadline exceeded")); @@ -551,7 +551,7 @@ static void validate_connectivity_watch(void* p, bool success) { } static void free_non_null(void* p) { - GPR_ASSERT(p != NULL); + GPR_ASSERT(p != nullptr); gpr_free(p); } @@ -594,7 +594,7 @@ static call_state* g_active_call; static call_state* new_call(call_state* sibling, call_state_type type) { call_state* c = static_cast(gpr_malloc(sizeof(*c))); memset(c, 0, sizeof(*c)); - if (sibling != NULL) { + if (sibling != nullptr) { c->next = sibling; c->prev = sibling->prev; c->next->prev = c->prev->next = c; @@ -608,7 +608,7 @@ static call_state* new_call(call_state* sibling, call_state_type type) { static call_state* maybe_delete_call_state(call_state* call) { call_state* next = call->next; - if (call->call != NULL) return next; + if (call->call != nullptr) return next; if (call->pending_ops != 0) return next; if (call == g_active_call) { @@ -682,7 +682,7 @@ static void read_metadata(input_stream* inp, size_t* count, static call_state* destroy_call(call_state* call) { grpc_call_unref(call->call); - call->call = NULL; + call->call = nullptr; return maybe_delete_call_state(call); } @@ -691,7 +691,7 @@ static void finished_request_call(void* csp, bool success) { GPR_ASSERT(cs->pending_ops > 0); --cs->pending_ops; if (success) { - GPR_ASSERT(cs->call != NULL); + GPR_ASSERT(cs->call != nullptr); cs->type = SERVER; } else { maybe_delete_call_state(cs); @@ -708,16 +708,16 @@ static void finished_batch(void* p, bool success) { --bi->cs->pending_ops; if ((bi->has_ops & (1u << GRPC_OP_RECV_MESSAGE)) && (bi->cs->done_flags & DONE_FLAG_CALL_CLOSED)) { - GPR_ASSERT(bi->cs->recv_message == NULL); + GPR_ASSERT(bi->cs->recv_message == nullptr); } if ((bi->has_ops & (1u << GRPC_OP_RECV_MESSAGE) && - bi->cs->recv_message != NULL)) { + bi->cs->recv_message != nullptr)) { grpc_byte_buffer_destroy(bi->cs->recv_message); - bi->cs->recv_message = NULL; + bi->cs->recv_message = nullptr; } if ((bi->has_ops & (1u << GRPC_OP_SEND_MESSAGE))) { grpc_byte_buffer_destroy(bi->cs->send_message); - bi->cs->send_message = NULL; + bi->cs->send_message = nullptr; } if ((bi->has_ops & (1u << GRPC_OP_RECV_STATUS_ON_CLIENT)) || (bi->has_ops & (1u << GRPC_OP_RECV_CLOSE_ON_SERVER))) { @@ -738,7 +738,7 @@ static validator* make_finished_batch_validator(call_state* cs, extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_test_only_set_slice_hash_seed(0); char* grpc_trace_fuzzer = gpr_getenv("GRPC_TRACE_FUZZER"); - if (squelch && grpc_trace_fuzzer == NULL) gpr_set_log_function(dont_log); + if (squelch && grpc_trace_fuzzer == nullptr) gpr_set_log_function(dont_log); gpr_free(grpc_trace_fuzzer); input_stream inp = {data, data + size}; grpc_tcp_client_connect_impl = my_tcp_client_connect; @@ -753,28 +753,28 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_resolve_address = my_resolve_address; grpc_dns_lookup_ares = my_dns_lookup_ares; - GPR_ASSERT(g_channel == NULL); - GPR_ASSERT(g_server == NULL); + GPR_ASSERT(g_channel == nullptr); + GPR_ASSERT(g_server == nullptr); bool server_shutdown = false; int pending_server_shutdowns = 0; int pending_channel_watches = 0; int pending_pings = 0; - g_active_call = new_call(NULL, ROOT); + g_active_call = new_call(nullptr, ROOT); g_resource_quota = grpc_resource_quota_create("api_fuzzer"); - grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL); + grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr); - while (!is_eof(&inp) || g_channel != NULL || g_server != NULL || + while (!is_eof(&inp) || g_channel != nullptr || g_server != nullptr || pending_channel_watches > 0 || pending_pings > 0 || g_active_call->type != ROOT || g_active_call->next != g_active_call) { if (is_eof(&inp)) { - if (g_channel != NULL) { + if (g_channel != nullptr) { grpc_channel_destroy(g_channel); - g_channel = NULL; + g_channel = nullptr; } - if (g_server != NULL) { + if (g_server != nullptr) { if (!server_shutdown) { grpc_server_shutdown_and_notify( g_server, cq, @@ -784,12 +784,12 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { pending_server_shutdowns++; } else if (pending_server_shutdowns == 0) { grpc_server_destroy(g_server); - g_server = NULL; + g_server = nullptr; } } call_state* s = g_active_call; do { - if (s->type != PENDING_SERVER && s->call != NULL) { + if (s->type != PENDING_SERVER && s->call != nullptr) { s = destroy_call(s); } else { s = s->next; @@ -809,7 +809,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { // tickle completion queue case 0: { grpc_event ev = grpc_completion_queue_next( - cq, gpr_inf_past(GPR_CLOCK_REALTIME), NULL); + cq, gpr_inf_past(GPR_CLOCK_REALTIME), nullptr); switch (ev.type) { case GRPC_OP_COMPLETE: { validator* v = static_cast(ev.tag); @@ -833,13 +833,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { } // create an insecure channel case 2: { - if (g_channel == NULL) { - char* target = read_string(&inp, NULL); + if (g_channel == nullptr) { + char* target = read_string(&inp, nullptr); char* target_uri; gpr_asprintf(&target_uri, "dns:%s", target); grpc_channel_args* args = read_args(&inp); - g_channel = grpc_insecure_channel_create(target_uri, args, NULL); - GPR_ASSERT(g_channel != NULL); + g_channel = grpc_insecure_channel_create(target_uri, args, nullptr); + GPR_ASSERT(g_channel != nullptr); { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_channel_args_destroy(&exec_ctx, args); @@ -854,9 +854,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { } // destroy a channel case 3: { - if (g_channel != NULL) { + if (g_channel != nullptr) { grpc_channel_destroy(g_channel); - g_channel = NULL; + g_channel = nullptr; } else { end(&inp); } @@ -864,16 +864,16 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { } // bring up a server case 4: { - if (g_server == NULL) { + if (g_server == nullptr) { grpc_channel_args* args = read_args(&inp); - g_server = grpc_server_create(args, NULL); - GPR_ASSERT(g_server != NULL); + g_server = grpc_server_create(args, nullptr); + GPR_ASSERT(g_server != nullptr); { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_channel_args_destroy(&exec_ctx, args); grpc_exec_ctx_finish(&exec_ctx); } - grpc_server_register_completion_queue(g_server, cq, NULL); + grpc_server_register_completion_queue(g_server, cq, nullptr); grpc_server_start(g_server); server_shutdown = false; GPR_ASSERT(pending_server_shutdowns == 0); @@ -884,7 +884,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { } // begin server shutdown case 5: { - if (g_server != NULL) { + if (g_server != nullptr) { grpc_server_shutdown_and_notify( g_server, cq, create_validator(assert_success_and_decrement, @@ -898,7 +898,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { } // cancel all calls if shutdown case 6: { - if (g_server != NULL && server_shutdown) { + if (g_server != nullptr && server_shutdown) { grpc_server_cancel_all_calls(g_server); } else { end(&inp); @@ -907,10 +907,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { } // destroy server case 7: { - if (g_server != NULL && server_shutdown && + if (g_server != nullptr && server_shutdown && pending_server_shutdowns == 0) { grpc_server_destroy(g_server); - g_server = NULL; + g_server = nullptr; } else { end(&inp); } @@ -918,7 +918,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { } // check connectivity case 8: { - if (g_channel != NULL) { + if (g_channel != nullptr) { uint8_t try_to_connect = next_byte(&inp); if (try_to_connect == 0 || try_to_connect == 1) { grpc_channel_check_connectivity_state(g_channel, try_to_connect); @@ -932,7 +932,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { } // watch connectivity case 9: { - if (g_channel != NULL) { + if (g_channel != nullptr) { grpc_connectivity_state st = grpc_channel_check_connectivity_state(g_channel, 0); if (st != GRPC_CHANNEL_SHUTDOWN) { @@ -954,10 +954,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { // create a call case 10: { bool ok = true; - if (g_channel == NULL) ok = false; - grpc_call* parent_call = NULL; + if (g_channel == nullptr) ok = false; + grpc_call* parent_call = nullptr; if (g_active_call->type != ROOT) { - if (g_active_call->call == NULL || g_active_call->type == CLIENT) { + if (g_active_call->call == nullptr || g_active_call->type == CLIENT) { end(&inp); break; } @@ -977,7 +977,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { call_state* cs = new_call(g_active_call, CLIENT); cs->call = grpc_channel_create_call(g_channel, parent_call, propagation_mask, - cq, method, &host, deadline, NULL); + cq, method, &host, deadline, nullptr); } else { end(&inp); } @@ -993,7 +993,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { // queue some ops on a call case 12: { if (g_active_call->type == PENDING_SERVER || - g_active_call->type == ROOT || g_active_call->call == NULL) { + g_active_call->type == ROOT || g_active_call->call == nullptr) { end(&inp); break; } @@ -1026,7 +1026,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { break; case GRPC_OP_SEND_MESSAGE: op->op = GRPC_OP_SEND_MESSAGE; - if (g_active_call->send_message != NULL) { + if (g_active_call->send_message != nullptr) { ok = false; } else { has_ops |= 1 << GRPC_OP_SEND_MESSAGE; @@ -1078,14 +1078,14 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { &g_active_call->cancelled; break; } - op->reserved = NULL; + op->reserved = nullptr; op->flags = read_uint32(&inp); } if (ok) { validator* v = make_finished_batch_validator(g_active_call, has_ops); g_active_call->pending_ops++; grpc_call_error error = - grpc_call_start_batch(g_active_call->call, ops, num_ops, v, NULL); + grpc_call_start_batch(g_active_call->call, ops, num_ops, v, nullptr); if (error != GRPC_CALL_OK) { v->validate(v->arg, false); gpr_free(v); @@ -1095,7 +1095,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { } if (!ok && (has_ops & (1 << GRPC_OP_SEND_MESSAGE))) { grpc_byte_buffer_destroy(g_active_call->send_message); - g_active_call->send_message = NULL; + g_active_call->send_message = nullptr; } gpr_free(ops); @@ -1103,8 +1103,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { } // cancel current call case 13: { - if (g_active_call->type != ROOT && g_active_call->call != NULL) { - grpc_call_cancel(g_active_call->call, NULL); + if (g_active_call->type != ROOT && g_active_call->call != nullptr) { + grpc_call_cancel(g_active_call->call, nullptr); } else { end(&inp); } @@ -1112,7 +1112,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { } // get a calls peer case 14: { - if (g_active_call->type != ROOT && g_active_call->call != NULL) { + if (g_active_call->type != ROOT && g_active_call->call != nullptr) { free_non_null(grpc_call_get_peer(g_active_call->call)); } else { end(&inp); @@ -1121,7 +1121,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { } // get a channels target case 15: { - if (g_channel != NULL) { + if (g_channel != nullptr) { free_non_null(grpc_channel_get_target(g_channel)); } else { end(&inp); @@ -1130,10 +1130,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { } // send a ping on a channel case 16: { - if (g_channel != NULL) { + if (g_channel != nullptr) { pending_pings++; grpc_channel_ping(g_channel, cq, - create_validator(decrement, &pending_pings), NULL); + create_validator(decrement, &pending_pings), nullptr); } else { end(&inp); } @@ -1141,21 +1141,21 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { } // enable a tracer case 17: { - char* tracer = read_string(&inp, NULL); + char* tracer = read_string(&inp, nullptr); grpc_tracer_set_enabled(tracer, 1); gpr_free(tracer); break; } // disable a tracer case 18: { - char* tracer = read_string(&inp, NULL); + char* tracer = read_string(&inp, nullptr); grpc_tracer_set_enabled(tracer, 0); gpr_free(tracer); break; } // request a server call case 19: { - if (g_server == NULL) { + if (g_server == nullptr) { end(&inp); break; } @@ -1175,7 +1175,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { case 20: { if (g_active_call->type != ROOT && g_active_call->type != PENDING_SERVER && - g_active_call->call != NULL) { + g_active_call->call != nullptr) { destroy_call(g_active_call); } else { end(&inp); @@ -1189,14 +1189,14 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { } // create a secure channel case 22: { - if (g_channel == NULL) { - char* target = read_string(&inp, NULL); + if (g_channel == nullptr) { + char* target = read_string(&inp, nullptr); char* target_uri; gpr_asprintf(&target_uri, "dns:%s", target); grpc_channel_args* args = read_args(&inp); grpc_channel_credentials* creds = read_channel_creds(&inp); - g_channel = grpc_secure_channel_create(creds, target_uri, args, NULL); - GPR_ASSERT(g_channel != NULL); + g_channel = grpc_secure_channel_create(creds, target_uri, args, nullptr); + GPR_ASSERT(g_channel != nullptr); { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_channel_args_destroy(&exec_ctx, args); @@ -1213,15 +1213,15 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { } } - GPR_ASSERT(g_channel == NULL); - GPR_ASSERT(g_server == NULL); + GPR_ASSERT(g_channel == nullptr); + GPR_ASSERT(g_server == nullptr); GPR_ASSERT(g_active_call->type == ROOT); GPR_ASSERT(g_active_call->next == g_active_call); gpr_free(g_active_call); grpc_completion_queue_shutdown(cq); GPR_ASSERT( - grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), NULL) + grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), nullptr) .type == GRPC_QUEUE_SHUTDOWN); grpc_completion_queue_destroy(cq); diff --git a/test/core/end2end/fuzzers/client_fuzzer.cc b/test/core/end2end/fuzzers/client_fuzzer.cc index d90ec40a27f0f..e4255a7a0af0d 100644 --- a/test/core/end2end/fuzzers/client_fuzzer.cc +++ b/test/core/end2end/fuzzers/client_fuzzer.cc @@ -52,21 +52,21 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_mock_endpoint_create(discard_write, resource_quota); grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); - grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL); + grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr); grpc_transport* transport = - grpc_create_chttp2_transport(&exec_ctx, NULL, mock_endpoint, 1); - grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL); + grpc_create_chttp2_transport(&exec_ctx, nullptr, mock_endpoint, 1); + grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr); grpc_channel* channel = grpc_channel_create( - &exec_ctx, "test-target", NULL, GRPC_CLIENT_DIRECT_CHANNEL, transport); + &exec_ctx, "test-target", nullptr, GRPC_CLIENT_DIRECT_CHANNEL, transport); grpc_slice host = grpc_slice_from_static_string("localhost"); grpc_call* call = grpc_channel_create_call( - channel, NULL, 0, cq, grpc_slice_from_static_string("/foo"), &host, - gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + channel, nullptr, 0, cq, grpc_slice_from_static_string("/foo"), &host, + gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); grpc_metadata_array initial_metadata_recv; grpc_metadata_array_init(&initial_metadata_recv); - grpc_byte_buffer* response_payload_recv = NULL; + grpc_byte_buffer* response_payload_recv = nullptr; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array_init(&trailing_metadata_recv); grpc_status_code status; @@ -78,31 +78,31 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 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_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &response_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; grpc_call_error error = - grpc_call_start_batch(call, ops, (size_t)(op - ops), tag(1), NULL); + grpc_call_start_batch(call, ops, (size_t)(op - ops), tag(1), nullptr); int requested_calls = 1; GPR_ASSERT(GRPC_CALL_OK == error); @@ -113,7 +113,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_event ev; while (1) { grpc_exec_ctx_flush(&exec_ctx); - ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), NULL); + ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), nullptr); switch (ev.type) { case GRPC_QUEUE_TIMEOUT: goto done; @@ -127,15 +127,15 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { done: if (requested_calls) { - grpc_call_cancel(call, NULL); + grpc_call_cancel(call, nullptr); } for (int i = 0; i < requested_calls; i++) { - ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), NULL); + ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), nullptr); GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); } grpc_completion_queue_shutdown(cq); for (int i = 0; i < requested_calls; i++) { - ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), NULL); + ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), nullptr); GPR_ASSERT(ev.type == GRPC_QUEUE_SHUTDOWN); } grpc_call_unref(call); @@ -144,7 +144,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_metadata_array_destroy(&trailing_metadata_recv); grpc_slice_unref(details); grpc_channel_destroy(channel); - if (response_payload_recv != NULL) { + if (response_payload_recv != nullptr) { grpc_byte_buffer_destroy(response_payload_recv); } grpc_shutdown(); diff --git a/test/core/end2end/fuzzers/server_fuzzer.cc b/test/core/end2end/fuzzers/server_fuzzer.cc index 87bccc70cd769..177f6b47c4982 100644 --- a/test/core/end2end/fuzzers/server_fuzzer.cc +++ b/test/core/end2end/fuzzers/server_fuzzer.cc @@ -53,19 +53,19 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { &exec_ctx, mock_endpoint, grpc_slice_from_copied_buffer((const char*)data, size)); - grpc_server* server = grpc_server_create(NULL, NULL); - grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL); - grpc_server_register_completion_queue(server, cq, NULL); + grpc_server* server = grpc_server_create(nullptr, nullptr); + grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr); + grpc_server_register_completion_queue(server, cq, nullptr); // TODO(ctiller): add registered methods (one for POST, one for PUT) // void *registered_method = // grpc_server_register_method(server, "/reg", NULL, 0); grpc_server_start(server); grpc_transport* transport = - grpc_create_chttp2_transport(&exec_ctx, NULL, mock_endpoint, 0); - grpc_server_setup_transport(&exec_ctx, server, transport, NULL, NULL); - grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL); + grpc_create_chttp2_transport(&exec_ctx, nullptr, mock_endpoint, 0); + grpc_server_setup_transport(&exec_ctx, server, transport, nullptr, nullptr); + grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr); - grpc_call* call1 = NULL; + grpc_call* call1 = nullptr; grpc_call_details call_details1; grpc_metadata_array request_metadata1; grpc_call_details_init(&call_details1); @@ -80,7 +80,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_event ev; while (1) { grpc_exec_ctx_flush(&exec_ctx); - ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), NULL); + ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), nullptr); switch (ev.type) { case GRPC_QUEUE_TIMEOUT: goto done; @@ -97,18 +97,18 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { } done: - if (call1 != NULL) grpc_call_unref(call1); + if (call1 != nullptr) grpc_call_unref(call1); grpc_call_details_destroy(&call_details1); grpc_metadata_array_destroy(&request_metadata1); grpc_server_shutdown_and_notify(server, cq, tag(0xdead)); grpc_server_cancel_all_calls(server); for (int i = 0; i <= requested_calls; i++) { - ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), NULL); + ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), nullptr); GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); } grpc_completion_queue_shutdown(cq); for (int i = 0; i <= requested_calls; i++) { - ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), NULL); + ev = grpc_completion_queue_next(cq, gpr_inf_past(GPR_CLOCK_REALTIME), nullptr); GPR_ASSERT(ev.type == GRPC_QUEUE_SHUTDOWN); } grpc_server_destroy(server); diff --git a/test/core/end2end/goaway_server_test.cc b/test/core/end2end/goaway_server_test.cc index 12a966d05a53f..1d37848b3f4c8 100644 --- a/test/core/end2end/goaway_server_test.cc +++ b/test/core/end2end/goaway_server_test.cc @@ -106,19 +106,19 @@ static grpc_ares_request* my_dns_lookup_ares( gpr_mu_unlock(&g_mu); error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Forced Failure"); } else { - *lb_addrs = grpc_lb_addresses_create(1, NULL); + *lb_addrs = grpc_lb_addresses_create(1, nullptr); struct sockaddr_in* sa = static_cast( gpr_zalloc(sizeof(struct sockaddr_in))); sa->sin_family = AF_INET; sa->sin_addr.s_addr = htonl(0x7f000001); sa->sin_port = htons((uint16_t)g_resolve_port); - grpc_lb_addresses_set_address(*lb_addrs, 0, sa, sizeof(*sa), false, NULL, - NULL); + grpc_lb_addresses_set_address(*lb_addrs, 0, sa, sizeof(*sa), false, nullptr, + nullptr); gpr_free(sa); gpr_mu_unlock(&g_mu); } GRPC_CLOSURE_SCHED(exec_ctx, on_done, error); - return NULL; + return nullptr; } int main(int argc, char** argv) { @@ -157,7 +157,7 @@ int main(int argc, char** argv) { grpc_metadata_array_init(&request_metadata2); grpc_call_details_init(&request_details2); - cq = grpc_completion_queue_create_for_next(NULL); + cq = grpc_completion_queue_create_for_next(nullptr); cqv = cq_verifier_create(cq); /* reserve two ports */ @@ -176,24 +176,24 @@ int main(int argc, char** argv) { client_args.num_args = 1; /* create a channel that picks first amongst the servers */ - grpc_channel* chan = grpc_insecure_channel_create("test", &client_args, NULL); + grpc_channel* chan = grpc_insecure_channel_create("test", &client_args, nullptr); /* and an initial call to them */ grpc_slice host = grpc_slice_from_static_string("127.0.0.1"); grpc_call* call1 = - grpc_channel_create_call(chan, NULL, GRPC_PROPAGATE_DEFAULTS, cq, + grpc_channel_create_call(chan, nullptr, GRPC_PROPAGATE_DEFAULTS, cq, grpc_slice_from_static_string("/foo"), &host, - grpc_timeout_seconds_to_deadline(20), NULL); + grpc_timeout_seconds_to_deadline(20), nullptr); /* send initial metadata to probe connectivity */ memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call1, ops, (size_t)(op - ops), - tag(0x101), NULL)); + tag(0x101), nullptr)); /* and receive status to probe termination */ memset(ops, 0, sizeof(ops)); op = ops; @@ -202,17 +202,17 @@ int main(int argc, char** argv) { op->data.recv_status_on_client.status = &status1; op->data.recv_status_on_client.status_details = &details1; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call1, ops, (size_t)(op - ops), - tag(0x102), NULL)); + tag(0x102), nullptr)); /* bring a server up on the first port */ - grpc_server* server1 = grpc_server_create(NULL, NULL); + grpc_server* server1 = grpc_server_create(nullptr, nullptr); gpr_asprintf(&addr, "127.0.0.1:%d", port1); grpc_server_add_insecure_http2_port(server1, addr); - grpc_server_register_completion_queue(server1, cq, NULL); + grpc_server_register_completion_queue(server1, cq, nullptr); gpr_free(addr); grpc_server_start(server1); @@ -244,7 +244,7 @@ int main(int argc, char** argv) { op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(server_call1, ops, (size_t)(op - ops), - tag(0x302), NULL)); + tag(0x302), nullptr)); /* shutdown first server: * we should see a connectivity change and then nothing */ @@ -256,20 +256,20 @@ int main(int argc, char** argv) { /* and a new call: should go through to server2 when we start it */ grpc_call* call2 = - grpc_channel_create_call(chan, NULL, GRPC_PROPAGATE_DEFAULTS, cq, + grpc_channel_create_call(chan, nullptr, GRPC_PROPAGATE_DEFAULTS, cq, grpc_slice_from_static_string("/foo"), &host, - grpc_timeout_seconds_to_deadline(20), NULL); + grpc_timeout_seconds_to_deadline(20), nullptr); /* send initial metadata to probe connectivity */ memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call2, ops, (size_t)(op - ops), - tag(0x201), NULL)); + tag(0x201), nullptr)); /* and receive status to probe termination */ memset(ops, 0, sizeof(ops)); op = ops; @@ -278,18 +278,18 @@ int main(int argc, char** argv) { op->data.recv_status_on_client.status = &status2; op->data.recv_status_on_client.status_details = &details2; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call2, ops, (size_t)(op - ops), - tag(0x202), NULL)); + tag(0x202), nullptr)); /* and bring up second server */ set_resolve_port(port2); - grpc_server* server2 = grpc_server_create(NULL, NULL); + grpc_server* server2 = grpc_server_create(nullptr, nullptr); gpr_asprintf(&addr, "127.0.0.1:%d", port2); grpc_server_add_insecure_http2_port(server2, addr); - grpc_server_register_completion_queue(server2, cq, NULL); + grpc_server_register_completion_queue(server2, cq, nullptr); gpr_free(addr); grpc_server_start(server2); @@ -313,14 +313,14 @@ int main(int argc, char** argv) { op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(server_call2, ops, (size_t)(op - ops), - tag(0x402), NULL)); + tag(0x402), nullptr)); /* shutdown second server: we should see nothing */ grpc_server_shutdown_and_notify(server2, cq, tag(0xdead2)); cq_verify_empty(cqv); - grpc_call_cancel(call1, NULL); - grpc_call_cancel(call2, NULL); + grpc_call_cancel(call1, nullptr); + grpc_call_cancel(call2, nullptr); /* now everything else should finish */ CQ_EXPECT_COMPLETION(cqv, tag(0x102), 1); diff --git a/test/core/end2end/h2_ssl_cert_test.cc b/test/core/end2end/h2_ssl_cert_test.cc index 8994b63e5fffa..9a98c071585b2 100644 --- a/test/core/end2end/h2_ssl_cert_test.cc +++ b/test/core/end2end/h2_ssl_cert_test.cc @@ -56,8 +56,8 @@ static grpc_end2end_test_fixture chttp2_create_fixture_secure_fullstack( gpr_join_host_port(&ffd->localaddr, "localhost", port); f.fixture_data = ffd; - f.cq = grpc_completion_queue_create_for_next(NULL); - f.shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); + f.cq = grpc_completion_queue_create_for_next(nullptr); + f.shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr); return f; } @@ -66,8 +66,8 @@ static void process_auth_failure(void* state, grpc_auth_context* ctx, const grpc_metadata* md, size_t md_count, grpc_process_auth_metadata_done_cb cb, void* user_data) { - GPR_ASSERT(state == NULL); - cb(user_data, NULL, 0, NULL, 0, GRPC_STATUS_UNAUTHENTICATED, NULL); + GPR_ASSERT(state == nullptr); + cb(user_data, nullptr, 0, nullptr, 0, GRPC_STATUS_UNAUTHENTICATED, nullptr); } static void chttp2_init_client_secure_fullstack( @@ -76,8 +76,8 @@ static void chttp2_init_client_secure_fullstack( fullstack_secure_fixture_data* ffd = static_cast(f->fixture_data); f->client = - grpc_secure_channel_create(creds, ffd->localaddr, client_args, NULL); - GPR_ASSERT(f->client != NULL); + grpc_secure_channel_create(creds, ffd->localaddr, client_args, nullptr); + GPR_ASSERT(f->client != nullptr); grpc_channel_credentials_release(creds); } @@ -89,8 +89,8 @@ static void chttp2_init_server_secure_fullstack( if (f->server) { grpc_server_destroy(f->server); } - f->server = grpc_server_create(server_args, NULL); - grpc_server_register_completion_queue(f->server, f->cq, NULL); + f->server = grpc_server_create(server_args, nullptr); + grpc_server_register_completion_queue(f->server, f->cq, nullptr); GPR_ASSERT(grpc_server_add_secure_http2_port(f->server, ffd->localaddr, server_creds)); grpc_server_credentials_release(server_creds); @@ -106,7 +106,7 @@ void chttp2_tear_down_secure_fullstack(grpc_end2end_test_fixture* f) { static int fail_server_auth_check(grpc_channel_args* server_args) { size_t i; - if (server_args == NULL) return 0; + if (server_args == nullptr) return 0; for (i = 0; i < server_args->num_args; i++) { if (strcmp(server_args->args[i].key, FAIL_AUTH_CHECK_SERVER_ARG_NAME) == 0) { @@ -267,7 +267,7 @@ static gpr_timespec five_seconds_time(void) { return n_seconds_time(5); } static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_time(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_time(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -276,16 +276,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -308,9 +308,9 @@ static void simple_request_body(grpc_end2end_test_fixture f, grpc_call_error error; grpc_slice host = grpc_slice_from_static_string("foo.test.google.fr:1234"); - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), &host, - deadline, NULL); + deadline, nullptr); GPR_ASSERT(c); memset(ops, 0, sizeof(ops)); @@ -318,9 +318,9 @@ static void simple_request_body(grpc_end2end_test_fixture f, op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = GRPC_INITIAL_METADATA_WAIT_FOR_READY; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(1), expected_result == SUCCESS); @@ -367,8 +367,8 @@ int main(int argc, char** argv) { /* Set the SSL roots env var. */ roots_file = gpr_tmpfile("chttp2_simple_ssl_cert_fullstack_test", &roots_filename); - GPR_ASSERT(roots_filename != NULL); - GPR_ASSERT(roots_file != NULL); + GPR_ASSERT(roots_filename != nullptr); + GPR_ASSERT(roots_file != nullptr); GPR_ASSERT(fwrite(test_root_cert, 1, roots_size, roots_file) == roots_size); fclose(roots_file); gpr_setenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR, roots_filename); diff --git a/test/core/end2end/invalid_call_argument_test.cc b/test/core/end2end/invalid_call_argument_test.cc index c310a0e9bae41..ff7f7100954e7 100644 --- a/test/core/end2end/invalid_call_argument_test.cc +++ b/test/core/end2end/invalid_call_argument_test.cc @@ -60,7 +60,7 @@ static void prepare_test(int is_client) { grpc_metadata_array_init(&g_state.initial_metadata_recv); grpc_metadata_array_init(&g_state.trailing_metadata_recv); g_state.deadline = grpc_timeout_seconds_to_deadline(5); - g_state.cq = grpc_completion_queue_create_for_next(NULL); + g_state.cq = grpc_completion_queue_create_for_next(nullptr); g_state.cqv = cq_verifier_create(g_state.cq); g_state.details = grpc_empty_slice(); memset(g_state.ops, 0, sizeof(g_state.ops)); @@ -68,36 +68,36 @@ static void prepare_test(int is_client) { if (is_client) { /* create a call, channel to a non existant server */ g_state.chan = - grpc_insecure_channel_create("nonexistant:54321", NULL, NULL); + grpc_insecure_channel_create("nonexistant:54321", nullptr, nullptr); grpc_slice host = grpc_slice_from_static_string("nonexistant"); g_state.call = grpc_channel_create_call( - g_state.chan, NULL, GRPC_PROPAGATE_DEFAULTS, g_state.cq, - grpc_slice_from_static_string("/Foo"), &host, g_state.deadline, NULL); + g_state.chan, nullptr, GRPC_PROPAGATE_DEFAULTS, g_state.cq, + grpc_slice_from_static_string("/Foo"), &host, g_state.deadline, nullptr); } else { - g_state.server = grpc_server_create(NULL, NULL); - grpc_server_register_completion_queue(g_state.server, g_state.cq, NULL); + g_state.server = grpc_server_create(nullptr, nullptr); + grpc_server_register_completion_queue(g_state.server, g_state.cq, nullptr); gpr_join_host_port(&server_hostport, "0.0.0.0", port); grpc_server_add_insecure_http2_port(g_state.server, server_hostport); grpc_server_start(g_state.server); gpr_free(server_hostport); gpr_join_host_port(&server_hostport, "localhost", port); - g_state.chan = grpc_insecure_channel_create(server_hostport, NULL, NULL); + g_state.chan = grpc_insecure_channel_create(server_hostport, nullptr, nullptr); gpr_free(server_hostport); grpc_slice host = grpc_slice_from_static_string("bar"); g_state.call = grpc_channel_create_call( - g_state.chan, NULL, GRPC_PROPAGATE_DEFAULTS, g_state.cq, - grpc_slice_from_static_string("/Foo"), &host, g_state.deadline, NULL); + g_state.chan, nullptr, GRPC_PROPAGATE_DEFAULTS, g_state.cq, + grpc_slice_from_static_string("/Foo"), &host, g_state.deadline, nullptr); grpc_metadata_array_init(&g_state.server_initial_metadata_recv); grpc_call_details_init(&g_state.call_details); op = g_state.ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = GRPC_INITIAL_METADATA_WAIT_FOR_READY; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(g_state.call, g_state.ops, (size_t)(op - g_state.ops), - tag(1), NULL)); + tag(1), nullptr)); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call(g_state.server, &g_state.server_call, &g_state.call_details, @@ -119,12 +119,12 @@ static void cleanup_test() { grpc_metadata_array_destroy(&g_state.trailing_metadata_recv); if (!g_state.is_client) { - shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); + shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr); grpc_call_unref(g_state.server_call); grpc_server_shutdown_and_notify(g_state.server, shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_completion_queue_destroy(shutdown_cq); grpc_server_destroy(g_state.server); @@ -133,7 +133,7 @@ static void cleanup_test() { } grpc_completion_queue_shutdown(g_state.cq); while (grpc_completion_queue_next(g_state.cq, - gpr_inf_future(GPR_CLOCK_REALTIME), NULL) + gpr_inf_future(GPR_CLOCK_REALTIME), nullptr) .type != GRPC_QUEUE_SHUTDOWN) ; grpc_completion_queue_destroy(g_state.cq); @@ -144,7 +144,7 @@ static void test_non_null_reserved_on_start_batch() { prepare_test(1); GPR_ASSERT(GRPC_CALL_ERROR == - grpc_call_start_batch(g_state.call, NULL, 0, NULL, tag(1))); + grpc_call_start_batch(g_state.call, nullptr, 0, nullptr, tag(1))); cleanup_test(); } @@ -162,7 +162,7 @@ static void test_non_null_reserved_on_op() { op++; GPR_ASSERT(GRPC_CALL_ERROR == grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), tag(1), NULL)); + (size_t)(op - g_state.ops), tag(1), nullptr)); cleanup_test(); } @@ -176,11 +176,11 @@ static void test_send_initial_metadata_more_than_once() { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(g_state.call, g_state.ops, (size_t)(op - g_state.ops), - tag(1), NULL)); + tag(1), nullptr)); CQ_EXPECT_COMPLETION(g_state.cqv, tag(1), 0); cq_verify(g_state.cqv); @@ -188,11 +188,11 @@ static void test_send_initial_metadata_more_than_once() { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS == grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), tag(1), NULL)); + (size_t)(op - g_state.ops), tag(1), nullptr)); cleanup_test(); } @@ -206,11 +206,11 @@ static void test_too_many_metadata() { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = (size_t)INT_MAX + 1; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_INVALID_METADATA == grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), tag(1), NULL)); + (size_t)(op - g_state.ops), tag(1), nullptr)); cleanup_test(); } @@ -224,16 +224,16 @@ static void test_send_null_message() { 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_SEND_MESSAGE; - op->data.send_message.send_message = NULL; + op->data.send_message.send_message = nullptr; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_INVALID_MESSAGE == grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), tag(1), NULL)); + (size_t)(op - g_state.ops), tag(1), nullptr)); cleanup_test(); } @@ -250,21 +250,21 @@ static void test_send_messages_at_the_same_time() { 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_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = static_cast(tag(2)); op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS == grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), tag(1), NULL)); + (size_t)(op - g_state.ops), tag(1), nullptr)); grpc_byte_buffer_destroy(request_payload); cleanup_test(); } @@ -282,11 +282,11 @@ static void test_send_server_status_from_client() { grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_NOT_ON_CLIENT == grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), tag(1), NULL)); + (size_t)(op - g_state.ops), tag(1), nullptr)); cleanup_test(); } @@ -300,11 +300,11 @@ static void test_receive_initial_metadata_twice_at_client() { op->data.recv_initial_metadata.recv_initial_metadata = &g_state.initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(g_state.call, g_state.ops, (size_t)(op - g_state.ops), - tag(1), NULL)); + tag(1), nullptr)); CQ_EXPECT_COMPLETION(g_state.cqv, tag(1), 0); cq_verify(g_state.cqv); op = g_state.ops; @@ -312,11 +312,11 @@ static void test_receive_initial_metadata_twice_at_client() { op->data.recv_initial_metadata.recv_initial_metadata = &g_state.initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS == grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), tag(1), NULL)); + (size_t)(op - g_state.ops), tag(1), nullptr)); cleanup_test(); } @@ -324,17 +324,17 @@ static void test_receive_message_with_invalid_flags() { gpr_log(GPR_INFO, "test_receive_message_with_invalid_flags"); grpc_op* op; - grpc_byte_buffer* payload = NULL; + grpc_byte_buffer* payload = nullptr; prepare_test(1); op = g_state.ops; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &payload; op->flags = 1; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_INVALID_FLAGS == grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), tag(1), NULL)); + (size_t)(op - g_state.ops), tag(1), nullptr)); cleanup_test(); } @@ -342,22 +342,22 @@ static void test_receive_two_messages_at_the_same_time() { gpr_log(GPR_INFO, "test_receive_two_messages_at_the_same_time"); grpc_op* op; - grpc_byte_buffer* payload = NULL; + grpc_byte_buffer* payload = nullptr; prepare_test(1); op = g_state.ops; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS == grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), tag(1), NULL)); + (size_t)(op - g_state.ops), tag(1), nullptr)); cleanup_test(); } @@ -369,13 +369,13 @@ static void test_recv_close_on_server_from_client() { op = g_state.ops; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; - op->data.recv_close_on_server.cancelled = NULL; + op->data.recv_close_on_server.cancelled = nullptr; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_NOT_ON_CLIENT == grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), tag(1), NULL)); + (size_t)(op - g_state.ops), tag(1), nullptr)); cleanup_test(); } @@ -392,25 +392,25 @@ static void test_recv_status_on_client_twice() { op->data.recv_status_on_client.status = &g_state.status; op->data.recv_status_on_client.status_details = &g_state.details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(g_state.call, g_state.ops, (size_t)(op - g_state.ops), - tag(1), NULL)); + tag(1), nullptr)); CQ_EXPECT_COMPLETION(g_state.cqv, tag(1), 1); cq_verify(g_state.cqv); op = g_state.ops; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; - op->data.recv_status_on_client.trailing_metadata = NULL; - op->data.recv_status_on_client.status = NULL; - op->data.recv_status_on_client.status_details = NULL; + op->data.recv_status_on_client.trailing_metadata = nullptr; + op->data.recv_status_on_client.status = nullptr; + op->data.recv_status_on_client.status_details = nullptr; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS == grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), tag(1), NULL)); + (size_t)(op - g_state.ops), tag(1), nullptr)); cleanup_test(); } @@ -423,11 +423,11 @@ static void test_send_close_from_client_on_server() { op = g_state.ops; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_NOT_ON_SERVER == grpc_call_start_batch(g_state.server_call, g_state.ops, - (size_t)(op - g_state.ops), tag(2), NULL)); + (size_t)(op - g_state.ops), tag(2), nullptr)); cleanup_test(); } @@ -444,11 +444,11 @@ static void test_recv_status_on_client_from_server() { op->data.recv_status_on_client.status = &g_state.status; op->data.recv_status_on_client.status_details = &g_state.details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_NOT_ON_SERVER == grpc_call_start_batch(g_state.server_call, g_state.ops, - (size_t)(op - g_state.ops), tag(2), NULL)); + (size_t)(op - g_state.ops), tag(2), nullptr)); cleanup_test(); } @@ -465,11 +465,11 @@ static void test_send_status_from_server_with_invalid_flags() { grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 1; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_INVALID_FLAGS == grpc_call_start_batch(g_state.server_call, g_state.ops, - (size_t)(op - g_state.ops), tag(2), NULL)); + (size_t)(op - g_state.ops), tag(2), nullptr)); cleanup_test(); } @@ -487,11 +487,11 @@ static void test_too_many_trailing_metadata() { grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_INVALID_METADATA == grpc_call_start_batch(g_state.server_call, g_state.ops, - (size_t)(op - g_state.ops), tag(2), NULL)); + (size_t)(op - g_state.ops), tag(2), nullptr)); cleanup_test(); } @@ -508,18 +508,18 @@ static void test_send_server_status_twice() { grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS == grpc_call_start_batch(g_state.server_call, g_state.ops, - (size_t)(op - g_state.ops), tag(2), NULL)); + (size_t)(op - g_state.ops), tag(2), nullptr)); cleanup_test(); } @@ -531,13 +531,13 @@ static void test_recv_close_on_server_with_invalid_flags() { op = g_state.ops; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; - op->data.recv_close_on_server.cancelled = NULL; + op->data.recv_close_on_server.cancelled = nullptr; op->flags = 1; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_INVALID_FLAGS == grpc_call_start_batch(g_state.server_call, g_state.ops, - (size_t)(op - g_state.ops), tag(2), NULL)); + (size_t)(op - g_state.ops), tag(2), nullptr)); cleanup_test(); } @@ -549,18 +549,18 @@ static void test_recv_close_on_server_twice() { op = g_state.ops; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; - op->data.recv_close_on_server.cancelled = NULL; + op->data.recv_close_on_server.cancelled = nullptr; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; - op->data.recv_close_on_server.cancelled = NULL; + op->data.recv_close_on_server.cancelled = nullptr; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_TOO_MANY_OPERATIONS == grpc_call_start_batch(g_state.server_call, g_state.ops, - (size_t)(op - g_state.ops), tag(2), NULL)); + (size_t)(op - g_state.ops), tag(2), nullptr)); cleanup_test(); } @@ -578,11 +578,11 @@ static void test_invalid_initial_metadata_reserved_key() { op->data.send_initial_metadata.count = 1; op->data.send_initial_metadata.metadata = &metadata; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_ERROR_INVALID_METADATA == grpc_call_start_batch(g_state.call, g_state.ops, - (size_t)(op - g_state.ops), tag(1), NULL)); + (size_t)(op - g_state.ops), tag(1), nullptr)); cleanup_test(); } diff --git a/test/core/end2end/multiple_server_queues_test.cc b/test/core/end2end/multiple_server_queues_test.cc index 8036ca54b271e..dfa3b48b52d3c 100644 --- a/test/core/end2end/multiple_server_queues_test.cc +++ b/test/core/end2end/multiple_server_queues_test.cc @@ -34,33 +34,33 @@ int main(int argc, char** argv) { attr.cq_completion_type = GRPC_CQ_NEXT; attr.cq_polling_type = GRPC_CQ_DEFAULT_POLLING; cq1 = grpc_completion_queue_create( - grpc_completion_queue_factory_lookup(&attr), &attr, NULL); + grpc_completion_queue_factory_lookup(&attr), &attr, nullptr); attr.cq_polling_type = GRPC_CQ_NON_LISTENING; cq2 = grpc_completion_queue_create( - grpc_completion_queue_factory_lookup(&attr), &attr, NULL); + grpc_completion_queue_factory_lookup(&attr), &attr, nullptr); attr.cq_polling_type = GRPC_CQ_NON_POLLING; cq3 = grpc_completion_queue_create( - grpc_completion_queue_factory_lookup(&attr), &attr, NULL); + grpc_completion_queue_factory_lookup(&attr), &attr, nullptr); - server = grpc_server_create(NULL, NULL); - grpc_server_register_completion_queue(server, cq1, NULL); + server = grpc_server_create(nullptr, nullptr); + grpc_server_register_completion_queue(server, cq1, nullptr); grpc_server_add_insecure_http2_port(server, "[::]:0"); - grpc_server_register_completion_queue(server, cq2, NULL); - grpc_server_register_completion_queue(server, cq3, NULL); + grpc_server_register_completion_queue(server, cq2, nullptr); + grpc_server_register_completion_queue(server, cq3, nullptr); grpc_server_start(server); - grpc_server_shutdown_and_notify(server, cq2, NULL); + grpc_server_shutdown_and_notify(server, cq2, nullptr); grpc_completion_queue_next(cq2, gpr_inf_future(GPR_CLOCK_REALTIME), - NULL); /* cue queue hang */ + nullptr); /* cue queue hang */ grpc_completion_queue_shutdown(cq1); grpc_completion_queue_shutdown(cq2); grpc_completion_queue_shutdown(cq3); - grpc_completion_queue_next(cq1, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); - grpc_completion_queue_next(cq2, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); - grpc_completion_queue_next(cq3, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + grpc_completion_queue_next(cq1, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); + grpc_completion_queue_next(cq2, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); + grpc_completion_queue_next(cq3, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); grpc_server_destroy(server); grpc_completion_queue_destroy(cq1); diff --git a/test/core/end2end/no_server_test.cc b/test/core/end2end/no_server_test.cc index a69b7bc8d6697..a35ec575fdb6d 100644 --- a/test/core/end2end/no_server_test.cc +++ b/test/core/end2end/no_server_test.cc @@ -44,32 +44,32 @@ int main(int argc, char** argv) { grpc_metadata_array_init(&trailing_metadata_recv); - cq = grpc_completion_queue_create_for_next(NULL); + cq = grpc_completion_queue_create_for_next(nullptr); cqv = cq_verifier_create(cq); /* create a call, channel to a non existant server */ - chan = grpc_insecure_channel_create("nonexistant:54321", NULL, NULL); + chan = grpc_insecure_channel_create("nonexistant:54321", nullptr, nullptr); grpc_slice host = grpc_slice_from_static_string("nonexistant"); - call = grpc_channel_create_call(chan, NULL, GRPC_PROPAGATE_DEFAULTS, cq, + call = grpc_channel_create_call(chan, nullptr, GRPC_PROPAGATE_DEFAULTS, cq, grpc_slice_from_static_string("/Foo"), &host, - deadline, NULL); + deadline, nullptr); memset(ops, 0, sizeof(ops)); op = ops; 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_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch( - call, ops, (size_t)(op - ops), tag(1), NULL)); + call, ops, (size_t)(op - ops), tag(1), nullptr)); /* verify that all tags get completed */ CQ_EXPECT_COMPLETION(cqv, tag(1), 1); cq_verify(cqv); @@ -78,7 +78,7 @@ int main(int argc, char** argv) { grpc_completion_queue_shutdown(cq); while ( - grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL) + grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr) .type != GRPC_QUEUE_SHUTDOWN) ; grpc_completion_queue_destroy(cq); diff --git a/test/core/end2end/tests/authority_not_supported.cc b/test/core/end2end/tests/authority_not_supported.cc index 62fb02ab56e30..9c8545058c8e8 100644 --- a/test/core/end2end/tests/authority_not_supported.cc +++ b/test/core/end2end/tests/authority_not_supported.cc @@ -53,7 +53,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -62,16 +62,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -94,28 +94,28 @@ static void test_with_authority_header(grpc_end2end_test_config config) { grpc_metadata meta_c[2] = {{grpc_slice_from_static_string("key1"), grpc_slice_from_static_string("val1"), 0, - {{NULL, NULL, NULL, NULL}}}, + {{nullptr, nullptr, nullptr, nullptr}}}, {grpc_slice_from_static_string("key2"), grpc_slice_from_static_string("val2"), 0, - {{NULL, NULL, NULL, NULL}}}}; + {{nullptr, nullptr, nullptr, nullptr}}}}; grpc_end2end_test_fixture f = - begin_test(config, "test_with_authority_header", NULL, NULL); + begin_test(config, "test_with_authority_header", nullptr, nullptr); cq_verifier* cqv = cq_verifier_create(f.cq); grpc_op ops[6]; grpc_op* op; grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; - grpc_byte_buffer* response_payload_recv = NULL; + grpc_byte_buffer* response_payload_recv = nullptr; grpc_status_code status; grpc_call_error error; grpc_slice details; grpc_slice host = grpc_slice_from_static_string("foo.test.google.fr"); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), &host, - deadline, NULL); + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -127,35 +127,35 @@ static void test_with_authority_header(grpc_end2end_test_config config) { op->data.send_initial_metadata.count = 2; op->data.send_initial_metadata.metadata = meta_c; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &response_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(1), 1); diff --git a/test/core/end2end/tests/bad_hostname.cc b/test/core/end2end/tests/bad_hostname.cc index c54cb8ed34b22..97ef62b5e349d 100644 --- a/test/core/end2end/tests/bad_hostname.cc +++ b/test/core/end2end/tests/bad_hostname.cc @@ -55,7 +55,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -64,16 +64,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -101,9 +101,9 @@ static void simple_request_body(grpc_end2end_test_fixture f) { grpc_slice host = grpc_slice_from_static_string("slartibartfast.local"); gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), &host, - deadline, NULL); + deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -116,25 +116,25 @@ static void simple_request_body(grpc_end2end_test_fixture f) { 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_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(1), 1); @@ -156,7 +156,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { static void test_invoke_simple_request(grpc_end2end_test_config config) { grpc_end2end_test_fixture f; - f = begin_test(config, "test_invoke_simple_request", NULL, NULL); + f = begin_test(config, "test_invoke_simple_request", nullptr, nullptr); simple_request_body(f); end_test(&f); config.tear_down_data(&f); diff --git a/test/core/end2end/tests/bad_ping.cc b/test/core/end2end/tests/bad_ping.cc index 648061587c61f..30a1b8de77472 100644 --- a/test/core/end2end/tests/bad_ping.cc +++ b/test/core/end2end/tests/bad_ping.cc @@ -37,20 +37,20 @@ static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { ev = grpc_completion_queue_next(cq, grpc_timeout_seconds_to_deadline(5), - NULL); + nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void shutdown_server(grpc_end2end_test_fixture* f) { if (!f->server) return; grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -64,7 +64,7 @@ static void end_test(grpc_end2end_test_fixture* f) { } static void test_bad_ping(grpc_end2end_test_config config) { - grpc_end2end_test_fixture f = config.create_fixture(NULL, NULL); + grpc_end2end_test_fixture f = config.create_fixture(nullptr, nullptr); cq_verifier* cqv = cq_verifier_create(f.cq); grpc_arg client_a[3]; client_a[0].type = GRPC_ARG_INTEGER; @@ -109,10 +109,10 @@ static void test_bad_ping(grpc_end2end_test_config config) { int was_cancelled = 2; c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -124,27 +124,27 @@ static void test_bad_ping(grpc_end2end_test_config config) { op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; - op->data.send_initial_metadata.metadata = NULL; + op->data.send_initial_metadata.metadata = nullptr; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -160,7 +160,7 @@ static void test_bad_ping(grpc_end2end_test_config config) { // needed here. int i; for (i = 1; i <= MAX_PING_STRIKES + 1; i++) { - grpc_channel_ping(f.client, f.cq, tag(200 + i), NULL); + grpc_channel_ping(f.client, f.cq, tag(200 + i), nullptr); CQ_EXPECT_COMPLETION(cqv, tag(200 + i), 1); if (i == MAX_PING_STRIKES + 1) { CQ_EXPECT_COMPLETION(cqv, tag(1), 1); @@ -173,7 +173,7 @@ static void test_bad_ping(grpc_end2end_test_config config) { 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_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -181,14 +181,14 @@ static void test_bad_ping(grpc_end2end_test_config config) { grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); diff --git a/test/core/end2end/tests/binary_metadata.cc b/test/core/end2end/tests/binary_metadata.cc index 52f0c708623db..b22bd35711c9d 100644 --- a/test/core/end2end/tests/binary_metadata.cc +++ b/test/core/end2end/tests/binary_metadata.cc @@ -53,7 +53,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -62,16 +62,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -102,33 +102,33 @@ static void test_request_response_with_metadata_and_payload( grpc_slice_from_static_string( "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc"), 0, - {{NULL, NULL, NULL, NULL}}}, + {{nullptr, nullptr, nullptr, nullptr}}}, {grpc_slice_from_static_string("key2-bin"), grpc_slice_from_static_string( "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d"), 0, - {{NULL, NULL, NULL, NULL}}}}; + {{nullptr, nullptr, nullptr, nullptr}}}}; grpc_metadata meta_s[2] = { {grpc_slice_from_static_string("key3-bin"), grpc_slice_from_static_string( "\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee"), 0, - {{NULL, NULL, NULL, NULL}}}, + {{nullptr, nullptr, nullptr, nullptr}}}, {grpc_slice_from_static_string("key4-bin"), grpc_slice_from_static_string( "\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"), 0, - {{NULL, NULL, NULL, NULL}}}}; + {{nullptr, nullptr, nullptr, nullptr}}}}; grpc_end2end_test_fixture f = begin_test( - config, "test_request_response_with_metadata_and_payload", NULL, NULL); + config, "test_request_response_with_metadata_and_payload", nullptr, nullptr); cq_verifier* cqv = cq_verifier_create(f.cq); grpc_op ops[6]; grpc_op* op; grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; - grpc_byte_buffer* request_payload_recv = NULL; - grpc_byte_buffer* response_payload_recv = NULL; + grpc_byte_buffer* request_payload_recv = nullptr; + grpc_byte_buffer* response_payload_recv = nullptr; grpc_call_details call_details; grpc_status_code status; grpc_call_error error; @@ -137,10 +137,10 @@ static void test_request_response_with_metadata_and_payload( gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -154,35 +154,35 @@ static void test_request_response_with_metadata_and_payload( op->data.send_initial_metadata.count = 2; op->data.send_initial_metadata.metadata = meta_c; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &response_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -198,14 +198,14 @@ static void test_request_response_with_metadata_and_payload( op->data.send_initial_metadata.count = 2; op->data.send_initial_metadata.metadata = meta_s; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &request_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -216,12 +216,12 @@ static void test_request_response_with_metadata_and_payload( op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = response_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -244,9 +244,9 @@ static void test_request_response_with_metadata_and_payload( "\xfd\xfe\xff"); op->data.send_status_from_server.status_details = &status_string; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(103), 1); diff --git a/test/core/end2end/tests/call_creds.cc b/test/core/end2end/tests/call_creds.cc index fc550b7733b37..fb9d8554cef2b 100644 --- a/test/core/end2end/tests/call_creds.cc +++ b/test/core/end2end/tests/call_creds.cc @@ -45,19 +45,19 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, int fail_server_auth_check) { grpc_end2end_test_fixture f; gpr_log(GPR_INFO, "Running test: %s/%s", test_name, config.name); - f = config.create_fixture(NULL, NULL); - config.init_client(&f, NULL); + f = config.create_fixture(nullptr, nullptr); + config.init_client(&f, nullptr); if (fail_server_auth_check) { grpc_arg fail_auth_arg = { GRPC_ARG_STRING, const_cast(FAIL_AUTH_CHECK_SERVER_ARG_NAME), - {NULL}}; + {nullptr}}; grpc_channel_args args; args.num_args = 1; args.args = &fail_auth_arg; config.init_server(&f, &args); } else { - config.init_server(&f, NULL); + config.init_server(&f, nullptr); } return f; } @@ -73,7 +73,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -82,16 +82,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -111,12 +111,12 @@ static void print_auth_context(int is_client, const grpc_auth_context* ctx) { gpr_log(GPR_INFO, "\tauthenticated: %s", grpc_auth_context_peer_is_authenticated(ctx) ? "YES" : "NO"); it = grpc_auth_context_peer_identity(ctx); - while ((p = grpc_auth_property_iterator_next(&it)) != NULL) { + while ((p = grpc_auth_property_iterator_next(&it)) != nullptr) { gpr_log(GPR_INFO, "\t\t%s: %s", p->name, p->value); } gpr_log(GPR_INFO, "\tall properties:"); it = grpc_auth_context_property_iterator(ctx); - while ((p = grpc_auth_property_iterator_next(&it)) != NULL) { + while ((p = grpc_auth_property_iterator_next(&it)) != nullptr) { gpr_log(GPR_INFO, "\t\t%s: %s", p->name, p->value); } } @@ -141,29 +141,29 @@ static void request_response_with_payload_and_call_creds( grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; - grpc_byte_buffer* request_payload_recv = NULL; - grpc_byte_buffer* response_payload_recv = NULL; + grpc_byte_buffer* request_payload_recv = nullptr; + grpc_byte_buffer* response_payload_recv = nullptr; grpc_call_details call_details; grpc_status_code status; grpc_call_error error; grpc_slice details; int was_cancelled = 2; - grpc_call_credentials* creds = NULL; - grpc_auth_context* s_auth_context = NULL; - grpc_auth_context* c_auth_context = NULL; + grpc_call_credentials* creds = nullptr; + grpc_auth_context* s_auth_context = nullptr; + grpc_auth_context* c_auth_context = nullptr; f = begin_test(config, test_name, 0); cqv = cq_verifier_create(f.cq); gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); - creds = grpc_google_iam_credentials_create(iam_token, iam_selector, NULL); - GPR_ASSERT(creds != NULL); + creds = grpc_google_iam_credentials_create(iam_token, iam_selector, nullptr); + GPR_ASSERT(creds != nullptr); GPR_ASSERT(grpc_call_set_credentials(c, creds) == GRPC_CALL_OK); switch (mode) { case NONE: @@ -171,12 +171,12 @@ static void request_response_with_payload_and_call_creds( case OVERRIDE: grpc_call_credentials_release(creds); creds = grpc_google_iam_credentials_create(overridden_iam_token, - overridden_iam_selector, NULL); - GPR_ASSERT(creds != NULL); + overridden_iam_selector, nullptr); + GPR_ASSERT(creds != nullptr); GPR_ASSERT(grpc_call_set_credentials(c, creds) == GRPC_CALL_OK); break; case DESTROY: - GPR_ASSERT(grpc_call_set_credentials(c, NULL) == GRPC_CALL_OK); + GPR_ASSERT(grpc_call_set_credentials(c, nullptr) == GRPC_CALL_OK); break; } grpc_call_credentials_release(creds); @@ -191,35 +191,35 @@ static void request_response_with_payload_and_call_creds( 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_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &response_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -229,31 +229,31 @@ static void request_response_with_payload_and_call_creds( CQ_EXPECT_COMPLETION(cqv, tag(101), 1); cq_verify(cqv); s_auth_context = grpc_call_auth_context(s); - GPR_ASSERT(s_auth_context != NULL); + GPR_ASSERT(s_auth_context != nullptr); print_auth_context(0, s_auth_context); grpc_auth_context_release(s_auth_context); c_auth_context = grpc_call_auth_context(c); - GPR_ASSERT(c_auth_context != NULL); + GPR_ASSERT(c_auth_context != nullptr); print_auth_context(1, c_auth_context); grpc_auth_context_release(c_auth_context); /* Cannot set creds on the server call object. */ - GPR_ASSERT(grpc_call_set_credentials(s, NULL) != GRPC_CALL_OK); + GPR_ASSERT(grpc_call_set_credentials(s, nullptr) != GRPC_CALL_OK); memset(ops, 0, sizeof(ops)); op = ops; 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_MESSAGE; op->data.recv_message.recv_message = &request_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -264,12 +264,12 @@ static void request_response_with_payload_and_call_creds( op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = response_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -277,9 +277,9 @@ static void request_response_with_payload_and_call_creds( grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(103), 1); @@ -383,7 +383,7 @@ static void test_request_with_server_rejecting_client_creds( grpc_status_code status; grpc_call_error error; grpc_slice details; - grpc_byte_buffer* response_payload_recv = NULL; + grpc_byte_buffer* response_payload_recv = nullptr; grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world"); grpc_byte_buffer* request_payload = @@ -394,14 +394,14 @@ static void test_request_with_server_rejecting_client_creds( cqv = cq_verifier_create(f.cq); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); - creds = grpc_google_iam_credentials_create(iam_token, iam_selector, NULL); - GPR_ASSERT(creds != NULL); + creds = grpc_google_iam_credentials_create(iam_token, iam_selector, nullptr); + GPR_ASSERT(creds != nullptr); GPR_ASSERT(grpc_call_set_credentials(c, creds) == GRPC_CALL_OK); grpc_call_credentials_release(creds); @@ -417,33 +417,33 @@ static void test_request_with_server_rejecting_client_creds( op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; 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_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &response_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(error == GRPC_CALL_OK); CQ_EXPECT_COMPLETION(cqv, tag(1), 1); diff --git a/test/core/end2end/tests/cancel_after_accept.cc b/test/core/end2end/tests/cancel_after_accept.cc index e2ad5bd721acc..83439d71d22eb 100644 --- a/test/core/end2end/tests/cancel_after_accept.cc +++ b/test/core/end2end/tests/cancel_after_accept.cc @@ -63,7 +63,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -72,16 +72,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -109,8 +109,8 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, grpc_status_code status; grpc_call_error error; grpc_slice details; - grpc_byte_buffer* request_payload_recv = NULL; - grpc_byte_buffer* response_payload_recv = NULL; + grpc_byte_buffer* request_payload_recv = nullptr; + grpc_byte_buffer* response_payload_recv = nullptr; grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world"); grpc_slice response_payload_slice = @@ -121,7 +121,7 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, grpc_raw_byte_buffer_create(&response_payload_slice, 1); int was_cancelled = 2; - grpc_channel_args* args = NULL; + grpc_channel_args* args = nullptr; if (use_service_config) { grpc_arg arg; arg.type = GRPC_ARG_STRING; @@ -140,17 +140,17 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, } grpc_end2end_test_fixture f = begin_test(config, "cancel_after_accept", mode, - use_service_config, args, NULL); + use_service_config, args, nullptr); cq_verifier* cqv = cq_verifier_create(f.cq); gpr_timespec deadline = use_service_config ? gpr_inf_future(GPR_CLOCK_MONOTONIC) : five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/service/method"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -165,29 +165,29 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; 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_SEND_MESSAGE; op->data.send_message.send_message = request_payload; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &response_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = grpc_server_request_call(f.server, &s, &call_details, @@ -201,27 +201,27 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &request_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; 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_SEND_MESSAGE; op->data.send_message.send_message = response_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(3), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(3), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); - GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, NULL)); + GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, nullptr)); CQ_EXPECT_COMPLETION(cqv, tag(3), 1); CQ_EXPECT_COMPLETION(cqv, tag(1), 1); @@ -244,7 +244,7 @@ static void test_cancel_after_accept(grpc_end2end_test_config config, grpc_call_unref(c); grpc_call_unref(s); - if (args != NULL) { + if (args != nullptr) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_channel_args_destroy(&exec_ctx, args); grpc_exec_ctx_finish(&exec_ctx); diff --git a/test/core/end2end/tests/cancel_after_client_done.cc b/test/core/end2end/tests/cancel_after_client_done.cc index 90db7f51b297d..28379a2f6e386 100644 --- a/test/core/end2end/tests/cancel_after_client_done.cc +++ b/test/core/end2end/tests/cancel_after_client_done.cc @@ -56,7 +56,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -65,16 +65,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -95,7 +95,7 @@ static void test_cancel_after_accept_and_writes_closed( grpc_call* c; grpc_call* s; grpc_end2end_test_fixture f = begin_test( - config, "test_cancel_after_accept_and_writes_closed", mode, NULL, NULL); + config, "test_cancel_after_accept_and_writes_closed", mode, nullptr, nullptr); cq_verifier* cqv = cq_verifier_create(f.cq); grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; @@ -104,8 +104,8 @@ static void test_cancel_after_accept_and_writes_closed( grpc_status_code status; grpc_call_error error; grpc_slice details; - grpc_byte_buffer* request_payload_recv = NULL; - grpc_byte_buffer* response_payload_recv = NULL; + grpc_byte_buffer* request_payload_recv = nullptr; + grpc_byte_buffer* response_payload_recv = nullptr; grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world"); grpc_slice response_payload_slice = @@ -118,10 +118,10 @@ static void test_cancel_after_accept_and_writes_closed( gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -136,33 +136,33 @@ static void test_cancel_after_accept_and_writes_closed( op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; 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_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &response_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = grpc_server_request_call(f.server, &s, &call_details, @@ -176,27 +176,27 @@ static void test_cancel_after_accept_and_writes_closed( op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &request_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; 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_SEND_MESSAGE; op->data.send_message.send_message = response_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(3), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(3), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); - GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, NULL)); + GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, nullptr)); CQ_EXPECT_COMPLETION(cqv, tag(3), 1); CQ_EXPECT_COMPLETION(cqv, tag(1), 1); diff --git a/test/core/end2end/tests/cancel_after_invoke.cc b/test/core/end2end/tests/cancel_after_invoke.cc index 7f0c4e7af900b..d3891b160ee17 100644 --- a/test/core/end2end/tests/cancel_after_invoke.cc +++ b/test/core/end2end/tests/cancel_after_invoke.cc @@ -57,7 +57,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -65,17 +65,17 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_event ev = grpc_completion_queue_next( - f->cq, grpc_timeout_seconds_to_deadline(5), NULL); + f->cq, grpc_timeout_seconds_to_deadline(5), nullptr); GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); GPR_ASSERT(ev.tag == tag(1000)); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -95,7 +95,7 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config, grpc_op* op; grpc_call* c; grpc_end2end_test_fixture f = begin_test(config, "test_cancel_after_invoke", - mode, test_ops, NULL, NULL); + mode, test_ops, nullptr, nullptr); cq_verifier* cqv = cq_verifier_create(f.cq); grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; @@ -104,7 +104,7 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config, grpc_status_code status; grpc_call_error error; grpc_slice details; - grpc_byte_buffer* response_payload_recv = NULL; + grpc_byte_buffer* response_payload_recv = nullptr; grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world"); grpc_byte_buffer* request_payload = @@ -112,10 +112,10 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config, gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -130,36 +130,36 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config, op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; 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_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &response_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, test_ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, test_ops, tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); - GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, NULL)); + GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, nullptr)); CQ_EXPECT_COMPLETION(cqv, tag(1), 1); cq_verify(cqv); diff --git a/test/core/end2end/tests/cancel_after_round_trip.cc b/test/core/end2end/tests/cancel_after_round_trip.cc index 35b5214fac408..6d547662ddf08 100644 --- a/test/core/end2end/tests/cancel_after_round_trip.cc +++ b/test/core/end2end/tests/cancel_after_round_trip.cc @@ -63,7 +63,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -72,16 +72,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -109,8 +109,8 @@ static void test_cancel_after_round_trip(grpc_end2end_test_config config, grpc_status_code status; grpc_call_error error; grpc_slice details; - grpc_byte_buffer* request_payload_recv = NULL; - grpc_byte_buffer* response_payload_recv = NULL; + grpc_byte_buffer* request_payload_recv = nullptr; + grpc_byte_buffer* response_payload_recv = nullptr; grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world"); grpc_slice response_payload_slice = @@ -123,7 +123,7 @@ static void test_cancel_after_round_trip(grpc_end2end_test_config config, grpc_raw_byte_buffer_create(&response_payload_slice, 1); int was_cancelled = 2; - grpc_channel_args* args = NULL; + grpc_channel_args* args = nullptr; if (use_service_config) { grpc_arg arg; arg.type = GRPC_ARG_STRING; @@ -141,17 +141,17 @@ static void test_cancel_after_round_trip(grpc_end2end_test_config config, } grpc_end2end_test_fixture f = begin_test( - config, "cancel_after_round_trip", mode, use_service_config, args, NULL); + config, "cancel_after_round_trip", mode, use_service_config, args, nullptr); cq_verifier* cqv = cq_verifier_create(f.cq); gpr_timespec deadline = use_service_config ? gpr_inf_future(GPR_CLOCK_MONOTONIC) : five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/service/method"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -164,24 +164,24 @@ static void test_cancel_after_round_trip(grpc_end2end_test_config config, 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_SEND_MESSAGE; op->data.send_message.send_message = request_payload; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &response_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -196,19 +196,19 @@ static void test_cancel_after_round_trip(grpc_end2end_test_config config, op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &request_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; 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_SEND_MESSAGE; op->data.send_message.send_message = response_payload1; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -217,8 +217,8 @@ static void test_cancel_after_round_trip(grpc_end2end_test_config config, grpc_byte_buffer_destroy(request_payload_recv); grpc_byte_buffer_destroy(response_payload_recv); - request_payload_recv = NULL; - response_payload_recv = NULL; + request_payload_recv = nullptr; + response_payload_recv = nullptr; memset(ops, 0, sizeof(ops)); op = ops; @@ -227,31 +227,31 @@ static void test_cancel_after_round_trip(grpc_end2end_test_config config, op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &response_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); - GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, NULL)); + GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, nullptr)); memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = response_payload2; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(2), 1); @@ -276,7 +276,7 @@ static void test_cancel_after_round_trip(grpc_end2end_test_config config, grpc_call_unref(c); grpc_call_unref(s); - if (args != NULL) { + if (args != nullptr) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_channel_args_destroy(&exec_ctx, args); grpc_exec_ctx_finish(&exec_ctx); diff --git a/test/core/end2end/tests/cancel_before_invoke.cc b/test/core/end2end/tests/cancel_before_invoke.cc index 9504aae5e6b1a..1112375176e63 100644 --- a/test/core/end2end/tests/cancel_before_invoke.cc +++ b/test/core/end2end/tests/cancel_before_invoke.cc @@ -55,7 +55,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -64,16 +64,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -93,7 +93,7 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config, grpc_op* op; grpc_call* c; grpc_end2end_test_fixture f = - begin_test(config, "cancel_before_invoke", test_ops, NULL, NULL); + begin_test(config, "cancel_before_invoke", test_ops, nullptr, nullptr); cq_verifier* cqv = cq_verifier_create(f.cq); grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; @@ -102,7 +102,7 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config, grpc_status_code status; grpc_call_error error; grpc_slice details; - grpc_byte_buffer* response_payload_recv = NULL; + grpc_byte_buffer* response_payload_recv = nullptr; grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world"); grpc_byte_buffer* request_payload = @@ -110,13 +110,13 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config, gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); - GPR_ASSERT(GRPC_CALL_OK == grpc_call_cancel(c, NULL)); + GPR_ASSERT(GRPC_CALL_OK == grpc_call_cancel(c, nullptr)); grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&trailing_metadata_recv); @@ -130,33 +130,33 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config, op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; 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_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &response_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, test_ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, test_ops, tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(1), 1); diff --git a/test/core/end2end/tests/cancel_in_a_vacuum.cc b/test/core/end2end/tests/cancel_in_a_vacuum.cc index 090ee2fbb2fe2..a6c534eb08107 100644 --- a/test/core/end2end/tests/cancel_in_a_vacuum.cc +++ b/test/core/end2end/tests/cancel_in_a_vacuum.cc @@ -56,7 +56,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -65,16 +65,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -92,18 +92,18 @@ static void test_cancel_in_a_vacuum(grpc_end2end_test_config config, cancellation_mode mode) { grpc_call* c; grpc_end2end_test_fixture f = - begin_test(config, "test_cancel_in_a_vacuum", mode, NULL, NULL); + begin_test(config, "test_cancel_in_a_vacuum", mode, nullptr, nullptr); cq_verifier* v_client = cq_verifier_create(f.cq); gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); - GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, NULL)); + GPR_ASSERT(GRPC_CALL_OK == mode.initiate_cancel(c, nullptr)); grpc_call_unref(c); diff --git a/test/core/end2end/tests/cancel_with_status.cc b/test/core/end2end/tests/cancel_with_status.cc index bc3c4c3ebd185..cc5498d6b3981 100644 --- a/test/core/end2end/tests/cancel_with_status.cc +++ b/test/core/end2end/tests/cancel_with_status.cc @@ -58,7 +58,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -66,17 +66,17 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_event ev = grpc_completion_queue_next( - f->cq, grpc_timeout_seconds_to_deadline(5), NULL); + f->cq, grpc_timeout_seconds_to_deadline(5), nullptr); GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); GPR_ASSERT(ev.tag == tag(1000)); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -105,10 +105,10 @@ static void simple_request_body(grpc_end2end_test_config config, gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -121,29 +121,29 @@ static void simple_request_body(grpc_end2end_test_config config, op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; 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_SEND_CLOSE_FROM_CLIENT; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(num_ops <= (size_t)(op - ops)); - error = grpc_call_start_batch(c, ops, num_ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, num_ops, tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); char* dynamic_string = gpr_strdup("xyz"); grpc_call_cancel_with_status(c, GRPC_STATUS_UNIMPLEMENTED, - (const char*)dynamic_string, NULL); + (const char*)dynamic_string, nullptr); // The API of \a description allows for it to be a dynamic/non-const // string, test this guarantee. gpr_free(dynamic_string); @@ -167,7 +167,7 @@ static void test_invoke_simple_request(grpc_end2end_test_config config, size_t num_ops) { grpc_end2end_test_fixture f; - f = begin_test(config, "test_invoke_simple_request", num_ops, NULL, NULL); + f = begin_test(config, "test_invoke_simple_request", num_ops, nullptr, nullptr); simple_request_body(config, f, num_ops); end_test(&f); config.tear_down_data(&f); diff --git a/test/core/end2end/tests/compressed_payload.cc b/test/core/end2end/tests/compressed_payload.cc index b5fc1898b5d69..8ffcbe89cbc4c 100644 --- a/test/core/end2end/tests/compressed_payload.cc +++ b/test/core/end2end/tests/compressed_payload.cc @@ -61,7 +61,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -70,16 +70,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -110,7 +110,7 @@ static void request_for_disabled_algorithm( grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; - grpc_byte_buffer* request_payload_recv = NULL; + grpc_byte_buffer* request_payload_recv = nullptr; grpc_call_details call_details; grpc_status_code status; grpc_call_error error; @@ -125,9 +125,9 @@ static void request_for_disabled_algorithm( request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); client_args = grpc_channel_args_set_compression_algorithm( - NULL, requested_client_compression_algorithm); + nullptr, requested_client_compression_algorithm); server_args = - grpc_channel_args_set_compression_algorithm(NULL, GRPC_COMPRESS_NONE); + grpc_channel_args_set_compression_algorithm(nullptr, GRPC_COMPRESS_NONE); { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; server_args = grpc_channel_args_compression_algorithm_set_state( @@ -140,10 +140,10 @@ static void request_for_disabled_algorithm( gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -159,37 +159,37 @@ static void request_for_disabled_algorithm( memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; - if (client_metadata != NULL) { + if (client_metadata != nullptr) { op->data.send_initial_metadata.count = 1; op->data.send_initial_metadata.metadata = client_metadata; } else { op->data.send_initial_metadata.count = 0; } op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = send_flags_bitmask; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(101), true); @@ -200,14 +200,14 @@ static void request_for_disabled_algorithm( 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_MESSAGE; op->data.recv_message.recv_message = &request_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), false); @@ -216,9 +216,9 @@ static void request_for_disabled_algorithm( op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(103), true); @@ -229,9 +229,9 @@ static void request_for_disabled_algorithm( /* with a certain error */ GPR_ASSERT(status == expected_error); - const char* algo_name = NULL; + const char* algo_name = nullptr; GPR_ASSERT(grpc_compression_algorithm_name(algorithm_to_disable, &algo_name)); - char* expected_details = NULL; + char* expected_details = nullptr; gpr_asprintf(&expected_details, "Compression algorithm '%s' is disabled.", algo_name); /* and we expect a specific reason for it */ @@ -280,7 +280,7 @@ static void request_with_payload_template( grpc_call* c; grpc_call* s; grpc_slice request_payload_slice; - grpc_byte_buffer* request_payload = NULL; + grpc_byte_buffer* request_payload = nullptr; grpc_channel_args* client_args; grpc_channel_args* server_args; grpc_end2end_test_fixture f; @@ -289,7 +289,7 @@ static void request_with_payload_template( grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; - grpc_byte_buffer* request_payload_recv = NULL; + grpc_byte_buffer* request_payload_recv = nullptr; grpc_byte_buffer* response_payload; grpc_byte_buffer* response_payload_recv; grpc_call_details call_details; @@ -312,19 +312,19 @@ static void request_with_payload_template( grpc_slice_from_copied_string(response_str); client_args = grpc_channel_args_set_compression_algorithm( - NULL, default_client_channel_compression_algorithm); + nullptr, default_client_channel_compression_algorithm); server_args = grpc_channel_args_set_compression_algorithm( - NULL, default_server_channel_compression_algorithm); + nullptr, default_server_channel_compression_algorithm); f = begin_test(config, test_name, client_args, server_args); cqv = cq_verifier_create(f.cq); gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -339,9 +339,9 @@ static void request_with_payload_template( op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = client_send_flags_bitmask; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(2), true); } @@ -349,28 +349,28 @@ static void request_with_payload_template( memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; - if (client_init_metadata != NULL) { + if (client_init_metadata != nullptr) { op->data.send_initial_metadata.count = 1; op->data.send_initial_metadata.metadata = client_init_metadata; } else { 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -399,14 +399,14 @@ static void request_with_payload_template( server_compression_level; } op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(101), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(101), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); for (int i = 0; i < 2; i++) { @@ -419,9 +419,9 @@ static void request_with_payload_template( op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = client_send_flags_bitmask; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(2), 1); } @@ -431,9 +431,9 @@ static void request_with_payload_template( op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &request_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -449,9 +449,9 @@ static void request_with_payload_template( op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = response_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); memset(ops, 0, sizeof(ops)); @@ -459,9 +459,9 @@ static void request_with_payload_template( op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &response_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(103), 1); @@ -493,9 +493,9 @@ static void request_with_payload_template( op = ops; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(4), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(4), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); memset(ops, 0, sizeof(ops)); @@ -506,9 +506,9 @@ static void request_with_payload_template( grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(104), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(104), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(1), 1); @@ -551,7 +551,7 @@ static void test_invoke_request_with_exceptionally_uncompressed_payload( request_with_payload_template( config, "test_invoke_request_with_exceptionally_uncompressed_payload", GRPC_WRITE_NO_COMPRESS, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, - GRPC_COMPRESS_NONE, GRPC_COMPRESS_GZIP, NULL, false, + GRPC_COMPRESS_NONE, GRPC_COMPRESS_GZIP, nullptr, false, /* ignored */ GRPC_COMPRESS_LEVEL_NONE, false); } @@ -560,7 +560,7 @@ static void test_invoke_request_with_uncompressed_payload( request_with_payload_template( config, "test_invoke_request_with_uncompressed_payload", 0, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, - GRPC_COMPRESS_NONE, NULL, false, /* ignored */ GRPC_COMPRESS_LEVEL_NONE, + GRPC_COMPRESS_NONE, nullptr, false, /* ignored */ GRPC_COMPRESS_LEVEL_NONE, false); } @@ -569,7 +569,7 @@ static void test_invoke_request_with_compressed_payload( request_with_payload_template( config, "test_invoke_request_with_compressed_payload", 0, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, - GRPC_COMPRESS_GZIP, NULL, false, /* ignored */ GRPC_COMPRESS_LEVEL_NONE, + GRPC_COMPRESS_GZIP, nullptr, false, /* ignored */ GRPC_COMPRESS_LEVEL_NONE, false); } @@ -578,7 +578,7 @@ static void test_invoke_request_with_send_message_before_initial_metadata( request_with_payload_template( config, "test_invoke_request_with_compressed_payload", 0, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, - GRPC_COMPRESS_GZIP, NULL, false, /* ignored */ GRPC_COMPRESS_LEVEL_NONE, + GRPC_COMPRESS_GZIP, nullptr, false, /* ignored */ GRPC_COMPRESS_LEVEL_NONE, true); } @@ -587,7 +587,7 @@ static void test_invoke_request_with_server_level( request_with_payload_template( config, "test_invoke_request_with_server_level", 0, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE, GRPC_COMPRESS_NONE /* ignored */, - NULL, true, GRPC_COMPRESS_LEVEL_HIGH, false); + nullptr, true, GRPC_COMPRESS_LEVEL_HIGH, false); } static void test_invoke_request_with_compressed_payload_md_override( @@ -632,7 +632,7 @@ static void test_invoke_request_with_disabled_algorithm( grpc_end2end_test_config config) { request_for_disabled_algorithm( config, "test_invoke_request_with_disabled_algorithm", 0, - GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, GRPC_STATUS_UNIMPLEMENTED, NULL); + GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, GRPC_STATUS_UNIMPLEMENTED, nullptr); } void compressed_payload(grpc_end2end_test_config config) { diff --git a/test/core/end2end/tests/connectivity.cc b/test/core/end2end/tests/connectivity.cc index 4f302d11dc493..2ea4ca81f5841 100644 --- a/test/core/end2end/tests/connectivity.cc +++ b/test/core/end2end/tests/connectivity.cc @@ -39,14 +39,14 @@ static void child_thread(void* arg) { gpr_event_set(&ce->started, (void*)1); gpr_log(GPR_DEBUG, "verifying"); ev = grpc_completion_queue_next(ce->cq, gpr_inf_future(GPR_CLOCK_MONOTONIC), - NULL); + nullptr); GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); GPR_ASSERT(ev.tag == tag(1)); GPR_ASSERT(ev.success == 0); } static void test_connectivity(grpc_end2end_test_config config) { - grpc_end2end_test_fixture f = config.create_fixture(NULL, NULL); + grpc_end2end_test_fixture f = config.create_fixture(nullptr, nullptr); grpc_connectivity_state state; cq_verifier* cqv = cq_verifier_create(f.cq); child_events ce; @@ -115,7 +115,7 @@ static void test_connectivity(grpc_end2end_test_config config) { gpr_log(GPR_DEBUG, "*** STARTING SERVER ***"); /* now let's bring up a server to connect to */ - config.init_server(&f, NULL); + config.init_server(&f, nullptr); gpr_log(GPR_DEBUG, "*** STARTED SERVER ***"); diff --git a/test/core/end2end/tests/default_host.cc b/test/core/end2end/tests/default_host.cc index 166f22aec9ca9..85f92b0ab0744 100644 --- a/test/core/end2end/tests/default_host.cc +++ b/test/core/end2end/tests/default_host.cc @@ -55,7 +55,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -64,16 +64,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -103,13 +103,13 @@ static void simple_request_body(grpc_end2end_test_fixture f) { char* peer; gpr_timespec deadline = five_seconds_from_now(); - c = grpc_channel_create_call(f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, - grpc_slice_from_static_string("/foo"), NULL, - deadline, NULL); + c = grpc_channel_create_call(f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, + grpc_slice_from_static_string("/foo"), nullptr, + deadline, nullptr); GPR_ASSERT(c); peer = grpc_call_get_peer(c); - GPR_ASSERT(peer != NULL); + GPR_ASSERT(peer != nullptr); gpr_log(GPR_DEBUG, "client_peer_before_call=%s", peer); gpr_free(peer); @@ -123,25 +123,25 @@ static void simple_request_body(grpc_end2end_test_fixture f) { 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_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(error == GRPC_CALL_OK); error = @@ -152,11 +152,11 @@ static void simple_request_body(grpc_end2end_test_fixture f) { cq_verify(cqv); peer = grpc_call_get_peer(s); - GPR_ASSERT(peer != NULL); + GPR_ASSERT(peer != nullptr); gpr_log(GPR_DEBUG, "server_peer=%s", peer); gpr_free(peer); peer = grpc_call_get_peer(c); - GPR_ASSERT(peer != NULL); + GPR_ASSERT(peer != nullptr); gpr_log(GPR_DEBUG, "client_peer=%s", peer); gpr_free(peer); @@ -165,7 +165,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { 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_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -173,14 +173,14 @@ static void simple_request_body(grpc_end2end_test_fixture f) { grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(error == GRPC_CALL_OK); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -208,7 +208,7 @@ static void simple_request_body(grpc_end2end_test_fixture f) { static void test_invoke_simple_request(grpc_end2end_test_config config) { grpc_end2end_test_fixture f; - f = begin_test(config, "test_invoke_simple_request", NULL, NULL); + f = begin_test(config, "test_invoke_simple_request", nullptr, nullptr); simple_request_body(f); end_test(&f); config.tear_down_data(&f); diff --git a/test/core/end2end/tests/disappearing_server.cc b/test/core/end2end/tests/disappearing_server.cc index a0b34dd805f9c..29fb19463f7b9 100644 --- a/test/core/end2end/tests/disappearing_server.cc +++ b/test/core/end2end/tests/disappearing_server.cc @@ -41,20 +41,20 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void shutdown_server(grpc_end2end_test_fixture* f) { if (!f->server) return; grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -87,10 +87,10 @@ static void do_request_and_shutdown_server(grpc_end2end_test_config config, gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f->client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq, + f->client, nullptr, GRPC_PROPAGATE_DEFAULTS, f->cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -103,25 +103,25 @@ static void do_request_and_shutdown_server(grpc_end2end_test_config config, 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_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -140,7 +140,7 @@ static void do_request_and_shutdown_server(grpc_end2end_test_config config, 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_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -148,14 +148,14 @@ static void do_request_and_shutdown_server(grpc_end2end_test_config config, grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -181,19 +181,19 @@ static void do_request_and_shutdown_server(grpc_end2end_test_config config, } static void disappearing_server_test(grpc_end2end_test_config config) { - grpc_end2end_test_fixture f = config.create_fixture(NULL, NULL); + grpc_end2end_test_fixture f = config.create_fixture(nullptr, nullptr); cq_verifier* cqv = cq_verifier_create(f.cq); gpr_log(GPR_INFO, "Running test: %s/%s", "disappearing_server_test", config.name); - config.init_client(&f, NULL); - config.init_server(&f, NULL); + config.init_client(&f, nullptr); + config.init_server(&f, nullptr); do_request_and_shutdown_server(config, &f, cqv); /* now destroy and recreate the server */ - config.init_server(&f, NULL); + config.init_server(&f, nullptr); do_request_and_shutdown_server(config, &f, cqv); diff --git a/test/core/end2end/tests/empty_batch.cc b/test/core/end2end/tests/empty_batch.cc index 59d0025239b11..b249c141dec70 100644 --- a/test/core/end2end/tests/empty_batch.cc +++ b/test/core/end2end/tests/empty_batch.cc @@ -55,7 +55,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -64,16 +64,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -91,17 +91,17 @@ static void empty_batch_body(grpc_end2end_test_config config, grpc_call* c; cq_verifier* cqv = cq_verifier_create(f.cq); grpc_call_error error; - grpc_op* op = NULL; + grpc_op* op = nullptr; gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); - error = grpc_call_start_batch(c, op, 0, tag(1), NULL); + error = grpc_call_start_batch(c, op, 0, tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(1), 1); cq_verify(cqv); @@ -114,7 +114,7 @@ static void empty_batch_body(grpc_end2end_test_config config, static void test_invoke_empty_body(grpc_end2end_test_config config) { grpc_end2end_test_fixture f; - f = begin_test(config, "test_invoke_empty_body", NULL, NULL); + f = begin_test(config, "test_invoke_empty_body", nullptr, nullptr); empty_batch_body(config, f); end_test(&f); config.tear_down_data(&f); diff --git a/test/core/end2end/tests/filter_call_init_fails.cc b/test/core/end2end/tests/filter_call_init_fails.cc index ecf0cc3acae83..6eed68a2f9f2a 100644 --- a/test/core/end2end/tests/filter_call_init_fails.cc +++ b/test/core/end2end/tests/filter_call_init_fails.cc @@ -63,7 +63,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -72,16 +72,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -104,14 +104,14 @@ static void test_server_channel_filter(grpc_end2end_test_config config) { grpc_byte_buffer* request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); grpc_end2end_test_fixture f = - begin_test(config, "filter_call_init_fails", NULL, NULL); + begin_test(config, "filter_call_init_fails", nullptr, nullptr); cq_verifier* cqv = cq_verifier_create(f.cq); grpc_op ops[6]; grpc_op* op; grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; - grpc_byte_buffer* request_payload_recv = NULL; + grpc_byte_buffer* request_payload_recv = nullptr; grpc_call_details call_details; grpc_status_code status; grpc_call_error error; @@ -119,10 +119,10 @@ static void test_server_channel_filter(grpc_end2end_test_config config) { gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -134,32 +134,32 @@ static void test_server_channel_filter(grpc_end2end_test_config config) { op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; - op->data.send_initial_metadata.metadata = NULL; + op->data.send_initial_metadata.metadata = nullptr; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -200,24 +200,24 @@ static void test_client_channel_filter(grpc_end2end_test_config config) { grpc_raw_byte_buffer_create(&request_payload_slice, 1); gpr_timespec deadline = five_seconds_from_now(); grpc_end2end_test_fixture f = - begin_test(config, "filter_call_init_fails", NULL, NULL); + begin_test(config, "filter_call_init_fails", nullptr, nullptr); cq_verifier* cqv = cq_verifier_create(f.cq); grpc_op ops[6]; grpc_op* op; grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; - grpc_byte_buffer* request_payload_recv = NULL; + grpc_byte_buffer* request_payload_recv = nullptr; grpc_call_details call_details; grpc_status_code status; grpc_call_error error; grpc_slice details; c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -229,32 +229,32 @@ static void test_client_channel_filter(grpc_end2end_test_config config) { op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; - op->data.send_initial_metadata.metadata = NULL; + op->data.send_initial_metadata.metadata = nullptr; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(1), 1); @@ -290,24 +290,24 @@ static void test_client_subchannel_filter(grpc_end2end_test_config config) { grpc_raw_byte_buffer_create(&request_payload_slice, 1); gpr_timespec deadline = five_seconds_from_now(); grpc_end2end_test_fixture f = - begin_test(config, "filter_call_init_fails", NULL, NULL); + begin_test(config, "filter_call_init_fails", nullptr, nullptr); cq_verifier* cqv = cq_verifier_create(f.cq); grpc_op ops[6]; grpc_op* op; grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; - grpc_byte_buffer* request_payload_recv = NULL; + grpc_byte_buffer* request_payload_recv = nullptr; grpc_call_details call_details; grpc_status_code status; grpc_call_error error; grpc_slice details; c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -319,33 +319,33 @@ static void test_client_subchannel_filter(grpc_end2end_test_config config) { op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; - op->data.send_initial_metadata.metadata = NULL; + op->data.send_initial_metadata.metadata = nullptr; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(1), 1); @@ -363,13 +363,13 @@ static void test_client_subchannel_filter(grpc_end2end_test_config config) { details = grpc_empty_slice(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(2), 1); @@ -449,7 +449,7 @@ static bool maybe_add_server_channel_filter(grpc_exec_ctx* exec_ctx, grpc_channel_stack_builder_create_iterator_at_last(builder); GPR_ASSERT(grpc_channel_stack_builder_move_prev(it)); const bool retval = grpc_channel_stack_builder_add_filter_before( - it, &test_filter, NULL, NULL); + it, &test_filter, nullptr, nullptr); grpc_channel_stack_builder_iterator_destroy(it); return retval; } else { @@ -469,7 +469,7 @@ static bool maybe_add_client_channel_filter(grpc_exec_ctx* exec_ctx, grpc_channel_stack_builder_create_iterator_at_last(builder); GPR_ASSERT(grpc_channel_stack_builder_move_prev(it)); const bool retval = grpc_channel_stack_builder_add_filter_before( - it, &test_filter, NULL, NULL); + it, &test_filter, nullptr, nullptr); grpc_channel_stack_builder_iterator_destroy(it); return retval; } else { @@ -488,7 +488,7 @@ static bool maybe_add_client_subchannel_filter( grpc_channel_stack_builder_create_iterator_at_last(builder); GPR_ASSERT(grpc_channel_stack_builder_move_prev(it)); const bool retval = grpc_channel_stack_builder_add_filter_before( - it, &test_filter, NULL, NULL); + it, &test_filter, nullptr, nullptr); grpc_channel_stack_builder_iterator_destroy(it); return retval; } else { @@ -498,13 +498,13 @@ static bool maybe_add_client_subchannel_filter( static void init_plugin(void) { grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL, INT_MAX, - maybe_add_server_channel_filter, NULL); + maybe_add_server_channel_filter, nullptr); grpc_channel_init_register_stage(GRPC_CLIENT_CHANNEL, INT_MAX, - maybe_add_client_channel_filter, NULL); + maybe_add_client_channel_filter, nullptr); grpc_channel_init_register_stage(GRPC_CLIENT_SUBCHANNEL, INT_MAX, - maybe_add_client_subchannel_filter, NULL); + maybe_add_client_subchannel_filter, nullptr); grpc_channel_init_register_stage(GRPC_CLIENT_DIRECT_CHANNEL, INT_MAX, - maybe_add_client_channel_filter, NULL); + maybe_add_client_channel_filter, nullptr); } static void destroy_plugin(void) {} diff --git a/test/core/end2end/tests/filter_causes_close.cc b/test/core/end2end/tests/filter_causes_close.cc index b6cceabdd5bc4..793f59068668a 100644 --- a/test/core/end2end/tests/filter_causes_close.cc +++ b/test/core/end2end/tests/filter_causes_close.cc @@ -58,7 +58,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -67,16 +67,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -98,14 +98,14 @@ static void test_request(grpc_end2end_test_config config) { grpc_byte_buffer* request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); grpc_end2end_test_fixture f = - begin_test(config, "filter_causes_close", NULL, NULL); + begin_test(config, "filter_causes_close", nullptr, nullptr); cq_verifier* cqv = cq_verifier_create(f.cq); grpc_op ops[6]; grpc_op* op; grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; - grpc_byte_buffer* request_payload_recv = NULL; + grpc_byte_buffer* request_payload_recv = nullptr; grpc_call_details call_details; grpc_status_code status; grpc_call_error error; @@ -113,10 +113,10 @@ static void test_request(grpc_end2end_test_config config) { gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -128,32 +128,32 @@ static void test_request(grpc_end2end_test_config config) { op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; - op->data.send_initial_metadata.metadata = NULL; + op->data.send_initial_metadata.metadata = nullptr; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -262,7 +262,7 @@ static bool maybe_add_filter(grpc_exec_ctx* exec_ctx, grpc_channel_stack_builder* builder, void* arg) { if (g_enable_filter) { return grpc_channel_stack_builder_prepend_filter(builder, &test_filter, - NULL, NULL); + nullptr, nullptr); } else { return true; } @@ -270,7 +270,7 @@ static bool maybe_add_filter(grpc_exec_ctx* exec_ctx, static void init_plugin(void) { grpc_channel_init_register_stage(GRPC_SERVER_CHANNEL, 0, maybe_add_filter, - NULL); + nullptr); } static void destroy_plugin(void) {} diff --git a/test/core/end2end/tests/filter_latency.cc b/test/core/end2end/tests/filter_latency.cc index e8ec188ec30cc..07fee4c451a90 100644 --- a/test/core/end2end/tests/filter_latency.cc +++ b/test/core/end2end/tests/filter_latency.cc @@ -65,7 +65,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -74,16 +74,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -105,14 +105,14 @@ static void test_request(grpc_end2end_test_config config) { grpc_byte_buffer* request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); grpc_end2end_test_fixture f = - begin_test(config, "filter_latency", NULL, NULL); + begin_test(config, "filter_latency", nullptr, nullptr); cq_verifier* cqv = cq_verifier_create(f.cq); grpc_op ops[6]; grpc_op* op; grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; - grpc_byte_buffer* request_payload_recv = NULL; + grpc_byte_buffer* request_payload_recv = nullptr; grpc_call_details call_details; grpc_status_code status; grpc_call_error error; @@ -127,9 +127,9 @@ static void test_request(grpc_end2end_test_config config) { gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), - get_host_override_slice("foo.test.google.fr", config), deadline, NULL); + get_host_override_slice("foo.test.google.fr", config), deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -141,32 +141,32 @@ static void test_request(grpc_end2end_test_config config) { op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; - op->data.send_initial_metadata.metadata = NULL; + op->data.send_initial_metadata.metadata = nullptr; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -182,7 +182,7 @@ static void test_request(grpc_end2end_test_config config) { 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_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -190,14 +190,14 @@ static void test_request(grpc_end2end_test_config config) { grpc_slice status_string = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_string; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -322,7 +322,7 @@ static bool maybe_add_filter(grpc_exec_ctx* exec_ctx, grpc_channel_stack_builder_create_iterator_at_last(builder); GPR_ASSERT(grpc_channel_stack_builder_move_prev(it)); const bool retval = - grpc_channel_stack_builder_add_filter_before(it, filter, NULL, NULL); + grpc_channel_stack_builder_add_filter_before(it, filter, nullptr, nullptr); grpc_channel_stack_builder_iterator_destroy(it); return retval; } else { diff --git a/test/core/end2end/tests/graceful_server_shutdown.cc b/test/core/end2end/tests/graceful_server_shutdown.cc index 22bdac4032167..1c8acf37a41c3 100644 --- a/test/core/end2end/tests/graceful_server_shutdown.cc +++ b/test/core/end2end/tests/graceful_server_shutdown.cc @@ -53,20 +53,20 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void shutdown_server(grpc_end2end_test_fixture* f) { if (!f->server) return; grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -85,7 +85,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( grpc_call* c; grpc_call* s; grpc_end2end_test_fixture f = begin_test( - config, "test_early_server_shutdown_finishes_inflight_calls", NULL, NULL); + config, "test_early_server_shutdown_finishes_inflight_calls", nullptr, nullptr); cq_verifier* cqv = cq_verifier_create(f.cq); grpc_op ops[6]; grpc_op* op; @@ -100,10 +100,10 @@ static void test_early_server_shutdown_finishes_inflight_calls( gpr_timespec deadline = n_seconds_from_now(10); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -115,27 +115,27 @@ static void test_early_server_shutdown_finishes_inflight_calls( op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; - op->data.send_initial_metadata.metadata = NULL; + op->data.send_initial_metadata.metadata = nullptr; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -154,7 +154,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( 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_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -162,14 +162,14 @@ static void test_early_server_shutdown_finishes_inflight_calls( grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); diff --git a/test/core/end2end/tests/high_initial_seqno.cc b/test/core/end2end/tests/high_initial_seqno.cc index 72f1d0fd3d02b..d390a954e5c5a 100644 --- a/test/core/end2end/tests/high_initial_seqno.cc +++ b/test/core/end2end/tests/high_initial_seqno.cc @@ -57,7 +57,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -66,16 +66,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -106,10 +106,10 @@ static void simple_request_body(grpc_end2end_test_config config, gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -122,25 +122,25 @@ static void simple_request_body(grpc_end2end_test_config config, 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_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -155,7 +155,7 @@ static void simple_request_body(grpc_end2end_test_config config, 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_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -163,14 +163,14 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -219,7 +219,7 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config, gpr_asprintf(&name, "test_invoke_requests first_seqno=%d", initial_sequence_number); - f = begin_test(config, name, &client_args, NULL); + f = begin_test(config, name, &client_args, nullptr); for (i = 0; i < 10; i++) { simple_request_body(config, f); gpr_log(GPR_INFO, "Running test: Passed simple request %d", i); diff --git a/test/core/end2end/tests/hpack_size.cc b/test/core/end2end/tests/hpack_size.cc index b2c683ec8e077..7ac5fefa229b1 100644 --- a/test/core/end2end/tests/hpack_size.cc +++ b/test/core/end2end/tests/hpack_size.cc @@ -197,7 +197,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -206,16 +206,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -258,10 +258,10 @@ static void simple_request_body(grpc_end2end_test_config config, gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -275,25 +275,25 @@ static void simple_request_body(grpc_end2end_test_config config, op->data.send_initial_metadata.count = GPR_ARRAY_SIZE(extra_metadata); op->data.send_initial_metadata.metadata = extra_metadata; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -308,7 +308,7 @@ static void simple_request_body(grpc_end2end_test_config config, 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_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -316,14 +316,14 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -372,8 +372,8 @@ static void test_size(grpc_end2end_test_config config, int encode_size, client_args.args = &client_arg; gpr_asprintf(&name, "test_size:e=%d:d=%d", encode_size, decode_size); - f = begin_test(config, name, encode_size != 4096 ? &client_args : NULL, - decode_size != 4096 ? &server_args : NULL); + f = begin_test(config, name, encode_size != 4096 ? &client_args : nullptr, + decode_size != 4096 ? &server_args : nullptr); for (i = 0; i < 4 * GPR_ARRAY_SIZE(hobbits); i++) { simple_request_body(config, f, i); } diff --git a/test/core/end2end/tests/idempotent_request.cc b/test/core/end2end/tests/idempotent_request.cc index 4f61caa6df783..e39975382adbd 100644 --- a/test/core/end2end/tests/idempotent_request.cc +++ b/test/core/end2end/tests/idempotent_request.cc @@ -55,7 +55,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -64,16 +64,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -105,14 +105,14 @@ static void simple_request_body(grpc_end2end_test_config config, gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); peer = grpc_call_get_peer(c); - GPR_ASSERT(peer != NULL); + GPR_ASSERT(peer != nullptr); gpr_log(GPR_DEBUG, "client_peer_before_call=%s", peer); gpr_free(peer); @@ -126,25 +126,25 @@ static void simple_request_body(grpc_end2end_test_config config, op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -155,11 +155,11 @@ static void simple_request_body(grpc_end2end_test_config config, cq_verify(cqv); peer = grpc_call_get_peer(s); - GPR_ASSERT(peer != NULL); + GPR_ASSERT(peer != nullptr); gpr_log(GPR_DEBUG, "server_peer=%s", peer); gpr_free(peer); peer = grpc_call_get_peer(c); - GPR_ASSERT(peer != NULL); + GPR_ASSERT(peer != nullptr); gpr_log(GPR_DEBUG, "client_peer=%s", peer); gpr_free(peer); @@ -168,7 +168,7 @@ static void simple_request_body(grpc_end2end_test_config config, 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_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -176,14 +176,14 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -213,7 +213,7 @@ static void simple_request_body(grpc_end2end_test_config config, static void test_invoke_simple_request(grpc_end2end_test_config config) { grpc_end2end_test_fixture f; - f = begin_test(config, "test_invoke_simple_request", NULL, NULL); + f = begin_test(config, "test_invoke_simple_request", nullptr, nullptr); simple_request_body(config, f); end_test(&f); config.tear_down_data(&f); @@ -222,7 +222,7 @@ static void test_invoke_simple_request(grpc_end2end_test_config config) { static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { int i; grpc_end2end_test_fixture f = - begin_test(config, "test_invoke_10_simple_requests", NULL, NULL); + begin_test(config, "test_invoke_10_simple_requests", nullptr, nullptr); for (i = 0; i < 10; i++) { simple_request_body(config, f); gpr_log(GPR_INFO, "Passed simple request %d", i); diff --git a/test/core/end2end/tests/invoke_large_request.cc b/test/core/end2end/tests/invoke_large_request.cc index ade61ac91db09..8a67e3c2b1794 100644 --- a/test/core/end2end/tests/invoke_large_request.cc +++ b/test/core/end2end/tests/invoke_large_request.cc @@ -50,7 +50,7 @@ static gpr_timespec n_seconds_from_now(int n) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, n_seconds_from_now(5), NULL); + ev = grpc_completion_queue_next(cq, n_seconds_from_now(5), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -59,16 +59,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -121,8 +121,8 @@ static void test_invoke_large_request(grpc_end2end_test_config config, grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; - grpc_byte_buffer* request_payload_recv = NULL; - grpc_byte_buffer* response_payload_recv = NULL; + grpc_byte_buffer* request_payload_recv = nullptr; + grpc_byte_buffer* response_payload_recv = nullptr; grpc_call_details call_details; grpc_status_code status; grpc_call_error error; @@ -131,10 +131,10 @@ static void test_invoke_large_request(grpc_end2end_test_config config, gpr_timespec deadline = n_seconds_from_now(30); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -147,35 +147,35 @@ static void test_invoke_large_request(grpc_end2end_test_config config, 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_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &response_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -190,14 +190,14 @@ static void test_invoke_large_request(grpc_end2end_test_config config, 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_MESSAGE; op->data.recv_message.recv_message = &request_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -208,12 +208,12 @@ static void test_invoke_large_request(grpc_end2end_test_config config, op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = response_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -221,9 +221,9 @@ static void test_invoke_large_request(grpc_end2end_test_config config, grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(103), 1); diff --git a/test/core/end2end/tests/keepalive_timeout.cc b/test/core/end2end/tests/keepalive_timeout.cc index d071254a98d70..822565510f3d3 100644 --- a/test/core/end2end/tests/keepalive_timeout.cc +++ b/test/core/end2end/tests/keepalive_timeout.cc @@ -57,7 +57,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -66,16 +66,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), - five_seconds_from_now(), NULL) + five_seconds_from_now(), nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -112,14 +112,14 @@ static void test_keepalive_timeout(grpc_end2end_test_config config) { keepalive_arg_elems}; grpc_end2end_test_fixture f = - begin_test(config, "keepalive_timeout", &keepalive_args, NULL); + begin_test(config, "keepalive_timeout", &keepalive_args, nullptr); cq_verifier* cqv = cq_verifier_create(f.cq); grpc_op ops[6]; grpc_op* op; grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; - grpc_byte_buffer* response_payload_recv = NULL; + grpc_byte_buffer* response_payload_recv = nullptr; grpc_call_details call_details; grpc_status_code status; grpc_call_error error; @@ -130,10 +130,10 @@ static void test_keepalive_timeout(grpc_end2end_test_config config) { gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -154,7 +154,7 @@ static void test_keepalive_timeout(grpc_end2end_test_config config) { op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &response_payload_recv; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( @@ -171,7 +171,7 @@ static void test_keepalive_timeout(grpc_end2end_test_config config) { op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = response_payload; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -185,7 +185,7 @@ static void test_keepalive_timeout(grpc_end2end_test_config config) { op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(3), 1); diff --git a/test/core/end2end/tests/large_metadata.cc b/test/core/end2end/tests/large_metadata.cc index 4afd9f31ba86a..8ddf433ac0fb3 100644 --- a/test/core/end2end/tests/large_metadata.cc +++ b/test/core/end2end/tests/large_metadata.cc @@ -53,7 +53,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -62,16 +62,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -107,7 +107,7 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; - grpc_byte_buffer* request_payload_recv = NULL; + grpc_byte_buffer* request_payload_recv = nullptr; grpc_call_details call_details; grpc_status_code status; grpc_call_error error; @@ -116,10 +116,10 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); meta.key = grpc_slice_from_static_string("key"); @@ -138,30 +138,30 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { op->data.send_initial_metadata.count = 1; op->data.send_initial_metadata.metadata = &meta; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -178,14 +178,14 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { 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_MESSAGE; op->data.recv_message.recv_message = &request_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -198,7 +198,7 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -206,9 +206,9 @@ static void test_request_with_large_metadata(grpc_end2end_test_config config) { grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(103), 1); diff --git a/test/core/end2end/tests/load_reporting_hook.cc b/test/core/end2end/tests/load_reporting_hook.cc index 5c2c3b497cf2b..faabec34cb6f6 100644 --- a/test/core/end2end/tests/load_reporting_hook.cc +++ b/test/core/end2end/tests/load_reporting_hook.cc @@ -80,7 +80,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -89,16 +89,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -130,8 +130,8 @@ static void request_response_with_payload( grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; - grpc_byte_buffer* request_payload_recv = NULL; - grpc_byte_buffer* response_payload_recv = NULL; + grpc_byte_buffer* request_payload_recv = nullptr; + grpc_byte_buffer* response_payload_recv = nullptr; grpc_call_details call_details; grpc_status_code status; grpc_call_error error; @@ -140,10 +140,10 @@ static void request_response_with_payload( gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string(method_name), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -154,39 +154,39 @@ static void request_response_with_payload( memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; - GPR_ASSERT(initial_lr_metadata != NULL); + GPR_ASSERT(initial_lr_metadata != nullptr); op->data.send_initial_metadata.count = 1; op->data.send_initial_metadata.metadata = initial_lr_metadata; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &response_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -201,14 +201,14 @@ static void request_response_with_payload( 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_MESSAGE; op->data.recv_message.recv_message = &request_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -219,24 +219,24 @@ static void request_response_with_payload( op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = response_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; - GPR_ASSERT(trailing_lr_metadata != NULL); + GPR_ASSERT(trailing_lr_metadata != nullptr); op->data.send_status_from_server.trailing_metadata_count = 1; op->data.send_status_from_server.trailing_metadata = trailing_lr_metadata; op->data.send_status_from_server.status = GRPC_STATUS_OK; grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(103), 1); @@ -273,10 +273,10 @@ static void test_load_reporting_hook(grpc_end2end_test_config config) { /* Introduce load reporting for the server through its arguments */ grpc_arg arg = grpc_load_reporting_enable_arg(); grpc_channel_args* lr_server_args = - grpc_channel_args_copy_and_add(NULL, &arg, 1); + grpc_channel_args_copy_and_add(nullptr, &arg, 1); grpc_end2end_test_fixture f = - begin_test(config, "test_load_reporting_hook", NULL, lr_server_args); + begin_test(config, "test_load_reporting_hook", nullptr, lr_server_args); const char* method_name = "/gRPCFTW"; const char* request_msg = "the msg from the client"; diff --git a/test/core/end2end/tests/max_concurrent_streams.cc b/test/core/end2end/tests/max_concurrent_streams.cc index b8b49d65fb039..c0539739e1e6e 100644 --- a/test/core/end2end/tests/max_concurrent_streams.cc +++ b/test/core/end2end/tests/max_concurrent_streams.cc @@ -53,7 +53,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -62,16 +62,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -102,10 +102,10 @@ static void simple_request_body(grpc_end2end_test_config config, gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -118,25 +118,25 @@ static void simple_request_body(grpc_end2end_test_config config, 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_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -151,7 +151,7 @@ static void simple_request_body(grpc_end2end_test_config config, 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_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -159,14 +159,14 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -228,7 +228,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { server_args.num_args = 1; server_args.args = &server_arg; - f = begin_test(config, "test_max_concurrent_streams", NULL, &server_args); + f = begin_test(config, "test_max_concurrent_streams", nullptr, &server_args); cqv = cq_verifier_create(f.cq); grpc_metadata_array_init(&request_metadata_recv); @@ -248,16 +248,16 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { the first completes */ deadline = n_seconds_from_now(1000); c1 = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/alpha"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c1); c2 = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/beta"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c2); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( @@ -269,13 +269,13 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { 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_SEND_CLOSE_FROM_CLIENT; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c1, ops, (size_t)(op - ops), tag(301), NULL); + error = grpc_call_start_batch(c1, ops, (size_t)(op - ops), tag(301), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); memset(ops, 0, sizeof(ops)); @@ -285,15 +285,15 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { op->data.recv_status_on_client.status = &status1; op->data.recv_status_on_client.status_details = &details1; 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 = &initial_metadata_recv1; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c1, ops, (size_t)(op - ops), tag(302), NULL); + error = grpc_call_start_batch(c1, ops, (size_t)(op - ops), tag(302), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); memset(ops, 0, sizeof(ops)); @@ -301,13 +301,13 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { 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_SEND_CLOSE_FROM_CLIENT; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c2, ops, (size_t)(op - ops), tag(401), NULL); + error = grpc_call_start_batch(c2, ops, (size_t)(op - ops), tag(401), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); memset(ops, 0, sizeof(ops)); @@ -317,15 +317,15 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { op->data.recv_status_on_client.status = &status2; op->data.recv_status_on_client.status_details = &details2; 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 = &initial_metadata_recv1; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c2, ops, (size_t)(op - ops), tag(402), NULL); + error = grpc_call_start_batch(c2, ops, (size_t)(op - ops), tag(402), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); got_client_start = 0; @@ -333,7 +333,7 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { live_call = -1; while (!got_client_start || !got_server_start) { ev = grpc_completion_queue_next(f.cq, grpc_timeout_seconds_to_deadline(3), - NULL); + nullptr); GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); GPR_ASSERT(ev.success); if (ev.tag == tag(101)) { @@ -357,12 +357,12 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { 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_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -370,9 +370,9 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s1, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s1, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -395,21 +395,21 @@ static void test_max_concurrent_streams(grpc_end2end_test_config config) { 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_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; op->data.send_status_from_server.status = GRPC_STATUS_UNIMPLEMENTED; op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s2, ops, (size_t)(op - ops), tag(202), NULL); + error = grpc_call_start_batch(s2, ops, (size_t)(op - ops), tag(202), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(live_call + 2), 1); @@ -469,7 +469,7 @@ static void test_max_concurrent_streams_with_timeout_on_first( server_args.args = &server_arg; f = begin_test(config, "test_max_concurrent_streams_with_timeout_on_first", - NULL, &server_args); + nullptr, &server_args); cqv = cq_verifier_create(f.cq); grpc_metadata_array_init(&request_metadata_recv); @@ -488,16 +488,16 @@ static void test_max_concurrent_streams_with_timeout_on_first( /* start two requests - ensuring that the second is not accepted until the first completes */ c1 = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/alpha"), get_host_override_slice("foo.test.google.fr:1234", config), - n_seconds_from_now(3), NULL); + n_seconds_from_now(3), nullptr); GPR_ASSERT(c1); c2 = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/beta"), get_host_override_slice("foo.test.google.fr:1234", config), - n_seconds_from_now(1000), NULL); + n_seconds_from_now(1000), nullptr); GPR_ASSERT(c2); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( @@ -509,13 +509,13 @@ static void test_max_concurrent_streams_with_timeout_on_first( 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_SEND_CLOSE_FROM_CLIENT; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c1, ops, (size_t)(op - ops), tag(301), NULL); + error = grpc_call_start_batch(c1, ops, (size_t)(op - ops), tag(301), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); memset(ops, 0, sizeof(ops)); @@ -525,15 +525,15 @@ static void test_max_concurrent_streams_with_timeout_on_first( op->data.recv_status_on_client.status = &status1; op->data.recv_status_on_client.status_details = &details1; 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 = &initial_metadata_recv1; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c1, ops, (size_t)(op - ops), tag(302), NULL); + error = grpc_call_start_batch(c1, ops, (size_t)(op - ops), tag(302), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(101), 1); @@ -545,13 +545,13 @@ static void test_max_concurrent_streams_with_timeout_on_first( 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_SEND_CLOSE_FROM_CLIENT; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c2, ops, (size_t)(op - ops), tag(401), NULL); + error = grpc_call_start_batch(c2, ops, (size_t)(op - ops), tag(401), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); memset(ops, 0, sizeof(ops)); @@ -561,15 +561,15 @@ static void test_max_concurrent_streams_with_timeout_on_first( op->data.recv_status_on_client.status = &status2; op->data.recv_status_on_client.status_details = &details2; 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 = &initial_metadata_recv2; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c2, ops, (size_t)(op - ops), tag(402), NULL); + error = grpc_call_start_batch(c2, ops, (size_t)(op - ops), tag(402), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); grpc_call_details_destroy(&call_details); @@ -589,12 +589,12 @@ static void test_max_concurrent_streams_with_timeout_on_first( 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_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -602,9 +602,9 @@ static void test_max_concurrent_streams_with_timeout_on_first( grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s2, ops, (size_t)(op - ops), tag(202), NULL); + error = grpc_call_start_batch(s2, ops, (size_t)(op - ops), tag(202), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(402), 1); @@ -663,7 +663,7 @@ static void test_max_concurrent_streams_with_timeout_on_second( server_args.args = &server_arg; f = begin_test(config, "test_max_concurrent_streams_with_timeout_on_second", - NULL, &server_args); + nullptr, &server_args); cqv = cq_verifier_create(f.cq); grpc_metadata_array_init(&request_metadata_recv); @@ -683,16 +683,16 @@ static void test_max_concurrent_streams_with_timeout_on_second( the first completes , and the second request will timeout in the concurrent_list */ c1 = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/alpha"), get_host_override_slice("foo.test.google.fr:1234", config), - n_seconds_from_now(1000), NULL); + n_seconds_from_now(1000), nullptr); GPR_ASSERT(c1); c2 = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/beta"), get_host_override_slice("foo.test.google.fr:1234", config), - n_seconds_from_now(3), NULL); + n_seconds_from_now(3), nullptr); GPR_ASSERT(c2); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( @@ -704,13 +704,13 @@ static void test_max_concurrent_streams_with_timeout_on_second( 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_SEND_CLOSE_FROM_CLIENT; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c1, ops, (size_t)(op - ops), tag(301), NULL); + error = grpc_call_start_batch(c1, ops, (size_t)(op - ops), tag(301), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); memset(ops, 0, sizeof(ops)); @@ -720,15 +720,15 @@ static void test_max_concurrent_streams_with_timeout_on_second( op->data.recv_status_on_client.status = &status1; op->data.recv_status_on_client.status_details = &details1; 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 = &initial_metadata_recv1; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c1, ops, (size_t)(op - ops), tag(302), NULL); + error = grpc_call_start_batch(c1, ops, (size_t)(op - ops), tag(302), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(101), 1); @@ -740,13 +740,13 @@ static void test_max_concurrent_streams_with_timeout_on_second( 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_SEND_CLOSE_FROM_CLIENT; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c2, ops, (size_t)(op - ops), tag(401), NULL); + error = grpc_call_start_batch(c2, ops, (size_t)(op - ops), tag(401), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); memset(ops, 0, sizeof(ops)); @@ -756,15 +756,15 @@ static void test_max_concurrent_streams_with_timeout_on_second( op->data.recv_status_on_client.status = &status2; op->data.recv_status_on_client.status_details = &details2; 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 = &initial_metadata_recv2; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c2, ops, (size_t)(op - ops), tag(402), NULL); + error = grpc_call_start_batch(c2, ops, (size_t)(op - ops), tag(402), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); /* the second request is time out*/ @@ -782,12 +782,12 @@ static void test_max_concurrent_streams_with_timeout_on_second( 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_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -795,9 +795,9 @@ static void test_max_concurrent_streams_with_timeout_on_second( grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s1, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s1, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(302), 1); diff --git a/test/core/end2end/tests/max_connection_age.cc b/test/core/end2end/tests/max_connection_age.cc index b5d4dcf963795..ddccfc3b5175f 100644 --- a/test/core/end2end/tests/max_connection_age.cc +++ b/test/core/end2end/tests/max_connection_age.cc @@ -51,20 +51,20 @@ static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { ev = grpc_completion_queue_next(cq, grpc_timeout_seconds_to_deadline(5), - NULL); + nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void shutdown_server(grpc_end2end_test_fixture* f) { if (!f->server) return; grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -78,7 +78,7 @@ static void end_test(grpc_end2end_test_fixture* f) { } static void test_max_age_forcibly_close(grpc_end2end_test_config config) { - grpc_end2end_test_fixture f = config.create_fixture(NULL, NULL); + grpc_end2end_test_fixture f = config.create_fixture(nullptr, nullptr); cq_verifier* cqv = cq_verifier_create(f.cq); grpc_arg server_a[3]; server_a[0].type = GRPC_ARG_INTEGER; @@ -92,7 +92,7 @@ static void test_max_age_forcibly_close(grpc_end2end_test_config config) { server_a[2].value.integer = MAX_CONNECTION_IDLE_MS; grpc_channel_args server_args = {GPR_ARRAY_SIZE(server_a), server_a}; - config.init_client(&f, NULL); + config.init_client(&f, nullptr); config.init_server(&f, &server_args); grpc_call* c; @@ -110,10 +110,10 @@ static void test_max_age_forcibly_close(grpc_end2end_test_config config) { int was_cancelled = 2; c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -125,27 +125,27 @@ static void test_max_age_forcibly_close(grpc_end2end_test_config config) { op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; - op->data.send_initial_metadata.metadata = NULL; + op->data.send_initial_metadata.metadata = nullptr; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -175,7 +175,7 @@ static void test_max_age_forcibly_close(grpc_end2end_test_config config) { 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_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -183,14 +183,14 @@ static void test_max_age_forcibly_close(grpc_end2end_test_config config) { grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), true); cq_verify(cqv); @@ -221,7 +221,7 @@ static void test_max_age_forcibly_close(grpc_end2end_test_config config) { } static void test_max_age_gracefully_close(grpc_end2end_test_config config) { - grpc_end2end_test_fixture f = config.create_fixture(NULL, NULL); + grpc_end2end_test_fixture f = config.create_fixture(nullptr, nullptr); cq_verifier* cqv = cq_verifier_create(f.cq); grpc_arg server_a[3]; server_a[0].type = GRPC_ARG_INTEGER; @@ -235,7 +235,7 @@ static void test_max_age_gracefully_close(grpc_end2end_test_config config) { server_a[2].value.integer = MAX_CONNECTION_IDLE_MS; grpc_channel_args server_args = {GPR_ARRAY_SIZE(server_a), server_a}; - config.init_client(&f, NULL); + config.init_client(&f, nullptr); config.init_server(&f, &server_args); grpc_call* c; @@ -253,10 +253,10 @@ static void test_max_age_gracefully_close(grpc_end2end_test_config config) { int was_cancelled = 2; c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -268,27 +268,27 @@ static void test_max_age_gracefully_close(grpc_end2end_test_config config) { op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; - op->data.send_initial_metadata.metadata = NULL; + op->data.send_initial_metadata.metadata = nullptr; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -310,7 +310,7 @@ static void test_max_age_gracefully_close(grpc_end2end_test_config config) { 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_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -318,14 +318,14 @@ static void test_max_age_gracefully_close(grpc_end2end_test_config config) { grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), true); diff --git a/test/core/end2end/tests/max_connection_idle.cc b/test/core/end2end/tests/max_connection_idle.cc index d850e4267b245..293ff7d1f2bd8 100644 --- a/test/core/end2end/tests/max_connection_idle.cc +++ b/test/core/end2end/tests/max_connection_idle.cc @@ -38,7 +38,7 @@ static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { ev = grpc_completion_queue_next(cq, grpc_timeout_seconds_to_deadline(5), - NULL); + nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -61,14 +61,14 @@ static void simple_request_body(grpc_end2end_test_config config, gpr_timespec deadline = grpc_timeout_seconds_to_deadline(5); c = grpc_channel_create_call( - f->client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq, + f->client, nullptr, GRPC_PROPAGATE_DEFAULTS, f->cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); peer = grpc_call_get_peer(c); - GPR_ASSERT(peer != NULL); + GPR_ASSERT(peer != nullptr); gpr_log(GPR_DEBUG, "client_peer_before_call=%s", peer); gpr_free(peer); @@ -82,25 +82,25 @@ static void simple_request_body(grpc_end2end_test_config config, 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_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -111,11 +111,11 @@ static void simple_request_body(grpc_end2end_test_config config, cq_verify(cqv); peer = grpc_call_get_peer(s); - GPR_ASSERT(peer != NULL); + GPR_ASSERT(peer != nullptr); gpr_log(GPR_DEBUG, "server_peer=%s", peer); gpr_free(peer); peer = grpc_call_get_peer(c); - GPR_ASSERT(peer != NULL); + GPR_ASSERT(peer != nullptr); gpr_log(GPR_DEBUG, "client_peer=%s", peer); gpr_free(peer); @@ -124,7 +124,7 @@ static void simple_request_body(grpc_end2end_test_config config, 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_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -132,14 +132,14 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -167,7 +167,7 @@ static void simple_request_body(grpc_end2end_test_config config, } static void test_max_connection_idle(grpc_end2end_test_config config) { - grpc_end2end_test_fixture f = config.create_fixture(NULL, NULL); + grpc_end2end_test_fixture f = config.create_fixture(nullptr, nullptr); grpc_connectivity_state state = GRPC_CHANNEL_IDLE; cq_verifier* cqv = cq_verifier_create(f.cq); diff --git a/test/core/end2end/tests/max_message_length.cc b/test/core/end2end/tests/max_message_length.cc index 3d677f1d8fe93..e9c3785057638 100644 --- a/test/core/end2end/tests/max_message_length.cc +++ b/test/core/end2end/tests/max_message_length.cc @@ -45,7 +45,7 @@ static grpc_end2end_test_fixture begin_test(grpc_end2end_test_config config, // We intentionally do not pass the client and server args to // create_fixture(), since we don't want the limit enforced on the // proxy, only on the backend server. - f = config.create_fixture(NULL, NULL); + f = config.create_fixture(nullptr, nullptr); config.init_server(&f, server_args); config.init_client(&f, client_args); return f; @@ -62,7 +62,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -70,17 +70,17 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { if (!f->server) return; grpc_server_shutdown_and_notify(f->server, f->cq, tag(1000)); grpc_event ev = grpc_completion_queue_next( - f->cq, grpc_timeout_seconds_to_deadline(5), NULL); + f->cq, grpc_timeout_seconds_to_deadline(5), nullptr); GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); GPR_ASSERT(ev.tag == tag(1000)); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -106,8 +106,8 @@ static void test_max_message_length_on_request(grpc_end2end_test_config config, send_limit, use_service_config, use_string_json_value); grpc_end2end_test_fixture f; - grpc_call* c = NULL; - grpc_call* s = NULL; + grpc_call* c = nullptr; + grpc_call* s = nullptr; cq_verifier* cqv; grpc_op ops[6]; grpc_op* op; @@ -115,7 +115,7 @@ static void test_max_message_length_on_request(grpc_end2end_test_config config, grpc_slice_from_copied_string("hello world"); grpc_byte_buffer* request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); - grpc_byte_buffer* recv_payload = NULL; + grpc_byte_buffer* recv_payload = nullptr; grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; @@ -125,8 +125,8 @@ static void test_max_message_length_on_request(grpc_end2end_test_config config, grpc_slice details; int was_cancelled = 2; - grpc_channel_args* client_args = NULL; - grpc_channel_args* server_args = NULL; + grpc_channel_args* client_args = nullptr; + grpc_channel_args* server_args = nullptr; if (use_service_config) { // We don't currently support service configs on the server side. GPR_ASSERT(send_limit); @@ -153,7 +153,7 @@ static void test_max_message_length_on_request(grpc_end2end_test_config config, " \"maxRequestMessageBytes\": 5\n" " } ]\n" "}"); - client_args = grpc_channel_args_copy_and_add(NULL, &arg, 1); + client_args = grpc_channel_args_copy_and_add(nullptr, &arg, 1); } else { // Set limit via channel args. grpc_arg arg; @@ -162,7 +162,7 @@ static void test_max_message_length_on_request(grpc_end2end_test_config config, : const_cast(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH); arg.type = GRPC_ARG_INTEGER; arg.value.integer = 5; - grpc_channel_args* args = grpc_channel_args_copy_and_add(NULL, &arg, 1); + grpc_channel_args* args = grpc_channel_args_copy_and_add(nullptr, &arg, 1); if (send_limit) { client_args = args; } else { @@ -174,18 +174,18 @@ static void test_max_message_length_on_request(grpc_end2end_test_config config, server_args); { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - if (client_args != NULL) grpc_channel_args_destroy(&exec_ctx, client_args); - if (server_args != NULL) grpc_channel_args_destroy(&exec_ctx, server_args); + if (client_args != nullptr) grpc_channel_args_destroy(&exec_ctx, client_args); + if (server_args != nullptr) grpc_channel_args_destroy(&exec_ctx, server_args); grpc_exec_ctx_finish(&exec_ctx); } cqv = cq_verifier_create(f.cq); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/service/method"), get_host_override_slice("foo.test.google.fr:1234", config), - gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -198,30 +198,30 @@ static void test_max_message_length_on_request(grpc_end2end_test_config config, 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_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); if (send_limit) { @@ -242,14 +242,14 @@ static void test_max_message_length_on_request(grpc_end2end_test_config config, op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &recv_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -278,7 +278,7 @@ static void test_max_message_length_on_request(grpc_end2end_test_config config, grpc_byte_buffer_destroy(recv_payload); grpc_call_unref(c); - if (s != NULL) grpc_call_unref(s); + if (s != nullptr) grpc_call_unref(s); cq_verifier_destroy(cqv); @@ -299,8 +299,8 @@ static void test_max_message_length_on_response(grpc_end2end_test_config config, send_limit, use_service_config, use_string_json_value); grpc_end2end_test_fixture f; - grpc_call* c = NULL; - grpc_call* s = NULL; + grpc_call* c = nullptr; + grpc_call* s = nullptr; cq_verifier* cqv; grpc_op ops[6]; grpc_op* op; @@ -308,7 +308,7 @@ static void test_max_message_length_on_response(grpc_end2end_test_config config, grpc_slice_from_copied_string("hello world"); grpc_byte_buffer* response_payload = grpc_raw_byte_buffer_create(&response_payload_slice, 1); - grpc_byte_buffer* recv_payload = NULL; + grpc_byte_buffer* recv_payload = nullptr; grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; @@ -318,8 +318,8 @@ static void test_max_message_length_on_response(grpc_end2end_test_config config, grpc_slice details; int was_cancelled = 2; - grpc_channel_args* client_args = NULL; - grpc_channel_args* server_args = NULL; + grpc_channel_args* client_args = nullptr; + grpc_channel_args* server_args = nullptr; if (use_service_config) { // We don't currently support service configs on the server side. GPR_ASSERT(!send_limit); @@ -344,7 +344,7 @@ static void test_max_message_length_on_response(grpc_end2end_test_config config, " \"maxResponseMessageBytes\": 5\n" " } ]\n" "}"); - client_args = grpc_channel_args_copy_and_add(NULL, &arg, 1); + client_args = grpc_channel_args_copy_and_add(nullptr, &arg, 1); } else { // Set limit via channel args. grpc_arg arg; @@ -353,7 +353,7 @@ static void test_max_message_length_on_response(grpc_end2end_test_config config, : const_cast(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH); arg.type = GRPC_ARG_INTEGER; arg.value.integer = 5; - grpc_channel_args* args = grpc_channel_args_copy_and_add(NULL, &arg, 1); + grpc_channel_args* args = grpc_channel_args_copy_and_add(nullptr, &arg, 1); if (send_limit) { server_args = args; } else { @@ -365,17 +365,17 @@ static void test_max_message_length_on_response(grpc_end2end_test_config config, server_args); { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - if (client_args != NULL) grpc_channel_args_destroy(&exec_ctx, client_args); - if (server_args != NULL) grpc_channel_args_destroy(&exec_ctx, server_args); + if (client_args != nullptr) grpc_channel_args_destroy(&exec_ctx, client_args); + if (server_args != nullptr) grpc_channel_args_destroy(&exec_ctx, server_args); grpc_exec_ctx_finish(&exec_ctx); } cqv = cq_verifier_create(f.cq); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/service/method"), get_host_override_slice("foo.test.google.fr:1234", config), - gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -388,30 +388,30 @@ static void test_max_message_length_on_response(grpc_end2end_test_config config, 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_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &recv_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -426,17 +426,17 @@ static void test_max_message_length_on_response(grpc_end2end_test_config config, 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_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = response_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -444,9 +444,9 @@ static void test_max_message_length_on_response(grpc_end2end_test_config config, grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -473,7 +473,7 @@ static void test_max_message_length_on_response(grpc_end2end_test_config config, grpc_byte_buffer_destroy(recv_payload); grpc_call_unref(c); - if (s != NULL) grpc_call_unref(s); + if (s != nullptr) grpc_call_unref(s); cq_verifier_destroy(cqv); diff --git a/test/core/end2end/tests/negative_deadline.cc b/test/core/end2end/tests/negative_deadline.cc index 0d56038684330..b793964b4829e 100644 --- a/test/core/end2end/tests/negative_deadline.cc +++ b/test/core/end2end/tests/negative_deadline.cc @@ -55,7 +55,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -64,16 +64,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -102,10 +102,10 @@ static void simple_request_body(grpc_end2end_test_config config, gpr_timespec deadline = gpr_inf_past(GPR_CLOCK_REALTIME); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -118,24 +118,24 @@ static void simple_request_body(grpc_end2end_test_config config, op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; 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_SEND_CLOSE_FROM_CLIENT; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; GPR_ASSERT(num_ops <= (size_t)(op - ops)); - error = grpc_call_start_batch(c, ops, num_ops, tag(1), NULL); + error = grpc_call_start_batch(c, ops, num_ops, tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(1), 1); @@ -156,7 +156,7 @@ static void test_invoke_simple_request(grpc_end2end_test_config config, size_t num_ops) { grpc_end2end_test_fixture f; - f = begin_test(config, "test_invoke_simple_request", NULL, NULL); + f = begin_test(config, "test_invoke_simple_request", nullptr, nullptr); simple_request_body(config, f, num_ops); end_test(&f); config.tear_down_data(&f); diff --git a/test/core/end2end/tests/network_status_change.cc b/test/core/end2end/tests/network_status_change.cc index 088563cb2c16b..7d0318fda6b96 100644 --- a/test/core/end2end/tests/network_status_change.cc +++ b/test/core/end2end/tests/network_status_change.cc @@ -56,7 +56,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -65,16 +65,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -96,14 +96,14 @@ static void test_invoke_network_status_change(grpc_end2end_test_config config) { grpc_byte_buffer* request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); grpc_end2end_test_fixture f = - begin_test(config, "test_invoke_request_with_payload", NULL, NULL); + begin_test(config, "test_invoke_request_with_payload", nullptr, nullptr); cq_verifier* cqv = cq_verifier_create(f.cq); grpc_op ops[6]; grpc_op* op; grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; - grpc_byte_buffer* request_payload_recv = NULL; + grpc_byte_buffer* request_payload_recv = nullptr; grpc_call_details call_details; grpc_status_code status; grpc_call_error error; @@ -112,10 +112,10 @@ static void test_invoke_network_status_change(grpc_end2end_test_config config) { gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -128,30 +128,30 @@ static void test_invoke_network_status_change(grpc_end2end_test_config config) { 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_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( @@ -164,14 +164,14 @@ static void test_invoke_network_status_change(grpc_end2end_test_config config) { 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_MESSAGE; op->data.recv_message.recv_message = &request_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -184,7 +184,7 @@ static void test_invoke_network_status_change(grpc_end2end_test_config config) { op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -192,9 +192,9 @@ static void test_invoke_network_status_change(grpc_end2end_test_config config) { grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(103), 1); diff --git a/test/core/end2end/tests/no_logging.cc b/test/core/end2end/tests/no_logging.cc index 1a7b57cd84ad0..55d211c44a2bc 100644 --- a/test/core/end2end/tests/no_logging.cc +++ b/test/core/end2end/tests/no_logging.cc @@ -39,7 +39,7 @@ static void* tag(intptr_t t) { return (void*)t; } extern "C" void gpr_default_log(gpr_log_func_args* args); static void test_no_log(gpr_log_func_args* args) { - char* message = NULL; + char* message = nullptr; gpr_asprintf(&message, "Unwanted log: %s", args->message); args->message = message; gpr_default_log(args); @@ -83,7 +83,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -92,16 +92,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -133,14 +133,14 @@ static void simple_request_body(grpc_end2end_test_config config, gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); peer = grpc_call_get_peer(c); - GPR_ASSERT(peer != NULL); + GPR_ASSERT(peer != nullptr); gpr_free(peer); grpc_metadata_array_init(&initial_metadata_recv); @@ -153,25 +153,25 @@ static void simple_request_body(grpc_end2end_test_config config, 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_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -182,10 +182,10 @@ static void simple_request_body(grpc_end2end_test_config config, cq_verify(cqv); peer = grpc_call_get_peer(s); - GPR_ASSERT(peer != NULL); + GPR_ASSERT(peer != nullptr); gpr_free(peer); peer = grpc_call_get_peer(c); - GPR_ASSERT(peer != NULL); + GPR_ASSERT(peer != nullptr); gpr_free(peer); memset(ops, 0, sizeof(ops)); @@ -193,7 +193,7 @@ static void simple_request_body(grpc_end2end_test_config config, 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_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -201,14 +201,14 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -239,7 +239,7 @@ static void test_invoke_simple_request(grpc_end2end_test_config config) { grpc_end2end_test_fixture f; f = begin_test(config, "test_invoke_simple_request_with_no_error_logging", - NULL, NULL); + nullptr, nullptr); simple_request_body(config, f); end_test(&f); config.tear_down_data(&f); @@ -249,7 +249,7 @@ static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { int i; grpc_end2end_test_fixture f = begin_test(config, "test_invoke_10_simple_requests_with_no_error_logging", - NULL, NULL); + nullptr, nullptr); for (i = 0; i < 10; i++) { simple_request_body(config, f); gpr_log(GPR_INFO, "Passed simple request %d", i); @@ -273,7 +273,7 @@ static void test_no_error_logging_in_entire_process( static void test_no_logging_in_one_request(grpc_end2end_test_config config) { int i; grpc_end2end_test_fixture f = - begin_test(config, "test_no_logging_in_last_request", NULL, NULL); + begin_test(config, "test_no_logging_in_last_request", nullptr, nullptr); for (i = 0; i < 10; i++) { simple_request_body(config, f); } diff --git a/test/core/end2end/tests/no_op.cc b/test/core/end2end/tests/no_op.cc index 98cf5eb9dc1df..18c2367ac4452 100644 --- a/test/core/end2end/tests/no_op.cc +++ b/test/core/end2end/tests/no_op.cc @@ -53,7 +53,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -62,16 +62,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -85,7 +85,7 @@ static void end_test(grpc_end2end_test_fixture* f) { } static void test_no_op(grpc_end2end_test_config config) { - grpc_end2end_test_fixture f = begin_test(config, "no-op", NULL, NULL); + grpc_end2end_test_fixture f = begin_test(config, "no-op", nullptr, nullptr); end_test(&f); config.tear_down_data(&f); } diff --git a/test/core/end2end/tests/payload.cc b/test/core/end2end/tests/payload.cc index 0ff9461a477cf..2e9513b9cbe29 100644 --- a/test/core/end2end/tests/payload.cc +++ b/test/core/end2end/tests/payload.cc @@ -53,7 +53,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -62,16 +62,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -121,8 +121,8 @@ static void request_response_with_payload(grpc_end2end_test_config config, grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; - grpc_byte_buffer* request_payload_recv = NULL; - grpc_byte_buffer* response_payload_recv = NULL; + grpc_byte_buffer* request_payload_recv = nullptr; + grpc_byte_buffer* response_payload_recv = nullptr; grpc_call_details call_details; grpc_status_code status; grpc_call_error error; @@ -131,10 +131,10 @@ static void request_response_with_payload(grpc_end2end_test_config config, gpr_timespec deadline = n_seconds_from_now(60); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -147,35 +147,35 @@ static void request_response_with_payload(grpc_end2end_test_config config, 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_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &response_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -190,14 +190,14 @@ static void request_response_with_payload(grpc_end2end_test_config config, 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_MESSAGE; op->data.recv_message.recv_message = &request_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -208,12 +208,12 @@ static void request_response_with_payload(grpc_end2end_test_config config, op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = response_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -221,9 +221,9 @@ static void request_response_with_payload(grpc_end2end_test_config config, grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(103), 1); @@ -262,7 +262,7 @@ static void request_response_with_payload(grpc_end2end_test_config config, static void test_invoke_request_response_with_payload( grpc_end2end_test_config config) { grpc_end2end_test_fixture f = begin_test( - config, "test_invoke_request_response_with_payload", NULL, NULL); + config, "test_invoke_request_response_with_payload", nullptr, nullptr); request_response_with_payload(config, f); end_test(&f); config.tear_down_data(&f); @@ -272,7 +272,7 @@ static void test_invoke_10_request_response_with_payload( grpc_end2end_test_config config) { int i; grpc_end2end_test_fixture f = begin_test( - config, "test_invoke_10_request_response_with_payload", NULL, NULL); + config, "test_invoke_10_request_response_with_payload", nullptr, nullptr); for (i = 0; i < 10; i++) { request_response_with_payload(config, f); } diff --git a/test/core/end2end/tests/ping.cc b/test/core/end2end/tests/ping.cc index 88f62c0a2b7b8..725a425fbfa6a 100644 --- a/test/core/end2end/tests/ping.cc +++ b/test/core/end2end/tests/ping.cc @@ -32,7 +32,7 @@ static void* tag(intptr_t t) { return (void*)t; } static void test_ping(grpc_end2end_test_config config, int min_time_between_pings_ms) { - grpc_end2end_test_fixture f = config.create_fixture(NULL, NULL); + grpc_end2end_test_fixture f = config.create_fixture(nullptr, nullptr); cq_verifier* cqv = cq_verifier_create(f.cq); grpc_connectivity_state state = GRPC_CHANNEL_IDLE; int i; @@ -62,7 +62,7 @@ static void test_ping(grpc_end2end_test_config config, config.init_client(&f, &client_args); config.init_server(&f, &server_args); - grpc_channel_ping(f.client, f.cq, tag(0), NULL); + grpc_channel_ping(f.client, f.cq, tag(0), nullptr); CQ_EXPECT_COMPLETION(cqv, tag(0), 0); /* check that we're still in idle, and start connecting */ @@ -86,7 +86,7 @@ static void test_ping(grpc_end2end_test_config config, } for (i = 1; i <= PING_NUM; i++) { - grpc_channel_ping(f.client, f.cq, tag(i), NULL); + grpc_channel_ping(f.client, f.cq, tag(i), nullptr); CQ_EXPECT_COMPLETION(cqv, tag(i), 1); cq_verify(cqv); } diff --git a/test/core/end2end/tests/ping_pong_streaming.cc b/test/core/end2end/tests/ping_pong_streaming.cc index 3c2e76b9f94c3..47aebe52a156a 100644 --- a/test/core/end2end/tests/ping_pong_streaming.cc +++ b/test/core/end2end/tests/ping_pong_streaming.cc @@ -53,7 +53,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -62,16 +62,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -88,7 +88,7 @@ static void end_test(grpc_end2end_test_fixture* f) { static void test_pingpong_streaming(grpc_end2end_test_config config, int messages) { grpc_end2end_test_fixture f = - begin_test(config, "test_pingpong_streaming", NULL, NULL); + begin_test(config, "test_pingpong_streaming", nullptr, nullptr); grpc_call* c; grpc_call* s; cq_verifier* cqv = cq_verifier_create(f.cq); @@ -114,10 +114,10 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -130,21 +130,21 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -159,14 +159,14 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, 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_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(101), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(101), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); for (i = 0; i < messages; i++) { @@ -178,14 +178,14 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &response_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); memset(ops, 0, sizeof(ops)); @@ -193,9 +193,9 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &request_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); cq_verify(cqv); @@ -205,9 +205,9 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = response_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(103), 1); CQ_EXPECT_COMPLETION(cqv, tag(2), 1); @@ -226,9 +226,9 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, op = ops; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); memset(ops, 0, sizeof(ops)); @@ -239,9 +239,9 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(104), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(104), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(1), 1); diff --git a/test/core/end2end/tests/proxy_auth.cc b/test/core/end2end/tests/proxy_auth.cc index d5dce7c6deea9..e4b91ab87987e 100644 --- a/test/core/end2end/tests/proxy_auth.cc +++ b/test/core/end2end/tests/proxy_auth.cc @@ -60,7 +60,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -69,16 +69,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -110,14 +110,14 @@ static void simple_request_body(grpc_end2end_test_config config, gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); peer = grpc_call_get_peer(c); - GPR_ASSERT(peer != NULL); + GPR_ASSERT(peer != nullptr); gpr_log(GPR_DEBUG, "client_peer_before_call=%s", peer); gpr_free(peer); @@ -131,25 +131,25 @@ static void simple_request_body(grpc_end2end_test_config config, 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_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -160,11 +160,11 @@ static void simple_request_body(grpc_end2end_test_config config, cq_verify(cqv); peer = grpc_call_get_peer(s); - GPR_ASSERT(peer != NULL); + GPR_ASSERT(peer != nullptr); gpr_log(GPR_DEBUG, "server_peer=%s", peer); gpr_free(peer); peer = grpc_call_get_peer(c); - GPR_ASSERT(peer != NULL); + GPR_ASSERT(peer != nullptr); gpr_log(GPR_DEBUG, "client_peer=%s", peer); gpr_free(peer); @@ -173,7 +173,7 @@ static void simple_request_body(grpc_end2end_test_config config, 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_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -181,14 +181,14 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -223,7 +223,7 @@ static void test_invoke_proxy_auth(grpc_end2end_test_config config) { client_arg.value.string = const_cast(GRPC_TEST_HTTP_PROXY_AUTH_CREDS); grpc_channel_args client_args = {1, &client_arg}; grpc_end2end_test_fixture f = - begin_test(config, "test_invoke_proxy_auth", &client_args, NULL); + begin_test(config, "test_invoke_proxy_auth", &client_args, nullptr); simple_request_body(config, f); end_test(&f); config.tear_down_data(&f); diff --git a/test/core/end2end/tests/registered_call.cc b/test/core/end2end/tests/registered_call.cc index b43ca04766f0a..440d817cf1378 100644 --- a/test/core/end2end/tests/registered_call.cc +++ b/test/core/end2end/tests/registered_call.cc @@ -55,7 +55,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -64,16 +64,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -104,7 +104,7 @@ static void simple_request_body(grpc_end2end_test_config config, gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_registered_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, rc, deadline, NULL); + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, rc, deadline, nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -117,25 +117,25 @@ static void simple_request_body(grpc_end2end_test_config config, 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_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -150,7 +150,7 @@ static void simple_request_body(grpc_end2end_test_config config, 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_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -158,14 +158,14 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -193,10 +193,10 @@ static void simple_request_body(grpc_end2end_test_config config, static void test_invoke_simple_request(grpc_end2end_test_config config) { grpc_end2end_test_fixture f = - begin_test(config, "test_invoke_simple_request", NULL, NULL); + begin_test(config, "test_invoke_simple_request", nullptr, nullptr); void* rc = grpc_channel_register_call( f.client, "/foo", - get_host_override_string("foo.test.google.fr:1234", config), NULL); + get_host_override_string("foo.test.google.fr:1234", config), nullptr); simple_request_body(config, f, rc); end_test(&f); @@ -206,10 +206,10 @@ static void test_invoke_simple_request(grpc_end2end_test_config config) { static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { int i; grpc_end2end_test_fixture f = - begin_test(config, "test_invoke_10_simple_requests", NULL, NULL); + begin_test(config, "test_invoke_10_simple_requests", nullptr, nullptr); void* rc = grpc_channel_register_call( f.client, "/foo", - get_host_override_string("foo.test.google.fr:1234", config), NULL); + get_host_override_string("foo.test.google.fr:1234", config), nullptr); for (i = 0; i < 10; i++) { simple_request_body(config, f, rc); diff --git a/test/core/end2end/tests/request_with_flags.cc b/test/core/end2end/tests/request_with_flags.cc index 77c931844c4ba..984d8b10f16db 100644 --- a/test/core/end2end/tests/request_with_flags.cc +++ b/test/core/end2end/tests/request_with_flags.cc @@ -54,7 +54,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -63,16 +63,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -94,14 +94,14 @@ static void test_invoke_request_with_flags( grpc_byte_buffer* request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); grpc_end2end_test_fixture f = - begin_test(config, "test_invoke_request_with_flags", NULL, NULL); + begin_test(config, "test_invoke_request_with_flags", nullptr, nullptr); cq_verifier* cqv = cq_verifier_create(f.cq); grpc_op ops[6]; grpc_op* op; grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; - grpc_byte_buffer* request_payload_recv = NULL; + grpc_byte_buffer* request_payload_recv = nullptr; grpc_call_details call_details; grpc_status_code status; grpc_call_error error; @@ -110,10 +110,10 @@ static void test_invoke_request_with_flags( gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -126,31 +126,31 @@ static void test_invoke_request_with_flags( op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = flags_for_op[op->op]; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = flags_for_op[op->op]; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = flags_for_op[op->op]; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv; op->flags = flags_for_op[op->op]; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = flags_for_op[op->op]; - op->reserved = NULL; + op->reserved = nullptr; op++; expectation = call_start_batch_expected_result; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(expectation == error); if (expectation == GRPC_CALL_OK) { diff --git a/test/core/end2end/tests/request_with_payload.cc b/test/core/end2end/tests/request_with_payload.cc index 946144239c072..b3b9ee5726a85 100644 --- a/test/core/end2end/tests/request_with_payload.cc +++ b/test/core/end2end/tests/request_with_payload.cc @@ -53,7 +53,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -62,16 +62,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -93,14 +93,14 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { grpc_byte_buffer* request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); grpc_end2end_test_fixture f = - begin_test(config, "test_invoke_request_with_payload", NULL, NULL); + begin_test(config, "test_invoke_request_with_payload", nullptr, nullptr); cq_verifier* cqv = cq_verifier_create(f.cq); grpc_op ops[6]; grpc_op* op; grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; - grpc_byte_buffer* request_payload_recv = NULL; + grpc_byte_buffer* request_payload_recv = nullptr; grpc_call_details call_details; grpc_status_code status; grpc_call_error error; @@ -109,10 +109,10 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -125,30 +125,30 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { 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_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( @@ -162,14 +162,14 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { 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_MESSAGE; op->data.recv_message.recv_message = &request_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -180,7 +180,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -188,9 +188,9 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(103), 1); diff --git a/test/core/end2end/tests/resource_quota_server.cc b/test/core/end2end/tests/resource_quota_server.cc index dd00c9843f18b..0ee014f97d0b9 100644 --- a/test/core/end2end/tests/resource_quota_server.cc +++ b/test/core/end2end/tests/resource_quota_server.cc @@ -53,7 +53,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -62,16 +62,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -124,7 +124,7 @@ void resource_quota_server(grpc_end2end_test_config config) { grpc_channel_args args = {1, &arg}; grpc_end2end_test_fixture f = - begin_test(config, "resource_quota_server", NULL, &args); + begin_test(config, "resource_quota_server", nullptr, &args); /* Create large request and response bodies. These are big enough to require * multiple round trips to deliver to the peer, and their exact contents of @@ -170,7 +170,7 @@ void resource_quota_server(grpc_end2end_test_config config) { grpc_metadata_array_init(&request_metadata_recv[i]); grpc_call_details_init(&call_details[i]); request_payload[i] = grpc_raw_byte_buffer_create(&request_payload_slice, 1); - request_payload_recv[i] = NULL; + request_payload_recv[i] = nullptr; was_cancelled[i] = 0; } @@ -185,32 +185,32 @@ void resource_quota_server(grpc_end2end_test_config config) { for (int i = 0; i < NUM_CALLS; i++) { client_calls[i] = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr", config), - n_seconds_from_now(60), NULL); + n_seconds_from_now(60), nullptr); memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = GRPC_INITIAL_METADATA_WAIT_FOR_READY; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = request_payload[i]; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv[i]; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = @@ -218,10 +218,10 @@ void resource_quota_server(grpc_end2end_test_config config) { op->data.recv_status_on_client.status = &status[i]; op->data.recv_status_on_client.status_details = &details[i]; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; error = grpc_call_start_batch(client_calls[i], ops, (size_t)(op - ops), - tag(CLIENT_BASE_TAG + i), NULL); + tag(CLIENT_BASE_TAG + i), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); pending_client_calls++; @@ -231,7 +231,7 @@ void resource_quota_server(grpc_end2end_test_config config) { pending_server_end_calls > 0) { grpc_event ev = - grpc_completion_queue_next(f.cq, n_seconds_from_now(60), NULL); + grpc_completion_queue_next(f.cq, n_seconds_from_now(60), nullptr); GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); int ev_tag = (int)(intptr_t)ev.tag; @@ -278,16 +278,16 @@ void resource_quota_server(grpc_end2end_test_config config) { 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_MESSAGE; op->data.recv_message.recv_message = &request_payload_recv[call_id]; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; error = grpc_call_start_batch(server_calls[call_id], ops, (size_t)(op - ops), - tag(SERVER_RECV_BASE_TAG + call_id), NULL); + tag(SERVER_RECV_BASE_TAG + call_id), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); GPR_ASSERT(pending_server_start_calls > 0); @@ -303,12 +303,12 @@ void resource_quota_server(grpc_end2end_test_config config) { GPR_ASSERT(call_id < NUM_CALLS); if (ev.success) { - if (request_payload_recv[call_id] != NULL) { + if (request_payload_recv[call_id] != nullptr) { grpc_byte_buffer_destroy(request_payload_recv[call_id]); - request_payload_recv[call_id] = NULL; + request_payload_recv[call_id] = nullptr; } } else { - GPR_ASSERT(request_payload_recv[call_id] == NULL); + GPR_ASSERT(request_payload_recv[call_id] == nullptr); } memset(ops, 0, sizeof(ops)); @@ -316,7 +316,7 @@ void resource_quota_server(grpc_end2end_test_config config) { op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled[call_id]; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -324,11 +324,11 @@ void resource_quota_server(grpc_end2end_test_config config) { grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; error = grpc_call_start_batch(server_calls[call_id], ops, (size_t)(op - ops), - tag(SERVER_END_BASE_TAG + call_id), NULL); + tag(SERVER_END_BASE_TAG + call_id), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); GPR_ASSERT(pending_server_recv_calls > 0); diff --git a/test/core/end2end/tests/server_finishes_request.cc b/test/core/end2end/tests/server_finishes_request.cc index 50544a6759fcd..46b874b56971b 100644 --- a/test/core/end2end/tests/server_finishes_request.cc +++ b/test/core/end2end/tests/server_finishes_request.cc @@ -55,7 +55,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -64,16 +64,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -104,10 +104,10 @@ static void simple_request_body(grpc_end2end_test_config config, gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -120,21 +120,21 @@ static void simple_request_body(grpc_end2end_test_config config, 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -149,7 +149,7 @@ static void simple_request_body(grpc_end2end_test_config config, 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_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -157,14 +157,14 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -193,7 +193,7 @@ static void simple_request_body(grpc_end2end_test_config config, static void test_invoke_simple_request(grpc_end2end_test_config config) { grpc_end2end_test_fixture f; - f = begin_test(config, "test_invoke_simple_request", NULL, NULL); + f = begin_test(config, "test_invoke_simple_request", nullptr, nullptr); simple_request_body(config, f); end_test(&f); config.tear_down_data(&f); diff --git a/test/core/end2end/tests/shutdown_finishes_calls.cc b/test/core/end2end/tests/shutdown_finishes_calls.cc index 26a53e5161be8..b939877cf0356 100644 --- a/test/core/end2end/tests/shutdown_finishes_calls.cc +++ b/test/core/end2end/tests/shutdown_finishes_calls.cc @@ -53,14 +53,14 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -78,7 +78,7 @@ static void test_early_server_shutdown_finishes_inflight_calls( grpc_call* c; grpc_call* s; grpc_end2end_test_fixture f = begin_test( - config, "test_early_server_shutdown_finishes_inflight_calls", NULL, NULL); + config, "test_early_server_shutdown_finishes_inflight_calls", nullptr, nullptr); cq_verifier* cqv = cq_verifier_create(f.cq); grpc_op ops[6]; grpc_op* op; @@ -93,10 +93,10 @@ static void test_early_server_shutdown_finishes_inflight_calls( gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -108,27 +108,27 @@ static void test_early_server_shutdown_finishes_inflight_calls( op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; - op->data.send_initial_metadata.metadata = NULL; + op->data.send_initial_metadata.metadata = nullptr; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -143,9 +143,9 @@ static void test_early_server_shutdown_finishes_inflight_calls( op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); /* shutdown and destroy the server */ diff --git a/test/core/end2end/tests/shutdown_finishes_tags.cc b/test/core/end2end/tests/shutdown_finishes_tags.cc index 0275a1e4efcab..de64eba61263c 100644 --- a/test/core/end2end/tests/shutdown_finishes_tags.cc +++ b/test/core/end2end/tests/shutdown_finishes_tags.cc @@ -53,14 +53,14 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -76,7 +76,7 @@ static void end_test(grpc_end2end_test_fixture* f) { static void test_early_server_shutdown_finishes_tags( grpc_end2end_test_config config) { grpc_end2end_test_fixture f = begin_test( - config, "test_early_server_shutdown_finishes_tags", NULL, NULL); + config, "test_early_server_shutdown_finishes_tags", nullptr, nullptr); cq_verifier* cqv = cq_verifier_create(f.cq); grpc_call* s = (grpc_call*)(uintptr_t)1; grpc_call_details call_details; @@ -94,7 +94,7 @@ static void test_early_server_shutdown_finishes_tags( CQ_EXPECT_COMPLETION(cqv, tag(101), 0); CQ_EXPECT_COMPLETION(cqv, tag(1000), 1); cq_verify(cqv); - GPR_ASSERT(s == NULL); + GPR_ASSERT(s == nullptr); grpc_server_destroy(f.server); diff --git a/test/core/end2end/tests/simple_cacheable_request.cc b/test/core/end2end/tests/simple_cacheable_request.cc index e2ee7bf35a43f..02c9f49d52fc0 100644 --- a/test/core/end2end/tests/simple_cacheable_request.cc +++ b/test/core/end2end/tests/simple_cacheable_request.cc @@ -55,7 +55,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -64,16 +64,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -102,30 +102,30 @@ static void test_cacheable_request_response_with_metadata_and_payload( grpc_metadata meta_c[2] = {{grpc_slice_from_static_string("key1"), grpc_slice_from_static_string("val1"), 0, - {{NULL, NULL, NULL, NULL}}}, + {{nullptr, nullptr, nullptr, nullptr}}}, {grpc_slice_from_static_string("key2"), grpc_slice_from_static_string("val2"), 0, - {{NULL, NULL, NULL, NULL}}}}; + {{nullptr, nullptr, nullptr, nullptr}}}}; grpc_metadata meta_s[2] = {{grpc_slice_from_static_string("key3"), grpc_slice_from_static_string("val3"), 0, - {{NULL, NULL, NULL, NULL}}}, + {{nullptr, nullptr, nullptr, nullptr}}}, {grpc_slice_from_static_string("key4"), grpc_slice_from_static_string("val4"), 0, - {{NULL, NULL, NULL, NULL}}}}; + {{nullptr, nullptr, nullptr, nullptr}}}}; grpc_end2end_test_fixture f = begin_test( - config, "test_cacheable_request_response_with_metadata_and_payload", NULL, - NULL); + config, "test_cacheable_request_response_with_metadata_and_payload", nullptr, + nullptr); cq_verifier* cqv = cq_verifier_create(f.cq); grpc_op ops[6]; grpc_op* op; grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; - grpc_byte_buffer* request_payload_recv = NULL; - grpc_byte_buffer* response_payload_recv = NULL; + grpc_byte_buffer* request_payload_recv = nullptr; + grpc_byte_buffer* response_payload_recv = nullptr; grpc_call_details call_details; grpc_status_code status; grpc_call_error error; @@ -134,10 +134,10 @@ static void test_cacheable_request_response_with_metadata_and_payload( gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -151,35 +151,35 @@ static void test_cacheable_request_response_with_metadata_and_payload( op->data.send_initial_metadata.count = 2; op->data.send_initial_metadata.metadata = meta_c; op->flags = GRPC_INITIAL_METADATA_CACHEABLE_REQUEST; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &response_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -195,14 +195,14 @@ static void test_cacheable_request_response_with_metadata_and_payload( op->data.send_initial_metadata.count = 2; op->data.send_initial_metadata.metadata = meta_s; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &request_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -213,12 +213,12 @@ static void test_cacheable_request_response_with_metadata_and_payload( op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = response_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -226,9 +226,9 @@ static void test_cacheable_request_response_with_metadata_and_payload( grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(103), 1); diff --git a/test/core/end2end/tests/simple_delayed_request.cc b/test/core/end2end/tests/simple_delayed_request.cc index eef36c97109cb..0ad224f5793a7 100644 --- a/test/core/end2end/tests/simple_delayed_request.cc +++ b/test/core/end2end/tests/simple_delayed_request.cc @@ -41,7 +41,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -50,16 +50,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -96,10 +96,10 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f->client, NULL, GRPC_PROPAGATE_DEFAULTS, f->cq, + f->client, nullptr, GRPC_PROPAGATE_DEFAULTS, f->cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -112,25 +112,25 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op->flags = GRPC_INITIAL_METADATA_WAIT_FOR_READY; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -145,7 +145,7 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, 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_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -153,14 +153,14 @@ static void simple_delayed_request_body(grpc_end2end_test_config config, grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -199,9 +199,9 @@ static void test_simple_delayed_request_short(grpc_end2end_test_config config) { gpr_log(GPR_INFO, "Running test: %s/%s", "test_simple_delayed_request_short", config.name); - f = config.create_fixture(NULL, NULL); + f = config.create_fixture(nullptr, nullptr); - simple_delayed_request_body(config, &f, &client_args, NULL, 100000); + simple_delayed_request_body(config, &f, &client_args, nullptr, 100000); end_test(&f); config.tear_down_data(&f); } @@ -219,9 +219,9 @@ static void test_simple_delayed_request_long(grpc_end2end_test_config config) { gpr_log(GPR_INFO, "Running test: %s/%s", "test_simple_delayed_request_long", config.name); - f = config.create_fixture(NULL, NULL); + f = config.create_fixture(nullptr, nullptr); /* This timeout should be longer than a single retry */ - simple_delayed_request_body(config, &f, &client_args, NULL, 1500000); + simple_delayed_request_body(config, &f, &client_args, nullptr, 1500000); end_test(&f); config.tear_down_data(&f); } diff --git a/test/core/end2end/tests/simple_metadata.cc b/test/core/end2end/tests/simple_metadata.cc index 3b3d5ad64c338..38adcbae28025 100644 --- a/test/core/end2end/tests/simple_metadata.cc +++ b/test/core/end2end/tests/simple_metadata.cc @@ -53,7 +53,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -62,16 +62,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -100,29 +100,29 @@ static void test_request_response_with_metadata_and_payload( grpc_metadata meta_c[2] = {{grpc_slice_from_static_string("key1"), grpc_slice_from_static_string("val1"), 0, - {{NULL, NULL, NULL, NULL}}}, + {{nullptr, nullptr, nullptr, nullptr}}}, {grpc_slice_from_static_string("key2"), grpc_slice_from_static_string("val2"), 0, - {{NULL, NULL, NULL, NULL}}}}; + {{nullptr, nullptr, nullptr, nullptr}}}}; grpc_metadata meta_s[2] = {{grpc_slice_from_static_string("key3"), grpc_slice_from_static_string("val3"), 0, - {{NULL, NULL, NULL, NULL}}}, + {{nullptr, nullptr, nullptr, nullptr}}}, {grpc_slice_from_static_string("key4"), grpc_slice_from_static_string("val4"), 0, - {{NULL, NULL, NULL, NULL}}}}; + {{nullptr, nullptr, nullptr, nullptr}}}}; grpc_end2end_test_fixture f = begin_test( - config, "test_request_response_with_metadata_and_payload", NULL, NULL); + config, "test_request_response_with_metadata_and_payload", nullptr, nullptr); cq_verifier* cqv = cq_verifier_create(f.cq); grpc_op ops[6]; grpc_op* op; grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; - grpc_byte_buffer* request_payload_recv = NULL; - grpc_byte_buffer* response_payload_recv = NULL; + grpc_byte_buffer* request_payload_recv = nullptr; + grpc_byte_buffer* response_payload_recv = nullptr; grpc_call_details call_details; grpc_status_code status; grpc_call_error error; @@ -131,10 +131,10 @@ static void test_request_response_with_metadata_and_payload( gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -148,35 +148,35 @@ static void test_request_response_with_metadata_and_payload( op->data.send_initial_metadata.count = 2; op->data.send_initial_metadata.metadata = meta_c; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &response_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -192,14 +192,14 @@ static void test_request_response_with_metadata_and_payload( op->data.send_initial_metadata.count = 2; op->data.send_initial_metadata.metadata = meta_s; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &request_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -210,12 +210,12 @@ static void test_request_response_with_metadata_and_payload( op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = response_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -223,9 +223,9 @@ static void test_request_response_with_metadata_and_payload( grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(103), 1); diff --git a/test/core/end2end/tests/simple_request.cc b/test/core/end2end/tests/simple_request.cc index d48010ba8799a..ec7425aa09c99 100644 --- a/test/core/end2end/tests/simple_request.cc +++ b/test/core/end2end/tests/simple_request.cc @@ -56,7 +56,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -65,16 +65,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -112,14 +112,14 @@ static void simple_request_body(grpc_end2end_test_config config, gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); peer = grpc_call_get_peer(c); - GPR_ASSERT(peer != NULL); + GPR_ASSERT(peer != nullptr); gpr_log(GPR_DEBUG, "client_peer_before_call=%s", peer); gpr_free(peer); @@ -133,25 +133,25 @@ static void simple_request_body(grpc_end2end_test_config config, 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_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -162,11 +162,11 @@ static void simple_request_body(grpc_end2end_test_config config, cq_verify(cqv); peer = grpc_call_get_peer(s); - GPR_ASSERT(peer != NULL); + GPR_ASSERT(peer != nullptr); gpr_log(GPR_DEBUG, "server_peer=%s", peer); gpr_free(peer); peer = grpc_call_get_peer(c); - GPR_ASSERT(peer != NULL); + GPR_ASSERT(peer != nullptr); gpr_log(GPR_DEBUG, "client_peer=%s", peer); gpr_free(peer); @@ -175,7 +175,7 @@ static void simple_request_body(grpc_end2end_test_config config, 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_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -183,14 +183,14 @@ static void simple_request_body(grpc_end2end_test_config config, grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -239,7 +239,7 @@ static void simple_request_body(grpc_end2end_test_config config, static void test_invoke_simple_request(grpc_end2end_test_config config) { grpc_end2end_test_fixture f; - f = begin_test(config, "test_invoke_simple_request", NULL, NULL); + f = begin_test(config, "test_invoke_simple_request", nullptr, nullptr); simple_request_body(config, f); end_test(&f); config.tear_down_data(&f); @@ -248,7 +248,7 @@ static void test_invoke_simple_request(grpc_end2end_test_config config) { static void test_invoke_10_simple_requests(grpc_end2end_test_config config) { int i; grpc_end2end_test_fixture f = - begin_test(config, "test_invoke_10_simple_requests", NULL, NULL); + begin_test(config, "test_invoke_10_simple_requests", nullptr, nullptr); for (i = 0; i < 10; i++) { simple_request_body(config, f); gpr_log(GPR_INFO, "Running test: Passed simple request %d", i); diff --git a/test/core/end2end/tests/stream_compression_compressed_payload.cc b/test/core/end2end/tests/stream_compression_compressed_payload.cc index 3fe5200045cd3..e662a38a30662 100644 --- a/test/core/end2end/tests/stream_compression_compressed_payload.cc +++ b/test/core/end2end/tests/stream_compression_compressed_payload.cc @@ -61,7 +61,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -70,16 +70,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -110,7 +110,7 @@ static void request_for_disabled_algorithm( grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; - grpc_byte_buffer* request_payload_recv = NULL; + grpc_byte_buffer* request_payload_recv = nullptr; grpc_call_details call_details; grpc_status_code status; grpc_call_error error; @@ -125,9 +125,9 @@ static void request_for_disabled_algorithm( request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); client_args = grpc_channel_args_set_stream_compression_algorithm( - NULL, requested_client_compression_algorithm); + nullptr, requested_client_compression_algorithm); server_args = grpc_channel_args_set_stream_compression_algorithm( - NULL, GRPC_STREAM_COMPRESS_NONE); + nullptr, GRPC_STREAM_COMPRESS_NONE); { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; server_args = grpc_channel_args_stream_compression_algorithm_set_state( @@ -140,10 +140,10 @@ static void request_for_disabled_algorithm( gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -159,37 +159,37 @@ static void request_for_disabled_algorithm( memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; - if (client_metadata != NULL) { + if (client_metadata != nullptr) { op->data.send_initial_metadata.count = 1; op->data.send_initial_metadata.metadata = client_metadata; } else { op->data.send_initial_metadata.count = 0; } op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = send_flags_bitmask; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(101), true); @@ -200,14 +200,14 @@ static void request_for_disabled_algorithm( 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_MESSAGE; op->data.recv_message.recv_message = &request_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), false); @@ -216,9 +216,9 @@ static void request_for_disabled_algorithm( op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(103), true); @@ -229,10 +229,10 @@ static void request_for_disabled_algorithm( /* with a certain error */ GPR_ASSERT(status == expected_error); - const char* algo_name = NULL; + const char* algo_name = nullptr; GPR_ASSERT( grpc_stream_compression_algorithm_name(algorithm_to_disable, &algo_name)); - char* expected_details = NULL; + char* expected_details = nullptr; gpr_asprintf(&expected_details, "Stream compression algorithm '%s' is disabled.", algo_name); /* and we expect a specific reason for it */ @@ -285,7 +285,7 @@ static void request_with_payload_template( grpc_call* c; grpc_call* s; grpc_slice request_payload_slice; - grpc_byte_buffer* request_payload = NULL; + grpc_byte_buffer* request_payload = nullptr; grpc_channel_args* client_args; grpc_channel_args* server_args; grpc_end2end_test_fixture f; @@ -294,7 +294,7 @@ static void request_with_payload_template( grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; - grpc_byte_buffer* request_payload_recv = NULL; + grpc_byte_buffer* request_payload_recv = nullptr; grpc_byte_buffer* response_payload; grpc_byte_buffer* response_payload_recv; grpc_call_details call_details; @@ -317,13 +317,13 @@ static void request_with_payload_template( grpc_slice_from_copied_string(response_str); client_args = grpc_channel_args_set_stream_compression_algorithm( - NULL, default_client_channel_compression_algorithm); + nullptr, default_client_channel_compression_algorithm); if (set_default_server_message_compression_algorithm) { server_args = grpc_channel_args_set_compression_algorithm( - NULL, default_server_message_compression_algorithm); + nullptr, default_server_message_compression_algorithm); } else { server_args = grpc_channel_args_set_stream_compression_algorithm( - NULL, default_server_channel_compression_algorithm); + nullptr, default_server_channel_compression_algorithm); } f = begin_test(config, test_name, client_args, server_args); @@ -331,10 +331,10 @@ static void request_with_payload_template( gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -349,9 +349,9 @@ static void request_with_payload_template( op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = client_send_flags_bitmask; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(2), true); } @@ -359,28 +359,28 @@ static void request_with_payload_template( memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; - if (client_init_metadata != NULL) { + if (client_init_metadata != nullptr) { op->data.send_initial_metadata.count = 1; op->data.send_initial_metadata.metadata = client_init_metadata; } else { 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -418,14 +418,14 @@ static void request_with_payload_template( server_compression_level; } op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(101), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(101), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); for (int i = 0; i < 2; i++) { @@ -438,9 +438,9 @@ static void request_with_payload_template( op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = client_send_flags_bitmask; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(2), 1); } @@ -450,9 +450,9 @@ static void request_with_payload_template( op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &request_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -466,9 +466,9 @@ static void request_with_payload_template( op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = response_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); memset(ops, 0, sizeof(ops)); @@ -476,9 +476,9 @@ static void request_with_payload_template( op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &response_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(103), 1); @@ -501,9 +501,9 @@ static void request_with_payload_template( op = ops; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(4), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(4), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); memset(ops, 0, sizeof(ops)); @@ -514,9 +514,9 @@ static void request_with_payload_template( grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(104), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(104), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(1), 1); @@ -559,7 +559,7 @@ static void test_invoke_request_with_compressed_payload( request_with_payload_template( config, "test_invoke_request_with_compressed_payload", 0, GRPC_STREAM_COMPRESS_GZIP, GRPC_STREAM_COMPRESS_GZIP, - GRPC_STREAM_COMPRESS_GZIP, GRPC_STREAM_COMPRESS_GZIP, NULL, + GRPC_STREAM_COMPRESS_GZIP, GRPC_STREAM_COMPRESS_GZIP, nullptr, false, /* ignored */ GRPC_STREAM_COMPRESS_LEVEL_NONE, false, false, GRPC_COMPRESS_NONE); } @@ -569,7 +569,7 @@ static void test_invoke_request_with_send_message_before_initial_metadata( request_with_payload_template( config, "test_invoke_request_with_send_message_before_initial_metadata", 0, GRPC_STREAM_COMPRESS_GZIP, GRPC_STREAM_COMPRESS_GZIP, - GRPC_STREAM_COMPRESS_GZIP, GRPC_STREAM_COMPRESS_GZIP, NULL, + GRPC_STREAM_COMPRESS_GZIP, GRPC_STREAM_COMPRESS_GZIP, nullptr, false, /* ignored */ GRPC_STREAM_COMPRESS_LEVEL_NONE, true, false, GRPC_COMPRESS_NONE); } @@ -580,7 +580,7 @@ static void test_invoke_request_with_server_level( config, "test_invoke_request_with_server_level", 0, GRPC_STREAM_COMPRESS_NONE, GRPC_STREAM_COMPRESS_NONE, GRPC_STREAM_COMPRESS_NONE, GRPC_STREAM_COMPRESS_GZIP, - /* ignored */ NULL, true, GRPC_STREAM_COMPRESS_LEVEL_HIGH, false, false, + /* ignored */ nullptr, true, GRPC_STREAM_COMPRESS_LEVEL_HIGH, false, false, GRPC_COMPRESS_NONE); } @@ -626,7 +626,7 @@ static void test_invoke_request_with_disabled_algorithm( request_for_disabled_algorithm( config, "test_invoke_request_with_disabled_algorithm", 0, GRPC_STREAM_COMPRESS_GZIP, GRPC_STREAM_COMPRESS_GZIP, - GRPC_STATUS_UNIMPLEMENTED, NULL); + GRPC_STATUS_UNIMPLEMENTED, nullptr); } static void test_stream_compression_override_message_compression( @@ -638,7 +638,7 @@ static void test_stream_compression_override_message_compression( GRPC_STREAM_COMPRESS_NONE, grpc_stream_compression_algorithm_for_level( level, (1u << GRPC_STREAM_COMPRESS_ALGORITHMS_COUNT) - 1), - /* ignored */ NULL, true, level, false, true, GRPC_COMPRESS_GZIP); + /* ignored */ nullptr, true, level, false, true, GRPC_COMPRESS_GZIP); } void stream_compression_compressed_payload(grpc_end2end_test_config config) { diff --git a/test/core/end2end/tests/stream_compression_payload.cc b/test/core/end2end/tests/stream_compression_payload.cc index 038f0be738b51..924961ea55153 100644 --- a/test/core/end2end/tests/stream_compression_payload.cc +++ b/test/core/end2end/tests/stream_compression_payload.cc @@ -56,7 +56,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -65,16 +65,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -124,8 +124,8 @@ static void request_response_with_payload(grpc_end2end_test_config config, grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; - grpc_byte_buffer* request_payload_recv = NULL; - grpc_byte_buffer* response_payload_recv = NULL; + grpc_byte_buffer* request_payload_recv = nullptr; + grpc_byte_buffer* response_payload_recv = nullptr; grpc_call_details call_details; grpc_status_code status; grpc_call_error error; @@ -134,10 +134,10 @@ static void request_response_with_payload(grpc_end2end_test_config config, gpr_timespec deadline = n_seconds_from_now(60); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -150,35 +150,35 @@ static void request_response_with_payload(grpc_end2end_test_config config, 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_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &response_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -193,14 +193,14 @@ static void request_response_with_payload(grpc_end2end_test_config config, 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_MESSAGE; op->data.recv_message.recv_message = &request_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -211,12 +211,12 @@ static void request_response_with_payload(grpc_end2end_test_config config, op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = response_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -224,9 +224,9 @@ static void request_response_with_payload(grpc_end2end_test_config config, grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(103), 1); @@ -266,10 +266,10 @@ static void test_invoke_request_response_with_payload( grpc_end2end_test_config config) { grpc_channel_args* client_args = grpc_channel_args_set_stream_compression_algorithm( - NULL, GRPC_STREAM_COMPRESS_GZIP); + nullptr, GRPC_STREAM_COMPRESS_GZIP); grpc_channel_args* server_args = grpc_channel_args_set_stream_compression_algorithm( - NULL, GRPC_STREAM_COMPRESS_GZIP); + nullptr, GRPC_STREAM_COMPRESS_GZIP); grpc_end2end_test_fixture f = begin_test(config, "test_invoke_request_response_with_payload", client_args, server_args); @@ -288,7 +288,7 @@ static void test_invoke_10_request_response_with_payload( grpc_end2end_test_config config) { int i; grpc_end2end_test_fixture f = begin_test( - config, "test_invoke_10_request_response_with_payload", NULL, NULL); + config, "test_invoke_10_request_response_with_payload", nullptr, nullptr); for (i = 0; i < 10; i++) { request_response_with_payload(config, f); } diff --git a/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc b/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc index a5321bfc6190f..1cd87c9d9cc51 100644 --- a/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc +++ b/test/core/end2end/tests/stream_compression_ping_pong_streaming.cc @@ -56,7 +56,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -65,16 +65,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -92,10 +92,10 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, int messages) { grpc_channel_args* client_args = grpc_channel_args_set_stream_compression_algorithm( - NULL, GRPC_STREAM_COMPRESS_GZIP); + nullptr, GRPC_STREAM_COMPRESS_GZIP); grpc_channel_args* server_args = grpc_channel_args_set_stream_compression_algorithm( - NULL, GRPC_STREAM_COMPRESS_GZIP); + nullptr, GRPC_STREAM_COMPRESS_GZIP); grpc_end2end_test_fixture f = begin_test(config, "test_pingpong_streaming", client_args, server_args); grpc_call* c; @@ -123,10 +123,10 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -139,21 +139,21 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -168,14 +168,14 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, 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_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(101), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(101), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); for (i = 0; i < messages; i++) { @@ -187,14 +187,14 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &response_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); memset(ops, 0, sizeof(ops)); @@ -202,9 +202,9 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &request_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); cq_verify(cqv); @@ -214,9 +214,9 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = response_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(103), 1); CQ_EXPECT_COMPLETION(cqv, tag(2), 1); @@ -235,9 +235,9 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, op = ops; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); memset(ops, 0, sizeof(ops)); @@ -248,9 +248,9 @@ static void test_pingpong_streaming(grpc_end2end_test_config config, grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(104), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(104), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(1), 1); diff --git a/test/core/end2end/tests/streaming_error_response.cc b/test/core/end2end/tests/streaming_error_response.cc index f87fd2c4c34c8..d011b6aa36c19 100644 --- a/test/core/end2end/tests/streaming_error_response.cc +++ b/test/core/end2end/tests/streaming_error_response.cc @@ -58,7 +58,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -67,16 +67,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -100,15 +100,15 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { grpc_byte_buffer* response_payload2 = grpc_raw_byte_buffer_create(&response_payload2_slice, 1); grpc_end2end_test_fixture f = begin_test(config, "streaming_error_response", - NULL, NULL, request_status_early); + nullptr, nullptr, request_status_early); cq_verifier* cqv = cq_verifier_create(f.cq); grpc_op ops[6]; grpc_op* op; grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; - grpc_byte_buffer* response_payload1_recv = NULL; - grpc_byte_buffer* response_payload2_recv = NULL; + grpc_byte_buffer* response_payload1_recv = nullptr; + grpc_byte_buffer* response_payload2_recv = nullptr; grpc_call_details call_details; grpc_status_code status; grpc_call_error error; @@ -117,10 +117,10 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -148,7 +148,7 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { op->data.recv_status_on_client.status_details = &details; op++; } - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( @@ -165,7 +165,7 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = response_payload1; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -179,7 +179,7 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = response_payload2; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(103), 1); @@ -190,7 +190,7 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &response_payload2_recv; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(2), 1); @@ -208,7 +208,7 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(104), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(104), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(104), 1); @@ -225,14 +225,14 @@ static void test(grpc_end2end_test_config config, bool request_status_early) { op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(3), 1); cq_verify(cqv); - GPR_ASSERT(response_payload1_recv != NULL); - GPR_ASSERT(response_payload2_recv != NULL); + GPR_ASSERT(response_payload1_recv != nullptr); + GPR_ASSERT(response_payload2_recv != nullptr); } GPR_ASSERT(status == GRPC_STATUS_FAILED_PRECONDITION); diff --git a/test/core/end2end/tests/trailing_metadata.cc b/test/core/end2end/tests/trailing_metadata.cc index 0da02a56db15b..8a6be7a892f90 100644 --- a/test/core/end2end/tests/trailing_metadata.cc +++ b/test/core/end2end/tests/trailing_metadata.cc @@ -53,7 +53,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -62,16 +62,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -100,37 +100,37 @@ static void test_request_response_with_metadata_and_payload( grpc_metadata meta_c[2] = {{grpc_slice_from_static_string("key1"), grpc_slice_from_static_string("val1"), 0, - {{NULL, NULL, NULL, NULL}}}, + {{nullptr, nullptr, nullptr, nullptr}}}, {grpc_slice_from_static_string("key2"), grpc_slice_from_static_string("val2"), 0, - {{NULL, NULL, NULL, NULL}}}}; + {{nullptr, nullptr, nullptr, nullptr}}}}; grpc_metadata meta_s[2] = {{grpc_slice_from_static_string("key3"), grpc_slice_from_static_string("val3"), 0, - {{NULL, NULL, NULL, NULL}}}, + {{nullptr, nullptr, nullptr, nullptr}}}, {grpc_slice_from_static_string("key4"), grpc_slice_from_static_string("val4"), 0, - {{NULL, NULL, NULL, NULL}}}}; + {{nullptr, nullptr, nullptr, nullptr}}}}; grpc_metadata meta_t[2] = {{grpc_slice_from_static_string("key5"), grpc_slice_from_static_string("val5"), 0, - {{NULL, NULL, NULL, NULL}}}, + {{nullptr, nullptr, nullptr, nullptr}}}, {grpc_slice_from_static_string("key6"), grpc_slice_from_static_string("val6"), 0, - {{NULL, NULL, NULL, NULL}}}}; + {{nullptr, nullptr, nullptr, nullptr}}}}; grpc_end2end_test_fixture f = begin_test( - config, "test_request_response_with_metadata_and_payload", NULL, NULL); + config, "test_request_response_with_metadata_and_payload", nullptr, nullptr); cq_verifier* cqv = cq_verifier_create(f.cq); grpc_op ops[6]; grpc_op* op; grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; - grpc_byte_buffer* request_payload_recv = NULL; - grpc_byte_buffer* response_payload_recv = NULL; + grpc_byte_buffer* request_payload_recv = nullptr; + grpc_byte_buffer* response_payload_recv = nullptr; grpc_call_details call_details; grpc_status_code status; grpc_call_error error; @@ -139,10 +139,10 @@ static void test_request_response_with_metadata_and_payload( gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -156,35 +156,35 @@ static void test_request_response_with_metadata_and_payload( op->data.send_initial_metadata.count = 2; op->data.send_initial_metadata.metadata = meta_c; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &response_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -200,14 +200,14 @@ static void test_request_response_with_metadata_and_payload( op->data.send_initial_metadata.count = 2; op->data.send_initial_metadata.metadata = meta_s; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &request_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); @@ -218,12 +218,12 @@ static void test_request_response_with_metadata_and_payload( op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = response_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 2; @@ -232,9 +232,9 @@ static void test_request_response_with_metadata_and_payload( grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(103), 1); diff --git a/test/core/end2end/tests/workaround_cronet_compression.cc b/test/core/end2end/tests/workaround_cronet_compression.cc index 8f8ca16a9e4ad..71d461f469039 100644 --- a/test/core/end2end/tests/workaround_cronet_compression.cc +++ b/test/core/end2end/tests/workaround_cronet_compression.cc @@ -61,7 +61,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -70,16 +70,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -114,7 +114,7 @@ static void request_with_payload_template( grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; - grpc_byte_buffer* request_payload_recv = NULL; + grpc_byte_buffer* request_payload_recv = nullptr; grpc_byte_buffer* response_payload; grpc_byte_buffer* response_payload_recv; grpc_call_details call_details; @@ -137,9 +137,9 @@ static void request_with_payload_template( grpc_slice_from_copied_string(response_str); client_args = grpc_channel_args_set_compression_algorithm( - NULL, default_client_channel_compression_algorithm); + nullptr, default_client_channel_compression_algorithm); server_args = grpc_channel_args_set_compression_algorithm( - NULL, default_server_channel_compression_algorithm); + nullptr, default_server_channel_compression_algorithm); if (user_agent_override) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; @@ -158,10 +158,10 @@ static void request_with_payload_template( gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -172,28 +172,28 @@ static void request_with_payload_template( memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_SEND_INITIAL_METADATA; - if (client_init_metadata != NULL) { + if (client_init_metadata != nullptr) { op->data.send_initial_metadata.count = 1; op->data.send_initial_metadata.metadata = client_init_metadata; } else { 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); error = @@ -222,14 +222,14 @@ static void request_with_payload_template( server_compression_level; } op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(101), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(101), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); for (int i = 0; i < 2; i++) { @@ -241,14 +241,14 @@ static void request_with_payload_template( op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = client_send_flags_bitmask; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &response_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); memset(ops, 0, sizeof(ops)); @@ -256,9 +256,9 @@ static void request_with_payload_template( op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &request_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(102), 1); cq_verify(cqv); @@ -273,9 +273,9 @@ static void request_with_payload_template( op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = response_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(103), 1); CQ_EXPECT_COMPLETION(cqv, tag(2), 1); @@ -306,9 +306,9 @@ static void request_with_payload_template( op = ops; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); memset(ops, 0, sizeof(ops)); @@ -319,9 +319,9 @@ static void request_with_payload_template( grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(104), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(104), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(1), 1); @@ -365,7 +365,7 @@ typedef struct workaround_cronet_compression_config { } workaround_cronet_compression_config; static workaround_cronet_compression_config workaround_configs[] = { - {NULL, GRPC_COMPRESS_GZIP}, + {nullptr, GRPC_COMPRESS_GZIP}, {const_cast( "grpc-objc/1.3.0-dev grpc-c/3.0.0-dev (ios; cronet_http; gentle)"), GRPC_COMPRESS_NONE}, @@ -384,7 +384,7 @@ static void test_workaround_cronet_compression( request_with_payload_template( config, "test_invoke_request_with_compressed_payload", 0, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, GRPC_COMPRESS_GZIP, - workaround_configs[i].expected_algorithm_from_server, NULL, false, + workaround_configs[i].expected_algorithm_from_server, nullptr, false, /* ignored */ GRPC_COMPRESS_LEVEL_NONE, workaround_configs[i].user_agent_override); } diff --git a/test/core/end2end/tests/write_buffering.cc b/test/core/end2end/tests/write_buffering.cc index 5e92e598b3bde..40821dd6f0b24 100644 --- a/test/core/end2end/tests/write_buffering.cc +++ b/test/core/end2end/tests/write_buffering.cc @@ -53,7 +53,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -62,16 +62,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -96,15 +96,15 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { grpc_byte_buffer* request_payload2 = grpc_raw_byte_buffer_create(&request_payload_slice2, 1); grpc_end2end_test_fixture f = - begin_test(config, "test_invoke_request_with_payload", NULL, NULL); + begin_test(config, "test_invoke_request_with_payload", nullptr, nullptr); cq_verifier* cqv = cq_verifier_create(f.cq); grpc_op ops[6]; grpc_op* op; grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; - grpc_byte_buffer* request_payload_recv1 = NULL; - grpc_byte_buffer* request_payload_recv2 = NULL; + grpc_byte_buffer* request_payload_recv1 = nullptr; + grpc_byte_buffer* request_payload_recv2 = nullptr; grpc_call_details call_details; grpc_status_code status; grpc_call_error error; @@ -113,10 +113,10 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -129,7 +129,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); memset(ops, 0, sizeof(ops)); @@ -137,9 +137,9 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( @@ -155,7 +155,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { op->data.send_message.send_message = request_payload1; op->flags = GRPC_WRITE_BUFFER_HINT; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); memset(ops, 0, sizeof(ops)); @@ -163,7 +163,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); /* recv message should not succeed yet - it's buffered at the client still */ @@ -172,7 +172,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &request_payload_recv1; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(2), true); @@ -187,7 +187,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { op->data.send_message.send_message = request_payload2; op->flags = 0; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(4), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(4), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); /* now the first send should match up with the first recv */ @@ -201,7 +201,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &request_payload_recv2; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(104), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(104), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(104), true); @@ -211,23 +211,23 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { op = ops; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(4), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(4), nullptr); memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -235,9 +235,9 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(105), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(105), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(105), 1); diff --git a/test/core/end2end/tests/write_buffering_at_end.cc b/test/core/end2end/tests/write_buffering_at_end.cc index 01dacdfd12dcd..1b9dc9632b736 100644 --- a/test/core/end2end/tests/write_buffering_at_end.cc +++ b/test/core/end2end/tests/write_buffering_at_end.cc @@ -53,7 +53,7 @@ static gpr_timespec five_seconds_from_now(void) { static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { - ev = grpc_completion_queue_next(cq, five_seconds_from_now(), NULL); + ev = grpc_completion_queue_next(cq, five_seconds_from_now(), nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -62,16 +62,16 @@ static void shutdown_server(grpc_end2end_test_fixture* f) { grpc_server_shutdown_and_notify(f->server, f->shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(f->shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_server_destroy(f->server); - f->server = NULL; + f->server = nullptr; } static void shutdown_client(grpc_end2end_test_fixture* f) { if (!f->client) return; grpc_channel_destroy(f->client); - f->client = NULL; + f->client = nullptr; } static void end_test(grpc_end2end_test_fixture* f) { @@ -93,15 +93,15 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { grpc_byte_buffer* request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1); grpc_end2end_test_fixture f = - begin_test(config, "test_invoke_request_with_payload", NULL, NULL); + begin_test(config, "test_invoke_request_with_payload", nullptr, nullptr); cq_verifier* cqv = cq_verifier_create(f.cq); grpc_op ops[6]; grpc_op* op; grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; grpc_metadata_array request_metadata_recv; - grpc_byte_buffer* request_payload_recv1 = NULL; - grpc_byte_buffer* request_payload_recv2 = NULL; + grpc_byte_buffer* request_payload_recv1 = nullptr; + grpc_byte_buffer* request_payload_recv2 = nullptr; grpc_call_details call_details; grpc_status_code status; grpc_call_error error; @@ -110,10 +110,10 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { gpr_timespec deadline = five_seconds_from_now(); c = grpc_channel_create_call( - f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, + f.client, nullptr, GRPC_PROPAGATE_DEFAULTS, f.cq, grpc_slice_from_static_string("/foo"), get_host_override_slice("foo.test.google.fr:1234", config), deadline, - NULL); + nullptr); GPR_ASSERT(c); grpc_metadata_array_init(&initial_metadata_recv); @@ -126,7 +126,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); memset(ops, 0, sizeof(ops)); @@ -134,9 +134,9 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { op->op = GRPC_OP_RECV_INITIAL_METADATA; op->data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); GPR_ASSERT(GRPC_CALL_OK == grpc_server_request_call( @@ -152,7 +152,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { op->data.send_message.send_message = request_payload; op->flags = GRPC_WRITE_BUFFER_HINT; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); memset(ops, 0, sizeof(ops)); @@ -160,7 +160,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { op->op = GRPC_OP_SEND_INITIAL_METADATA; op->data.send_initial_metadata.count = 0; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); /* recv message should not succeed yet - it's buffered at the client still */ @@ -169,7 +169,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &request_payload_recv1; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(2), true); @@ -182,7 +182,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { op = ops; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(4), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(4), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); /* now the first send should match up with the first recv */ @@ -196,7 +196,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &request_payload_recv2; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(104), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(104), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(104), true); @@ -209,16 +209,16 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(4), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(4), nullptr); memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.trailing_metadata_count = 0; @@ -226,9 +226,9 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(105), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(105), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(105), 1); @@ -242,7 +242,7 @@ static void test_invoke_request_with_payload(grpc_end2end_test_config config) { config); GPR_ASSERT(was_cancelled == 0); GPR_ASSERT(byte_buffer_eq_string(request_payload_recv1, "hello world")); - GPR_ASSERT(request_payload_recv2 == NULL); + GPR_ASSERT(request_payload_recv2 == nullptr); grpc_slice_unref(details); grpc_metadata_array_destroy(&initial_metadata_recv); diff --git a/test/core/fling/client.cc b/test/core/fling/client.cc index 64d1dc5089511..544b66d4808c3 100644 --- a/test/core/fling/client.cc +++ b/test/core/fling/client.cc @@ -40,7 +40,7 @@ static grpc_op stream_init_ops[2]; static grpc_op stream_step_ops[2]; static grpc_metadata_array initial_metadata_recv; static grpc_metadata_array trailing_metadata_recv; -static grpc_byte_buffer* response_payload_recv = NULL; +static grpc_byte_buffer* response_payload_recv = nullptr; static grpc_status_code status; static grpc_slice details; static grpc_op* op; @@ -77,16 +77,16 @@ static void step_ping_pong_request(void) { GPR_TIMER_BEGIN("ping_pong", 1); grpc_slice host = grpc_slice_from_static_string("localhost"); call = grpc_channel_create_call( - channel, NULL, GRPC_PROPAGATE_DEFAULTS, cq, + channel, nullptr, GRPC_PROPAGATE_DEFAULTS, cq, grpc_slice_from_static_string("/Reflector/reflectUnary"), &host, - gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call, ops, (size_t)(op - ops), (void*)1, - NULL)); - grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + nullptr)); + grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); grpc_call_unref(call); grpc_byte_buffer_destroy(response_payload_recv); - call = NULL; + call = nullptr; GPR_TIMER_END("ping_pong", 1); } @@ -96,17 +96,17 @@ static void init_ping_pong_stream(void) { grpc_call_error error; grpc_slice host = grpc_slice_from_static_string("localhost"); call = grpc_channel_create_call( - channel, NULL, GRPC_PROPAGATE_DEFAULTS, cq, + channel, nullptr, GRPC_PROPAGATE_DEFAULTS, cq, grpc_slice_from_static_string("/Reflector/reflectStream"), &host, - gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); stream_init_ops[0].op = GRPC_OP_SEND_INITIAL_METADATA; stream_init_ops[0].data.send_initial_metadata.count = 0; stream_init_ops[1].op = GRPC_OP_RECV_INITIAL_METADATA; stream_init_ops[1].data.recv_initial_metadata.recv_initial_metadata = &initial_metadata_recv; - error = grpc_call_start_batch(call, stream_init_ops, 2, (void*)1, NULL); + error = grpc_call_start_batch(call, stream_init_ops, 2, (void*)1, nullptr); GPR_ASSERT(GRPC_CALL_OK == error); - grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); grpc_metadata_array_init(&initial_metadata_recv); @@ -119,9 +119,9 @@ static void init_ping_pong_stream(void) { static void step_ping_pong_stream(void) { grpc_call_error error; GPR_TIMER_BEGIN("ping_pong", 1); - error = grpc_call_start_batch(call, stream_step_ops, 2, (void*)1, NULL); + error = grpc_call_start_batch(call, stream_step_ops, 2, (void*)1, nullptr); GPR_ASSERT(GRPC_CALL_OK == error); - grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); grpc_byte_buffer_destroy(response_payload_recv); GPR_TIMER_END("ping_pong", 1); } @@ -155,7 +155,7 @@ int main(int argc, char** argv) { gpr_cmdline* cl; grpc_event event; const char* scenario_name = "ping-pong-request"; - scenario sc = {NULL, NULL, NULL}; + scenario sc = {nullptr, nullptr, nullptr}; gpr_timers_set_log_filename("latency_trace.fling_client.txt"); @@ -192,8 +192,8 @@ int main(int argc, char** argv) { return 1; } - channel = grpc_insecure_channel_create(target, NULL, NULL); - cq = grpc_completion_queue_create_for_next(NULL); + channel = grpc_insecure_channel_create(target, nullptr, nullptr); + cq = grpc_completion_queue_create_for_next(nullptr); the_buffer = grpc_raw_byte_buffer_create(&slice, (size_t)payload_size); histogram = gpr_histogram_create(0.01, 60e9); @@ -225,7 +225,7 @@ int main(int argc, char** argv) { grpc_completion_queue_shutdown(cq); do { event = grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), - NULL); + nullptr); } while (event.type != GRPC_QUEUE_SHUTDOWN); grpc_completion_queue_destroy(cq); grpc_byte_buffer_destroy(the_buffer); diff --git a/test/core/fling/fling_stream_test.cc b/test/core/fling/fling_stream_test.cc index 620427e12ae87..b476f2e128e1d 100644 --- a/test/core/fling/fling_stream_test.cc +++ b/test/core/fling/fling_stream_test.cc @@ -58,7 +58,7 @@ int main(int argc, char** argv) { gpr_join_host_port(&args[2], "127.0.0.1", port); args[3] = const_cast("--scenario=ping-pong-stream"); args[4] = const_cast("--no-secure"); - args[5] = 0; + args[5] = nullptr; cli = gpr_subprocess_create(6, (const char**)args); gpr_free(args[0]); gpr_free(args[2]); diff --git a/test/core/fling/fling_test.cc b/test/core/fling/fling_test.cc index 1d4263ab0158d..0e8b3c102823b 100644 --- a/test/core/fling/fling_test.cc +++ b/test/core/fling/fling_test.cc @@ -58,7 +58,7 @@ int main(int argc, const char** argv) { gpr_join_host_port(&args[2], "127.0.0.1", port); args[3] = const_cast("--scenario=ping-pong-request"); args[4] = const_cast("--no-secure"); - args[5] = 0; + args[5] = nullptr; cli = gpr_subprocess_create(6, (const char**)args); gpr_free(args[0]); gpr_free(args[2]); diff --git a/test/core/fling/server.cc b/test/core/fling/server.cc index 4dfb30f1071c5..dfe96136fb69b 100644 --- a/test/core/fling/server.cc +++ b/test/core/fling/server.cc @@ -46,9 +46,9 @@ static grpc_call* call; static grpc_call_details call_details; static grpc_metadata_array request_metadata_recv; static grpc_metadata_array initial_metadata_send; -static grpc_byte_buffer* payload_buffer = NULL; +static grpc_byte_buffer* payload_buffer = nullptr; /* Used to drain the terminal read in unary calls. */ -static grpc_byte_buffer* terminal_buffer = NULL; +static grpc_byte_buffer* terminal_buffer = nullptr; static grpc_op read_op; static grpc_op metadata_send_op; @@ -97,7 +97,7 @@ static void handle_unary_method(void) { op->data.recv_message.recv_message = &terminal_buffer; op++; op->op = GRPC_OP_SEND_MESSAGE; - if (payload_buffer == NULL) { + if (payload_buffer == nullptr) { gpr_log(GPR_INFO, "NULL payload buffer !!!"); } op->data.send_message.send_message = payload_buffer; @@ -105,14 +105,14 @@ static void handle_unary_method(void) { op->op = GRPC_OP_SEND_STATUS_FROM_SERVER; op->data.send_status_from_server.status = GRPC_STATUS_OK; op->data.send_status_from_server.trailing_metadata_count = 0; - op->data.send_status_from_server.status_details = NULL; + op->data.send_status_from_server.status_details = nullptr; op++; op->op = GRPC_OP_RECV_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op++; error = grpc_call_start_batch(call, unary_ops, (size_t)(op - unary_ops), - tag(FLING_SERVER_BATCH_OPS_FOR_UNARY), NULL); + tag(FLING_SERVER_BATCH_OPS_FOR_UNARY), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); } @@ -122,7 +122,7 @@ static void send_initial_metadata(void) { grpc_metadata_array_init(&initial_metadata_send); metadata_send_op.op = GRPC_OP_SEND_INITIAL_METADATA; metadata_send_op.data.send_initial_metadata.count = 0; - error = grpc_call_start_batch(call, &metadata_send_op, 1, tagarg, NULL); + error = grpc_call_start_batch(call, &metadata_send_op, 1, tagarg, nullptr); GPR_ASSERT(GRPC_CALL_OK == error); } @@ -132,7 +132,7 @@ static void start_read_op(int t) { /* Starting read at server */ read_op.op = GRPC_OP_RECV_MESSAGE; read_op.data.recv_message.recv_message = &payload_buffer; - error = grpc_call_start_batch(call, &read_op, 1, tag(t), NULL); + error = grpc_call_start_batch(call, &read_op, 1, tag(t), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); } @@ -141,11 +141,11 @@ static void start_write_op(void) { void* tagarg = tag(FLING_SERVER_WRITE_FOR_STREAMING); /* Starting write at server */ write_op.op = GRPC_OP_SEND_MESSAGE; - if (payload_buffer == NULL) { + if (payload_buffer == nullptr) { gpr_log(GPR_INFO, "NULL payload buffer !!!"); } write_op.data.send_message.send_message = payload_buffer; - error = grpc_call_start_batch(call, &write_op, 1, tagarg, NULL); + error = grpc_call_start_batch(call, &write_op, 1, tagarg, nullptr); GPR_ASSERT(GRPC_CALL_OK == error); } @@ -155,11 +155,11 @@ static void start_send_status(void) { status_op[0].op = GRPC_OP_SEND_STATUS_FROM_SERVER; status_op[0].data.send_status_from_server.status = GRPC_STATUS_OK; status_op[0].data.send_status_from_server.trailing_metadata_count = 0; - status_op[0].data.send_status_from_server.status_details = NULL; + status_op[0].data.send_status_from_server.status_details = nullptr; status_op[1].op = GRPC_OP_RECV_CLOSE_ON_SERVER; status_op[1].data.recv_close_on_server.cancelled = &was_cancelled; - error = grpc_call_start_batch(call, status_op, 2, tagarg, NULL); + error = grpc_call_start_batch(call, status_op, 2, tagarg, nullptr); GPR_ASSERT(GRPC_CALL_OK == error); } @@ -170,14 +170,14 @@ static void sigint_handler(int x) { _exit(0); } int main(int argc, char** argv) { grpc_event ev; call_state* s; - char* addr_buf = NULL; + char* addr_buf = nullptr; gpr_cmdline* cl; grpc_completion_queue* shutdown_cq; int shutdown_started = 0; int shutdown_finished = 0; int secure = 0; - const char* addr = NULL; + const char* addr = nullptr; char* fake_argv[1]; @@ -196,30 +196,30 @@ int main(int argc, char** argv) { gpr_cmdline_parse(cl, argc, argv); gpr_cmdline_destroy(cl); - if (addr == NULL) { + if (addr == nullptr) { gpr_join_host_port(&addr_buf, "::", grpc_pick_unused_port_or_die()); addr = addr_buf; } gpr_log(GPR_INFO, "creating server on: %s", addr); - cq = grpc_completion_queue_create_for_next(NULL); + cq = grpc_completion_queue_create_for_next(nullptr); if (secure) { grpc_ssl_pem_key_cert_pair pem_key_cert_pair = {test_server1_key, test_server1_cert}; grpc_server_credentials* ssl_creds = grpc_ssl_server_credentials_create( - NULL, &pem_key_cert_pair, 1, 0, NULL); - server = grpc_server_create(NULL, NULL); + nullptr, &pem_key_cert_pair, 1, 0, nullptr); + server = grpc_server_create(nullptr, nullptr); GPR_ASSERT(grpc_server_add_secure_http2_port(server, addr, ssl_creds)); grpc_server_credentials_release(ssl_creds); } else { - server = grpc_server_create(NULL, NULL); + server = grpc_server_create(nullptr, nullptr); GPR_ASSERT(grpc_server_add_insecure_http2_port(server, addr)); } - grpc_server_register_completion_queue(server, cq, NULL); + grpc_server_register_completion_queue(server, cq, nullptr); grpc_server_start(server); gpr_free(addr_buf); - addr = addr_buf = NULL; + addr = addr_buf = nullptr; grpc_call_details_init(&call_details); @@ -231,12 +231,12 @@ int main(int argc, char** argv) { if (got_sigint && !shutdown_started) { gpr_log(GPR_INFO, "Shutting down due to SIGINT"); - shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); + shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr); grpc_server_shutdown_and_notify(server, shutdown_cq, tag(1000)); GPR_ASSERT( grpc_completion_queue_pluck(shutdown_cq, tag(1000), - grpc_timeout_seconds_to_deadline(5), NULL) + grpc_timeout_seconds_to_deadline(5), nullptr) .type == GRPC_OP_COMPLETE); grpc_completion_queue_destroy(shutdown_cq); @@ -247,13 +247,13 @@ int main(int argc, char** argv) { cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_micros(1000000, GPR_TIMESPAN)), - NULL); + nullptr); s = static_cast(ev.tag); switch (ev.type) { case GRPC_OP_COMPLETE: switch ((intptr_t)s) { case FLING_SERVER_NEW_REQUEST: - if (call != NULL) { + if (call != nullptr) { if (0 == grpc_slice_str_cmp(call_details.method, "/Reflector/reflectStream")) { /* Received streaming call. Send metadata here. */ @@ -270,7 +270,7 @@ int main(int argc, char** argv) { */ break; case FLING_SERVER_READ_FOR_STREAMING: - if (payload_buffer != NULL) { + if (payload_buffer != nullptr) { /* Received payload from client. */ start_write_op(); } else { @@ -281,7 +281,7 @@ int main(int argc, char** argv) { case FLING_SERVER_WRITE_FOR_STREAMING: /* Write completed at server */ grpc_byte_buffer_destroy(payload_buffer); - payload_buffer = NULL; + payload_buffer = nullptr; start_read_op(FLING_SERVER_READ_FOR_STREAMING); break; case FLING_SERVER_SEND_INIT_METADATA_FOR_STREAMING: @@ -301,7 +301,7 @@ int main(int argc, char** argv) { case FLING_SERVER_BATCH_OPS_FOR_UNARY: /* Finished unary call. */ grpc_byte_buffer_destroy(payload_buffer); - payload_buffer = NULL; + payload_buffer = nullptr; grpc_call_unref(call); if (!shutdown_started) request_call(); break; diff --git a/test/core/handshake/client_ssl.cc b/test/core/handshake/client_ssl.cc index b8cfd627a9818..2b149a73b3340 100644 --- a/test/core/handshake/client_ssl.cc +++ b/test/core/handshake/client_ssl.cc @@ -246,7 +246,7 @@ static bool client_ssl_test(char* server_alpn_preferred) { pem_key_cert_pair.private_key = (const char*)GRPC_SLICE_START_PTR(key_slice); pem_key_cert_pair.cert_chain = (const char*)GRPC_SLICE_START_PTR(cert_slice); grpc_channel_credentials* ssl_creds = - grpc_ssl_credentials_create(ca_cert, &pem_key_cert_pair, NULL); + grpc_ssl_credentials_create(ca_cert, &pem_key_cert_pair, nullptr); // Establish a channel pointing at the TLS server. Since the gRPC runtime is // lazy, this won't necessarily establish a connection yet. @@ -260,7 +260,7 @@ static bool client_ssl_test(char* server_alpn_preferred) { grpc_args.num_args = 1; grpc_args.args = &ssl_name_override; grpc_channel* channel = - grpc_secure_channel_create(ssl_creds, target, &grpc_args, NULL); + grpc_secure_channel_create(ssl_creds, target, &grpc_args, nullptr); GPR_ASSERT(channel); gpr_free(target); @@ -274,13 +274,13 @@ static bool client_ssl_test(char* server_alpn_preferred) { // completed and we know that the client's ALPN list satisfied the server. int retries = 10; grpc_connectivity_state state = GRPC_CHANNEL_IDLE; - grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL); + grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr); while (state != GRPC_CHANNEL_READY && retries-- > 0) { grpc_channel_watch_connectivity_state( - channel, state, grpc_timeout_seconds_to_deadline(3), cq, NULL); + channel, state, grpc_timeout_seconds_to_deadline(3), cq, nullptr); gpr_timespec cq_deadline = grpc_timeout_seconds_to_deadline(5); - grpc_event ev = grpc_completion_queue_next(cq, cq_deadline, NULL); + grpc_event ev = grpc_completion_queue_next(cq, cq_deadline, nullptr); GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); state = grpc_channel_check_connectivity_state(channel, 0 /* try_to_connect */); diff --git a/test/core/handshake/server_ssl.cc b/test/core/handshake/server_ssl.cc index bb92c8435a842..69c4fdc11b681 100644 --- a/test/core/handshake/server_ssl.cc +++ b/test/core/handshake/server_ssl.cc @@ -80,18 +80,18 @@ static void server_thread(void* arg) { pem_key_cert_pair.private_key = (const char*)GRPC_SLICE_START_PTR(key_slice); pem_key_cert_pair.cert_chain = (const char*)GRPC_SLICE_START_PTR(cert_slice); grpc_server_credentials* ssl_creds = grpc_ssl_server_credentials_create( - ca_cert, &pem_key_cert_pair, 1, 0, NULL); + ca_cert, &pem_key_cert_pair, 1, 0, nullptr); // Start server listening on local port. char* addr; gpr_asprintf(&addr, "127.0.0.1:%d", port); - grpc_server* server = grpc_server_create(NULL, NULL); + grpc_server* server = grpc_server_create(nullptr, nullptr); GPR_ASSERT(grpc_server_add_secure_http2_port(server, addr, ssl_creds)); free(addr); - grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL); + grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr); - grpc_server_register_completion_queue(server, cq, NULL); + grpc_server_register_completion_queue(server, cq, nullptr); grpc_server_start(server); // Wait a bounded number of time until client_handshake_complete is set, @@ -99,16 +99,16 @@ static void server_thread(void* arg) { int retries = 10; while (!gpr_event_get(&client_handshake_complete) && retries-- > 0) { const gpr_timespec cq_deadline = grpc_timeout_seconds_to_deadline(1); - grpc_event ev = grpc_completion_queue_next(cq, cq_deadline, NULL); + grpc_event ev = grpc_completion_queue_next(cq, cq_deadline, nullptr); GPR_ASSERT(ev.type == GRPC_QUEUE_TIMEOUT); } gpr_log(GPR_INFO, "Shutting down server"); - grpc_server_shutdown_and_notify(server, cq, NULL); + grpc_server_shutdown_and_notify(server, cq, nullptr); grpc_completion_queue_shutdown(cq); const gpr_timespec cq_deadline = grpc_timeout_seconds_to_deadline(5); - grpc_event ev = grpc_completion_queue_next(cq, cq_deadline, NULL); + grpc_event ev = grpc_completion_queue_next(cq, cq_deadline, nullptr); GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); grpc_server_destroy(server); diff --git a/test/core/http/format_request_test.cc b/test/core/http/format_request_test.cc index 253e59135d721..684738a9973b2 100644 --- a/test/core/http/format_request_test.cc +++ b/test/core/http/format_request_test.cc @@ -89,7 +89,7 @@ static void test_format_post_request_no_body(void) { req.http.hdr_count = 1; req.http.hdrs = &hdr; - slice = grpc_httpcli_format_post_request(&req, NULL, 0); + slice = grpc_httpcli_format_post_request(&req, nullptr, 0); GPR_ASSERT(0 == grpc_slice_str_cmp(slice, "POST /index.html HTTP/1.0\r\n" diff --git a/test/core/http/httpcli_test.cc b/test/core/http/httpcli_test.cc index ac3c6a2ce5f0f..b9e3051dcd068 100644 --- a/test/core/http/httpcli_test.cc +++ b/test/core/http/httpcli_test.cc @@ -53,7 +53,7 @@ static void on_finish(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) { g_done = 1; GPR_ASSERT(GRPC_LOG_IF_ERROR( "pollset_kick", - grpc_pollset_kick(exec_ctx, grpc_polling_entity_pollset(&g_pops), NULL))); + grpc_pollset_kick(exec_ctx, grpc_polling_entity_pollset(&g_pops), nullptr))); gpr_mu_unlock(g_mu); } @@ -83,7 +83,7 @@ static void test_get(int port) { grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); gpr_mu_lock(g_mu); while (!g_done) { - grpc_pollset_worker* worker = NULL; + grpc_pollset_worker* worker = nullptr; GPR_ASSERT(GRPC_LOG_IF_ERROR( "pollset_work", grpc_pollset_work(&exec_ctx, grpc_polling_entity_pollset(&g_pops), @@ -124,7 +124,7 @@ static void test_post(int port) { grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); gpr_mu_lock(g_mu); while (!g_done) { - grpc_pollset_worker* worker = NULL; + grpc_pollset_worker* worker = nullptr; GPR_ASSERT(GRPC_LOG_IF_ERROR( "pollset_work", grpc_pollset_work(&exec_ctx, grpc_polling_entity_pollset(&g_pops), diff --git a/test/core/http/httpscli_test.cc b/test/core/http/httpscli_test.cc index bf851b1175218..cac0ed5ce70a3 100644 --- a/test/core/http/httpscli_test.cc +++ b/test/core/http/httpscli_test.cc @@ -53,7 +53,7 @@ static void on_finish(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) { g_done = 1; GPR_ASSERT(GRPC_LOG_IF_ERROR( "pollset_kick", - grpc_pollset_kick(exec_ctx, grpc_polling_entity_pollset(&g_pops), NULL))); + grpc_pollset_kick(exec_ctx, grpc_polling_entity_pollset(&g_pops), nullptr))); gpr_mu_unlock(g_mu); } @@ -84,7 +84,7 @@ static void test_get(int port) { grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); gpr_mu_lock(g_mu); while (!g_done) { - grpc_pollset_worker* worker = NULL; + grpc_pollset_worker* worker = nullptr; GPR_ASSERT(GRPC_LOG_IF_ERROR( "pollset_work", grpc_pollset_work(&exec_ctx, grpc_polling_entity_pollset(&g_pops), @@ -126,7 +126,7 @@ static void test_post(int port) { grpc_resource_quota_unref_internal(&exec_ctx, resource_quota); gpr_mu_lock(g_mu); while (!g_done) { - grpc_pollset_worker* worker = NULL; + grpc_pollset_worker* worker = nullptr; GPR_ASSERT(GRPC_LOG_IF_ERROR( "pollset_work", grpc_pollset_work(&exec_ctx, grpc_polling_entity_pollset(&g_pops), diff --git a/test/core/http/parser_test.cc b/test/core/http/parser_test.cc index d0d2559cdf41f..0b60e369b7974 100644 --- a/test/core/http/parser_test.cc +++ b/test/core/http/parser_test.cc @@ -49,7 +49,7 @@ static void test_request_succeeds(grpc_slice_split_mode split_mode, grpc_http_parser_init(&parser, GRPC_HTTP_REQUEST, &request); for (i = 0; i < num_slices; i++) { - GPR_ASSERT(grpc_http_parser_parse(&parser, slices[i], NULL) == + GPR_ASSERT(grpc_http_parser_parse(&parser, slices[i], nullptr) == GRPC_ERROR_NONE); grpc_slice_unref(slices[i]); } @@ -60,7 +60,7 @@ static void test_request_succeeds(grpc_slice_split_mode split_mode, GPR_ASSERT(0 == strcmp(expect_path, request.path)); GPR_ASSERT(expect_version == request.version); - if (expect_body != NULL) { + if (expect_body != nullptr) { GPR_ASSERT(strlen(expect_body) == request.body_length); GPR_ASSERT(0 == memcmp(expect_body, request.body, request.body_length)); } else { @@ -107,7 +107,7 @@ static void test_succeeds(grpc_slice_split_mode split_mode, grpc_http_parser_init(&parser, GRPC_HTTP_RESPONSE, &response); for (i = 0; i < num_slices; i++) { - GPR_ASSERT(grpc_http_parser_parse(&parser, slices[i], NULL) == + GPR_ASSERT(grpc_http_parser_parse(&parser, slices[i], nullptr) == GRPC_ERROR_NONE); grpc_slice_unref(slices[i]); } @@ -115,7 +115,7 @@ static void test_succeeds(grpc_slice_split_mode split_mode, GPR_ASSERT(GRPC_HTTP_RESPONSE == parser.type); GPR_ASSERT(expect_status == response.status); - if (expect_body != NULL) { + if (expect_body != nullptr) { GPR_ASSERT(strlen(expect_body) == response.body_length); GPR_ASSERT(0 == memcmp(expect_body, response.body, response.body_length)); } else { @@ -162,7 +162,7 @@ static void test_fails(grpc_slice_split_mode split_mode, for (i = 0; i < num_slices; i++) { if (GRPC_ERROR_NONE == error) { - error = grpc_http_parser_parse(&parser, slices[i], NULL); + error = grpc_http_parser_parse(&parser, slices[i], nullptr); } grpc_slice_unref(slices[i]); } @@ -195,7 +195,7 @@ static void test_request_fails(grpc_slice_split_mode split_mode, for (i = 0; i < num_slices; i++) { if (error == GRPC_ERROR_NONE) { - error = grpc_http_parser_parse(&parser, slices[i], NULL); + error = grpc_http_parser_parse(&parser, slices[i], nullptr); } grpc_slice_unref(slices[i]); } @@ -228,7 +228,7 @@ int main(int argc, char** argv) { test_succeeds(split_modes[i], "HTTP/1.0 404 Not Found\r\n" "\r\n", - 404, NULL, NULL); + 404, nullptr, NULL); test_succeeds(split_modes[i], "HTTP/1.1 200 OK\r\n" "xyz: abc\r\n" @@ -243,7 +243,7 @@ int main(int argc, char** argv) { test_request_succeeds(split_modes[i], "GET / HTTP/1.0\r\n" "\r\n", - "GET", GRPC_HTTP_HTTP10, "/", NULL, NULL); + "GET", GRPC_HTTP_HTTP10, "/", nullptr, NULL); test_request_succeeds(split_modes[i], "GET / HTTP/1.0\r\n" "\r\n" diff --git a/test/core/http/request_fuzzer.cc b/test/core/http/request_fuzzer.cc index dfdb5792accf6..368ac1b49dbb7 100644 --- a/test/core/http/request_fuzzer.cc +++ b/test/core/http/request_fuzzer.cc @@ -33,7 +33,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { memset(&request, 0, sizeof(request)); grpc_http_parser_init(&parser, GRPC_HTTP_REQUEST, &request); grpc_slice slice = grpc_slice_from_copied_buffer((const char*)data, size); - GRPC_ERROR_UNREF(grpc_http_parser_parse(&parser, slice, NULL)); + GRPC_ERROR_UNREF(grpc_http_parser_parse(&parser, slice, nullptr)); GRPC_ERROR_UNREF(grpc_http_parser_eof(&parser)); grpc_slice_unref(slice); grpc_http_parser_destroy(&parser); diff --git a/test/core/http/response_fuzzer.cc b/test/core/http/response_fuzzer.cc index 89ee676b498b5..2a793fddd4b6a 100644 --- a/test/core/http/response_fuzzer.cc +++ b/test/core/http/response_fuzzer.cc @@ -32,7 +32,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { memset(&response, 0, sizeof(response)); grpc_http_parser_init(&parser, GRPC_HTTP_RESPONSE, &response); grpc_slice slice = grpc_slice_from_copied_buffer((const char*)data, size); - GRPC_ERROR_UNREF(grpc_http_parser_parse(&parser, slice, NULL)); + GRPC_ERROR_UNREF(grpc_http_parser_parse(&parser, slice, nullptr)); GRPC_ERROR_UNREF(grpc_http_parser_eof(&parser)); grpc_slice_unref(slice); grpc_http_parser_destroy(&parser); diff --git a/test/core/iomgr/combiner_test.cc b/test/core/iomgr/combiner_test.cc index 5a825368f7556..146a6bd5530a4 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 8e859ba909538..83aa23a60f0b4 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", @@ -259,7 +259,7 @@ static void inc_on_failure(grpc_exec_ctx* exec_ctx, void* arg, 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))); + 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 3ee607d97ea98..ac8b2f43d1647 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 b76c247fb82fd..f46430c611635 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 c70187ce91552..240588bf52386 100644 --- a/test/core/iomgr/fd_posix_test.cc +++ b/test/core/iomgr/fd_posix_test.cc @@ -115,7 +115,7 @@ static void session_shutdown_cb(grpc_exec_ctx* exec_ctx, void* arg, /*session */ bool success) { session* se = static_cast(arg); server* sv = se->sv; - grpc_fd_orphan(exec_ctx, se->em_fd, NULL, NULL, false /* already_closed */, + grpc_fd_orphan(exec_ctx, se->em_fd, nullptr, nullptr, false /* already_closed */, "a"); gpr_free(se); /* Start to shutdown listen fd. */ @@ -173,13 +173,13 @@ static void listen_shutdown_cb(grpc_exec_ctx* exec_ctx, void* arg /*server */, int success) { server* sv = static_cast(arg); - grpc_fd_orphan(exec_ctx, sv->em_fd, NULL, NULL, false /* already_closed */, + 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))); + 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(arg); - grpc_fd_orphan(exec_ctx, cl->em_fd, NULL, NULL, false /* already_closed */, + 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))); + 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) {} @@ -414,7 +414,7 @@ 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))); + grpc_pollset_kick(exec_ctx, g_pollset, nullptr))); gpr_mu_unlock(g_mu); } @@ -426,7 +426,7 @@ 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))); + 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,7 @@ 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 2c9e7c33f4f39..9f360badcc301 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 8d0198cace62c..719eab91fefe3 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 ba89fc8ad5896..1a5eb9ace14d6 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(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(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 0aa3e5f0f07f4..1c5aa38a95d57 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(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 8a2faaed02f1a..a0ce4018dcbc9 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,10 @@ 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 +213,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 +228,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 +254,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 +263,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 +296,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 +315,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 +343,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 +362,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 +390,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 +409,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 +443,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 +473,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 +487,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 +499,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 +514,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 +536,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 +550,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 +562,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 +577,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 +591,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 +630,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; @@ -639,10 +639,10 @@ test_resource_user_stays_allocated_and_reclaimers_unrun_until_memory_released( 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); 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 +650,14 @@ 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 +676,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 +689,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; @@ -698,9 +698,9 @@ 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); 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 40f2157ba3ea5..a44571485131e 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 206fa5de01a6f..c87c146c34db1 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)); @@ -55,25 +55,25 @@ static void finish_connection() { 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))); + 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,8 +107,8 @@ 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, + 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 */ @@ -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, + 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 51ab0bfc6a67a..98b3d1594da50 100644 --- a/test/core/iomgr/tcp_posix_test.cc +++ b/test/core/iomgr/tcp_posix_test.cc @@ -148,7 +148,7 @@ static void read_cb(grpc_exec_ctx* exec_ctx, void* user_data, 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))); + 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))); @@ -298,7 +298,7 @@ static void write_done(grpc_exec_ctx* exec_ctx, 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))); + 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; } @@ -409,7 +409,7 @@ 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))); + 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 6efa74c706ccc..2651d29f99885 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(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))); @@ -160,7 +160,7 @@ static void on_connect(grpc_exec_ctx* exec_ctx, void* arg, grpc_endpoint* tcp, g_result = temp_result; g_nconnects++; GPR_ASSERT(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); } @@ -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 ? "" : "::", test_dst_addrs); + (unsigned long)(channel_args != nullptr ? channel_args->num_args : 0), + dst_addrs != nullptr ? "" : "::", 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(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 20a383371da33..f0ab4343cb1c1 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 8783c5c6d7954..dc965ef7dcf54 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 4e8f234a8b4f6..08871695a73a7 100644 --- a/test/core/iomgr/udp_server_test.cc +++ b/test/core/iomgr/udp_server_test.cc @@ -62,7 +62,7 @@ static void on_read(grpc_exec_ctx* exec_ctx, grpc_fd* emfd, void* user_data) { g_number_of_bytes_read += (int)byte_count; GPR_ASSERT(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); } @@ -71,7 +71,7 @@ static void on_write(grpc_exec_ctx* exec_ctx, grpc_fd* emfd, void* user_data) { g_number_of_writes++; GPR_ASSERT(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); } @@ -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 * diff --git a/test/core/json/json_rewrite.cc b/test/core/json/json_rewrite.cc index 98e76e9772564..6891a57f9f0c8 100644 --- a/test/core/json/json_rewrite.cc +++ b/test/core/json/json_rewrite.cc @@ -205,8 +205,8 @@ int rewrite(FILE* in, FILE* out, int indent) { reader_user.writer = &writer; reader_user.in = in; - reader_user.top = NULL; - reader_user.scratchpad = NULL; + reader_user.top = nullptr; + reader_user.scratchpad = nullptr; reader_user.string_len = 0; reader_user.free_space = 0; reader_user.allocated = 0; @@ -232,8 +232,8 @@ int main(int argc, char** argv) { int indent = 2; gpr_cmdline* cl; - cl = gpr_cmdline_create(NULL); - gpr_cmdline_add_int(cl, "indent", NULL, &indent); + cl = gpr_cmdline_create(nullptr); + gpr_cmdline_add_int(cl, "indent", nullptr, &indent); gpr_cmdline_parse(cl, argc, argv); gpr_cmdline_destroy(cl); diff --git a/test/core/json/json_rewrite_test.cc b/test/core/json/json_rewrite_test.cc index 47b4f01e8b4d7..3104afc442a99 100644 --- a/test/core/json/json_rewrite_test.cc +++ b/test/core/json/json_rewrite_test.cc @@ -226,8 +226,8 @@ int rewrite_and_compare(FILE* in, FILE* cmp, int indent) { reader_user.writer = &writer; reader_user.in = in; - reader_user.top = NULL; - reader_user.scratchpad = NULL; + reader_user.top = nullptr; + reader_user.scratchpad = nullptr; reader_user.string_len = 0; reader_user.free_space = 0; reader_user.allocated = 0; diff --git a/test/core/json/json_stream_error_test.cc b/test/core/json/json_stream_error_test.cc index 975ccd2b426e3..70b00c77f9e34 100644 --- a/test/core/json/json_stream_error_test.cc +++ b/test/core/json/json_stream_error_test.cc @@ -37,13 +37,13 @@ static void string_clear(void* userdata) { static uint32_t read_char(void* userdata) { return GRPC_JSON_READ_CHAR_ERROR; } static grpc_json_reader_vtable reader_vtable = { - string_clear, NULL, NULL, read_char, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL}; + string_clear, nullptr, nullptr, read_char, nullptr, nullptr, + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}; static void read_error() { grpc_json_reader reader; grpc_json_reader_status status; - grpc_json_reader_init(&reader, &reader_vtable, NULL); + grpc_json_reader_init(&reader, &reader_vtable, nullptr); status = grpc_json_reader_run(&reader); GPR_ASSERT(status == GRPC_JSON_READ_ERROR); diff --git a/test/core/json/json_test.cc b/test/core/json/json_test.cc index 9e4d351dd7aea..18b9c55ee79d5 100644 --- a/test/core/json/json_test.cc +++ b/test/core/json/json_test.cc @@ -70,70 +70,70 @@ static testing_pair testing_pairs[] = { /* Testing invalid parsing. */ /* Testing plain invalid things, exercising the state machine. */ - {"\\", NULL}, - {"nu ll", NULL}, - {"{\"foo\": bar}", NULL}, - {"{\"foo\": bar\"x\"}", NULL}, - {"fals", NULL}, - {"0,0 ", NULL}, - {"\"foo\",[]", NULL}, + {"\\", nullptr}, + {"nu ll", nullptr}, + {"{\"foo\": bar}", nullptr}, + {"{\"foo\": bar\"x\"}", nullptr}, + {"fals", nullptr}, + {"0,0 ", nullptr}, + {"\"foo\",[]", nullptr}, /* Testing unterminated string. */ - {"\"\\x", NULL}, + {"\"\\x", nullptr}, /* Testing invalid UTF-16 number. */ - {"\"\\u123x", NULL}, - {"{\"\\u123x", NULL}, + {"\"\\u123x", nullptr}, + {"{\"\\u123x", nullptr}, /* Testing imbalanced surrogate pairs. */ - {"\"\\ud834f", NULL}, - {"{\"\\ud834f\":0}", NULL}, - {"\"\\ud834\\n", NULL}, - {"{\"\\ud834\\n\":0}", NULL}, - {"\"\\udd1ef", NULL}, - {"{\"\\udd1ef\":0}", NULL}, - {"\"\\ud834\\ud834\"", NULL}, - {"{\"\\ud834\\ud834\"\":0}", NULL}, - {"\"\\ud834\\u1234\"", NULL}, - {"{\"\\ud834\\u1234\"\":0}", NULL}, - {"\"\\ud834]\"", NULL}, - {"{\"\\ud834]\"\":0}", NULL}, - {"\"\\ud834 \"", NULL}, - {"{\"\\ud834 \"\":0}", NULL}, - {"\"\\ud834\\\\\"", NULL}, - {"{\"\\ud834\\\\\"\":0}", NULL}, + {"\"\\ud834f", nullptr}, + {"{\"\\ud834f\":0}", nullptr}, + {"\"\\ud834\\n", nullptr}, + {"{\"\\ud834\\n\":0}", nullptr}, + {"\"\\udd1ef", nullptr}, + {"{\"\\udd1ef\":0}", nullptr}, + {"\"\\ud834\\ud834\"", nullptr}, + {"{\"\\ud834\\ud834\"\":0}", nullptr}, + {"\"\\ud834\\u1234\"", nullptr}, + {"{\"\\ud834\\u1234\"\":0}", nullptr}, + {"\"\\ud834]\"", nullptr}, + {"{\"\\ud834]\"\":0}", nullptr}, + {"\"\\ud834 \"", nullptr}, + {"{\"\\ud834 \"\":0}", nullptr}, + {"\"\\ud834\\\\\"", nullptr}, + {"{\"\\ud834\\\\\"\":0}", nullptr}, /* Testing embedded invalid whitechars. */ - {"\"\n\"", NULL}, - {"\"\t\"", NULL}, + {"\"\n\"", nullptr}, + {"\"\t\"", nullptr}, /* Testing empty json data. */ - {"", NULL}, + {"", nullptr}, /* Testing extra characters after end of parsing. */ - {"{},", NULL}, + {"{},", nullptr}, /* Testing imbalanced containers. */ - {"{}}", NULL}, - {"[]]", NULL}, - {"{{}", NULL}, - {"[[]", NULL}, - {"[}", NULL}, - {"{]", NULL}, + {"{}}", nullptr}, + {"[]]", nullptr}, + {"{{}", nullptr}, + {"[[]", nullptr}, + {"[}", nullptr}, + {"{]", nullptr}, /* Testing bad containers. */ - {"{x}", NULL}, - {"{x=0,y}", NULL}, + {"{x}", nullptr}, + {"{x=0,y}", nullptr}, /* Testing trailing comma. */ - {"{,}", NULL}, - {"[1,2,3,4,]", NULL}, - {"{\"a\": 1, }", NULL}, + {"{,}", nullptr}, + {"[1,2,3,4,]", nullptr}, + {"{\"a\": 1, }", nullptr}, /* Testing after-ending characters. */ - {"{}x", NULL}, + {"{}x", nullptr}, /* Testing having a key syntax in an array. */ - {"[\"x\":0]", NULL}, + {"[\"x\":0]", nullptr}, /* Testing invalid numbers. */ - {"1.", NULL}, - {"1e", NULL}, - {".12", NULL}, - {"1.x", NULL}, - {"1.12x", NULL}, - {"1ex", NULL}, - {"1e12x", NULL}, - {".12x", NULL}, - {"000", NULL}, + {"1.", nullptr}, + {"1e", nullptr}, + {".12", nullptr}, + {"1.x", nullptr}, + {"1.12x", nullptr}, + {"1ex", nullptr}, + {"1e12x", nullptr}, + {".12x", nullptr}, + {"000", nullptr}, }; static void test_pairs() { diff --git a/test/core/memory_usage/client.cc b/test/core/memory_usage/client.cc index 74ec4b0738342..3741c7f7ad542 100644 --- a/test/core/memory_usage/client.cc +++ b/test/core/memory_usage/client.cc @@ -73,15 +73,15 @@ static void init_ping_pong_request(int call_idx) { grpc_slice hostname = grpc_slice_from_static_string("localhost"); calls[call_idx].call = grpc_channel_create_call( - channel, NULL, GRPC_PROPAGATE_DEFAULTS, cq, + channel, nullptr, GRPC_PROPAGATE_DEFAULTS, cq, grpc_slice_from_static_string("/Reflector/reflectUnary"), &hostname, - gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(calls[call_idx].call, metadata_ops, (size_t)(op - metadata_ops), - tag(call_idx), NULL)); - grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + tag(call_idx), nullptr)); + grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); } // Second step is to finish the call (i.e recv status) and destroy the call. @@ -100,13 +100,13 @@ static void finish_ping_pong_request(int call_idx) { GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(calls[call_idx].call, status_ops, (size_t)(op - status_ops), - tag(call_idx), NULL)); - grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + tag(call_idx), nullptr)); + grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); grpc_metadata_array_destroy(&calls[call_idx].initial_metadata_recv); grpc_metadata_array_destroy(&calls[call_idx].trailing_metadata_recv); grpc_slice_unref(calls[call_idx].details); grpc_call_unref(calls[call_idx].call); - calls[call_idx].call = NULL; + calls[call_idx].call = nullptr; } static struct grpc_memory_counters send_snapshot_request(int call_idx, @@ -114,7 +114,7 @@ static struct grpc_memory_counters send_snapshot_request(int call_idx, grpc_metadata_array_init(&calls[call_idx].initial_metadata_recv); grpc_metadata_array_init(&calls[call_idx].trailing_metadata_recv); - grpc_byte_buffer* response_payload_recv = NULL; + grpc_byte_buffer* response_payload_recv = nullptr; memset(snapshot_ops, 0, sizeof(snapshot_ops)); op = snapshot_ops; @@ -140,12 +140,12 @@ static struct grpc_memory_counters send_snapshot_request(int call_idx, grpc_slice hostname = grpc_slice_from_static_string("localhost"); calls[call_idx].call = grpc_channel_create_call( - channel, NULL, GRPC_PROPAGATE_DEFAULTS, cq, call_type, &hostname, - gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + channel, nullptr, GRPC_PROPAGATE_DEFAULTS, cq, call_type, &hostname, + gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch( calls[call_idx].call, snapshot_ops, - (size_t)(op - snapshot_ops), (void*)0, NULL)); - grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + (size_t)(op - snapshot_ops), (void*)nullptr, nullptr)); + grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); grpc_byte_buffer_reader reader; grpc_byte_buffer_reader_init(&reader, response_payload_recv); @@ -173,7 +173,7 @@ static struct grpc_memory_counters send_snapshot_request(int call_idx, grpc_slice_unref(calls[call_idx].details); calls[call_idx].details = grpc_empty_slice(); grpc_call_unref(calls[call_idx].call); - calls[call_idx].call = NULL; + calls[call_idx].call = nullptr; return snapshot; } @@ -208,11 +208,11 @@ int main(int argc, char** argv) { calls[k].details = grpc_empty_slice(); } - cq = grpc_completion_queue_create_for_next(NULL); + cq = grpc_completion_queue_create_for_next(nullptr); struct grpc_memory_counters client_channel_start = grpc_memory_counters_snapshot(); - channel = grpc_insecure_channel_create(target, NULL, NULL); + channel = grpc_insecure_channel_create(target, nullptr, nullptr); int call_idx = 0; @@ -254,7 +254,7 @@ int main(int argc, char** argv) { cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_micros(10000, GPR_TIMESPAN)), - NULL); + nullptr); } while (event.type != GRPC_QUEUE_TIMEOUT); // second step - recv status and destroy call @@ -274,7 +274,7 @@ int main(int argc, char** argv) { do { event = grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), - NULL); + nullptr); } while (event.type != GRPC_QUEUE_SHUTDOWN); grpc_slice_unref(slice); @@ -320,7 +320,7 @@ int main(int argc, char** argv) { benchmark_iterations, server_calls_end.total_size_relative - after_server_create.total_size_relative, - env_build == NULL ? "" : env_build, env_job == NULL ? "" : env_job); + env_build == nullptr ? "" : env_build, env_job == nullptr ? "" : env_job); fclose(csv); gpr_log(GPR_INFO, "Summary written to %s", csv_file); } diff --git a/test/core/memory_usage/server.cc b/test/core/memory_usage/server.cc index 04e55db30d3b0..0d796439ce5cc 100644 --- a/test/core/memory_usage/server.cc +++ b/test/core/memory_usage/server.cc @@ -45,8 +45,8 @@ static grpc_op metadata_ops[2]; static grpc_op snapshot_ops[5]; static grpc_op status_op; static int got_sigint = 0; -static grpc_byte_buffer* payload_buffer = NULL; -static grpc_byte_buffer* terminal_buffer = NULL; +static grpc_byte_buffer* payload_buffer = nullptr; +static grpc_byte_buffer* terminal_buffer = nullptr; static int was_cancelled = 2; static void* tag(intptr_t t) { return (void*)t; } @@ -88,7 +88,7 @@ static void send_initial_metadata_unary(void* tag) { metadata_ops[0].data.send_initial_metadata.count = 0; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch((*(fling_call*)tag).call, - metadata_ops, 1, tag, NULL)); + metadata_ops, 1, tag, nullptr)); } static void send_status(void* tag) { @@ -99,7 +99,7 @@ static void send_status(void* tag) { status_op.data.send_status_from_server.status_details = &details; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch((*(fling_call*)tag).call, - &status_op, 1, tag, NULL)); + &status_op, 1, tag, nullptr)); } static void send_snapshot(void* tag, struct grpc_memory_counters* snapshot) { @@ -118,7 +118,7 @@ static void send_snapshot(void* tag, struct grpc_memory_counters* snapshot) { op->data.recv_message.recv_message = &terminal_buffer; op++; op->op = GRPC_OP_SEND_MESSAGE; - if (payload_buffer == NULL) { + if (payload_buffer == nullptr) { gpr_log(GPR_INFO, "NULL payload buffer !!!"); } op->data.send_message.send_message = payload_buffer; @@ -135,7 +135,7 @@ static void send_snapshot(void* tag, struct grpc_memory_counters* snapshot) { GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch((*(fling_call*)tag).call, snapshot_ops, - (size_t)(op - snapshot_ops), tag, NULL)); + (size_t)(op - snapshot_ops), tag, nullptr)); } /* We have some sort of deadlock, so let's not exit gracefully for now. When that is resolved, please remove the #include above. */ @@ -144,14 +144,14 @@ static void sigint_handler(int x) { _exit(0); } int main(int argc, char** argv) { grpc_memory_counters_init(); grpc_event ev; - char* addr_buf = NULL; + char* addr_buf = nullptr; gpr_cmdline* cl; grpc_completion_queue* shutdown_cq; int shutdown_started = 0; int shutdown_finished = 0; int secure = 0; - const char* addr = NULL; + const char* addr = nullptr; char* fake_argv[1]; @@ -168,13 +168,13 @@ int main(int argc, char** argv) { gpr_cmdline_parse(cl, argc, argv); gpr_cmdline_destroy(cl); - if (addr == NULL) { + if (addr == nullptr) { gpr_join_host_port(&addr_buf, "::", grpc_pick_unused_port_or_die()); addr = addr_buf; } gpr_log(GPR_INFO, "creating server on: %s", addr); - cq = grpc_completion_queue_create_for_next(NULL); + cq = grpc_completion_queue_create_for_next(nullptr); struct grpc_memory_counters before_server_create = grpc_memory_counters_snapshot(); @@ -182,23 +182,23 @@ int main(int argc, char** argv) { grpc_ssl_pem_key_cert_pair pem_key_cert_pair = {test_server1_key, test_server1_cert}; grpc_server_credentials* ssl_creds = grpc_ssl_server_credentials_create( - NULL, &pem_key_cert_pair, 1, 0, NULL); - server = grpc_server_create(NULL, NULL); + nullptr, &pem_key_cert_pair, 1, 0, nullptr); + server = grpc_server_create(nullptr, nullptr); GPR_ASSERT(grpc_server_add_secure_http2_port(server, addr, ssl_creds)); grpc_server_credentials_release(ssl_creds); } else { - server = grpc_server_create(NULL, NULL); + server = grpc_server_create(nullptr, nullptr); GPR_ASSERT(grpc_server_add_insecure_http2_port(server, addr)); } - grpc_server_register_completion_queue(server, cq, NULL); + grpc_server_register_completion_queue(server, cq, nullptr); grpc_server_start(server); struct grpc_memory_counters after_server_create = grpc_memory_counters_snapshot(); gpr_free(addr_buf); - addr = addr_buf = NULL; + addr = addr_buf = nullptr; // initialize call instances for (int i = 0; i < (int)(sizeof(calls) / sizeof(fling_call)); i++) { @@ -217,11 +217,11 @@ int main(int argc, char** argv) { if (got_sigint && !shutdown_started) { gpr_log(GPR_INFO, "Shutting down due to SIGINT"); - shutdown_cq = grpc_completion_queue_create_for_pluck(NULL); + shutdown_cq = grpc_completion_queue_create_for_pluck(nullptr); grpc_server_shutdown_and_notify(server, shutdown_cq, tag(1000)); GPR_ASSERT( grpc_completion_queue_pluck(shutdown_cq, tag(1000), - grpc_timeout_seconds_to_deadline(5), NULL) + grpc_timeout_seconds_to_deadline(5), nullptr) .type == GRPC_OP_COMPLETE); grpc_completion_queue_destroy(shutdown_cq); grpc_completion_queue_shutdown(cq); @@ -231,7 +231,7 @@ int main(int argc, char** argv) { cq, gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_micros(1000000, GPR_TIMESPAN)), - NULL); + nullptr); fling_call* s = static_cast(ev.tag); switch (ev.type) { case GRPC_OP_COMPLETE: @@ -294,8 +294,8 @@ int main(int argc, char** argv) { grpc_call_details_destroy(&s->call_details); grpc_metadata_array_destroy(&s->initial_metadata_send); grpc_metadata_array_destroy(&s->request_metadata_recv); - terminal_buffer = NULL; - payload_buffer = NULL; + terminal_buffer = nullptr; + payload_buffer = nullptr; break; } break; diff --git a/test/core/network_benchmarks/low_level_ping_pong.cc b/test/core/network_benchmarks/low_level_ping_pong.cc index 722652148c65d..687395d916515 100644 --- a/test/core/network_benchmarks/low_level_ping_pong.cc +++ b/test/core/network_benchmarks/low_level_ping_pong.cc @@ -405,7 +405,7 @@ static int connect_client(struct sockaddr* addr, socklen_t len) { } static int accept_server(int listen_fd) { - int fd = accept(listen_fd, NULL, NULL); + int fd = accept(listen_fd, nullptr, nullptr); if (fd < 0) { gpr_log(GPR_ERROR, "Accept failed: %s", strerror(errno)); return -1; @@ -583,7 +583,7 @@ static int run_benchmark(const char* socket_type, thread_args* client_args, gpr_log(GPR_INFO, "Starting test %s %s %zu", client_args->strategy_name, socket_type, client_args->msg_size); - gpr_thd_new(&tid, server_thread_wrap, server_args, NULL); + gpr_thd_new(&tid, server_thread_wrap, server_args, nullptr); client_thread(client_args); return 0; } @@ -626,10 +626,10 @@ int main(int argc, char** argv) { thread_args* server_args = static_cast(gpr_malloc(sizeof(thread_args))); int msg_size = -1; - const char* read_strategy = NULL; - const char* socket_type = NULL; + const char* read_strategy = nullptr; + const char* socket_type = nullptr; size_t i; - const test_strategy* strategy = NULL; + const test_strategy* strategy = nullptr; int error = 0; gpr_cmdline* cmdline = @@ -647,12 +647,12 @@ int main(int argc, char** argv) { msg_size = 50; } - if (read_strategy == NULL) { + if (read_strategy == nullptr) { gpr_log(GPR_INFO, "No strategy specified, running all benchmarks"); return run_all_benchmarks((size_t)msg_size); } - if (socket_type == NULL) { + if (socket_type == nullptr) { socket_type = "tcp"; } if (msg_size <= 0) { @@ -666,7 +666,7 @@ int main(int argc, char** argv) { strategy = &test_strategies[i]; } } - if (strategy == NULL) { + if (strategy == nullptr) { fprintf(stderr, "Invalid read strategy %s\n", read_strategy); return -1; } diff --git a/test/core/security/auth_context_test.cc b/test/core/security/auth_context_test.cc index 3ab9190689489..d8e41326c008c 100644 --- a/test/core/security/auth_context_test.cc +++ b/test/core/security/auth_context_test.cc @@ -25,31 +25,31 @@ #include static void test_empty_context(void) { - grpc_auth_context* ctx = grpc_auth_context_create(NULL); + grpc_auth_context* ctx = grpc_auth_context_create(nullptr); grpc_auth_property_iterator it; gpr_log(GPR_INFO, "test_empty_context"); - GPR_ASSERT(ctx != NULL); - GPR_ASSERT(grpc_auth_context_peer_identity_property_name(ctx) == NULL); + GPR_ASSERT(ctx != nullptr); + GPR_ASSERT(grpc_auth_context_peer_identity_property_name(ctx) == nullptr); it = grpc_auth_context_peer_identity(ctx); - GPR_ASSERT(grpc_auth_property_iterator_next(&it) == NULL); + GPR_ASSERT(grpc_auth_property_iterator_next(&it) == nullptr); it = grpc_auth_context_property_iterator(ctx); - GPR_ASSERT(grpc_auth_property_iterator_next(&it) == NULL); + GPR_ASSERT(grpc_auth_property_iterator_next(&it) == nullptr); it = grpc_auth_context_find_properties_by_name(ctx, "foo"); - GPR_ASSERT(grpc_auth_property_iterator_next(&it) == NULL); + GPR_ASSERT(grpc_auth_property_iterator_next(&it) == nullptr); GPR_ASSERT(grpc_auth_context_set_peer_identity_property_name(ctx, "bar") == 0); - GPR_ASSERT(grpc_auth_context_peer_identity_property_name(ctx) == NULL); + GPR_ASSERT(grpc_auth_context_peer_identity_property_name(ctx) == nullptr); GRPC_AUTH_CONTEXT_UNREF(ctx, "test"); } static void test_simple_context(void) { - grpc_auth_context* ctx = grpc_auth_context_create(NULL); + grpc_auth_context* ctx = grpc_auth_context_create(nullptr); grpc_auth_property_iterator it; size_t i; gpr_log(GPR_INFO, "test_simple_context"); - GPR_ASSERT(ctx != NULL); + GPR_ASSERT(ctx != nullptr); grpc_auth_context_add_cstring_property(ctx, "name", "chapi"); grpc_auth_context_add_cstring_property(ctx, "name", "chapo"); grpc_auth_context_add_cstring_property(ctx, "foo", "bar"); @@ -64,25 +64,25 @@ static void test_simple_context(void) { const grpc_auth_property* p = grpc_auth_property_iterator_next(&it); GPR_ASSERT(p == &ctx->properties.array[i]); } - GPR_ASSERT(grpc_auth_property_iterator_next(&it) == NULL); + GPR_ASSERT(grpc_auth_property_iterator_next(&it) == nullptr); it = grpc_auth_context_find_properties_by_name(ctx, "foo"); GPR_ASSERT(grpc_auth_property_iterator_next(&it) == &ctx->properties.array[2]); - GPR_ASSERT(grpc_auth_property_iterator_next(&it) == NULL); + GPR_ASSERT(grpc_auth_property_iterator_next(&it) == nullptr); it = grpc_auth_context_peer_identity(ctx); GPR_ASSERT(grpc_auth_property_iterator_next(&it) == &ctx->properties.array[0]); GPR_ASSERT(grpc_auth_property_iterator_next(&it) == &ctx->properties.array[1]); - GPR_ASSERT(grpc_auth_property_iterator_next(&it) == NULL); + GPR_ASSERT(grpc_auth_property_iterator_next(&it) == nullptr); GRPC_AUTH_CONTEXT_UNREF(ctx, "test"); } static void test_chained_context(void) { - grpc_auth_context* chained = grpc_auth_context_create(NULL); + grpc_auth_context* chained = grpc_auth_context_create(nullptr); grpc_auth_context* ctx = grpc_auth_context_create(chained); grpc_auth_property_iterator it; size_t i; @@ -108,14 +108,14 @@ static void test_chained_context(void) { const grpc_auth_property* p = grpc_auth_property_iterator_next(&it); GPR_ASSERT(p == &chained->properties.array[i]); } - GPR_ASSERT(grpc_auth_property_iterator_next(&it) == NULL); + GPR_ASSERT(grpc_auth_property_iterator_next(&it) == nullptr); it = grpc_auth_context_find_properties_by_name(ctx, "foo"); GPR_ASSERT(grpc_auth_property_iterator_next(&it) == &ctx->properties.array[2]); GPR_ASSERT(grpc_auth_property_iterator_next(&it) == &chained->properties.array[1]); - GPR_ASSERT(grpc_auth_property_iterator_next(&it) == NULL); + GPR_ASSERT(grpc_auth_property_iterator_next(&it) == nullptr); it = grpc_auth_context_peer_identity(ctx); GPR_ASSERT(grpc_auth_property_iterator_next(&it) == @@ -124,7 +124,7 @@ static void test_chained_context(void) { &ctx->properties.array[1]); GPR_ASSERT(grpc_auth_property_iterator_next(&it) == &chained->properties.array[0]); - GPR_ASSERT(grpc_auth_property_iterator_next(&it) == NULL); + GPR_ASSERT(grpc_auth_property_iterator_next(&it) == nullptr); GRPC_AUTH_CONTEXT_UNREF(ctx, "test"); } diff --git a/test/core/security/create_jwt.cc b/test/core/security/create_jwt.cc index 95f3615074d07..867a8ba5752f5 100644 --- a/test/core/security/create_jwt.cc +++ b/test/core/security/create_jwt.cc @@ -42,10 +42,10 @@ void create_jwt(const char* json_key_file_path, const char* service_url, exit(1); } jwt = grpc_jwt_encode_and_sign( - &key, service_url == NULL ? GRPC_JWT_OAUTH2_AUDIENCE : service_url, + &key, service_url == nullptr ? GRPC_JWT_OAUTH2_AUDIENCE : service_url, grpc_max_auth_token_lifetime(), scope); grpc_auth_json_key_destruct(&key); - if (jwt == NULL) { + if (jwt == nullptr) { fprintf(stderr, "Could not create JWT.\n"); exit(1); } @@ -54,9 +54,9 @@ void create_jwt(const char* json_key_file_path, const char* service_url, } int main(int argc, char** argv) { - const char* scope = NULL; - const char* json_key_file_path = NULL; - const char* service_url = NULL; + const char* scope = nullptr; + const char* json_key_file_path = nullptr; + const char* service_url = nullptr; grpc_init(); gpr_cmdline* cl = gpr_cmdline_create("create_jwt"); gpr_cmdline_add_string(cl, "json_key", "File path of the json key.", @@ -70,17 +70,17 @@ int main(int argc, char** argv) { &service_url); gpr_cmdline_parse(cl, argc, argv); - if (json_key_file_path == NULL) { + if (json_key_file_path == nullptr) { fprintf(stderr, "Missing --json_key option.\n"); exit(1); } - if (scope != NULL) { - if (service_url != NULL) { + if (scope != nullptr) { + if (service_url != nullptr) { fprintf(stderr, "Options --scope and --service_url are mutually exclusive.\n"); exit(1); } - } else if (service_url == NULL) { + } else if (service_url == nullptr) { fprintf(stderr, "Need one of --service_url or --scope options.\n"); exit(1); } diff --git a/test/core/security/credentials_test.cc b/test/core/security/credentials_test.cc index 9b575c4bc5719..f9d6e444f39d9 100644 --- a/test/core/security/credentials_test.cc +++ b/test/core/security/credentials_test.cc @@ -151,7 +151,7 @@ static void test_empty_md_array(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_credentials_mdelem_array md_array; memset(&md_array, 0, sizeof(md_array)); - GPR_ASSERT(md_array.md == NULL); + GPR_ASSERT(md_array.md == nullptr); GPR_ASSERT(md_array.size == 0); grpc_credentials_mdelem_array_destroy(&exec_ctx, &md_array); grpc_exec_ctx_finish(&exec_ctx); @@ -403,9 +403,9 @@ static void test_google_iam_creds(void) { make_request_metadata_state(GRPC_ERROR_NONE, emd, GPR_ARRAY_SIZE(emd)); grpc_call_credentials* creds = grpc_google_iam_credentials_create( test_google_iam_authorization_token, test_google_iam_authority_selector, - NULL); - grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL, - NULL}; + nullptr); + grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, nullptr, + nullptr}; run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, state); grpc_call_credentials_unref(&exec_ctx, creds); grpc_exec_ctx_finish(&exec_ctx); @@ -417,9 +417,9 @@ static void test_access_token_creds(void) { request_metadata_state* state = make_request_metadata_state(GRPC_ERROR_NONE, emd, GPR_ARRAY_SIZE(emd)); grpc_call_credentials* creds = - grpc_access_token_credentials_create("blah", NULL); - grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL, - NULL}; + grpc_access_token_credentials_create("blah", nullptr); + grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, nullptr, + nullptr}; GPR_ASSERT(strcmp(creds->type, GRPC_CALL_CREDENTIALS_TYPE_OAUTH2) == 0); run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, state); grpc_call_credentials_unref(&exec_ctx, creds); @@ -432,7 +432,7 @@ static grpc_security_status check_channel_oauth2_create_security_connector( const grpc_channel_args* args, grpc_channel_security_connector** sc, grpc_channel_args** new_args) { GPR_ASSERT(strcmp(c->type, "mock") == 0); - GPR_ASSERT(call_creds != NULL); + GPR_ASSERT(call_creds != nullptr); GPR_ASSERT(strcmp(call_creds->type, GRPC_CALL_CREDENTIALS_TYPE_OAUTH2) == 0); return GRPC_SECURITY_OK; } @@ -441,18 +441,18 @@ static void test_channel_oauth2_composite_creds(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_channel_args* new_args; grpc_channel_credentials_vtable vtable = { - NULL, check_channel_oauth2_create_security_connector, NULL}; + nullptr, check_channel_oauth2_create_security_connector, nullptr}; grpc_channel_credentials* channel_creds = grpc_mock_channel_credentials_create(&vtable); grpc_call_credentials* oauth2_creds = - grpc_access_token_credentials_create("blah", NULL); + grpc_access_token_credentials_create("blah", nullptr); grpc_channel_credentials* channel_oauth2_creds = grpc_composite_channel_credentials_create(channel_creds, oauth2_creds, - NULL); + nullptr); grpc_channel_credentials_release(channel_creds); grpc_call_credentials_release(oauth2_creds); GPR_ASSERT(grpc_channel_credentials_create_security_connector( - &exec_ctx, channel_oauth2_creds, NULL, NULL, NULL, + &exec_ctx, channel_oauth2_creds, nullptr, nullptr, nullptr, &new_args) == GRPC_SECURITY_OK); grpc_channel_credentials_release(channel_oauth2_creds); grpc_exec_ctx_finish(&exec_ctx); @@ -468,16 +468,16 @@ static void test_oauth2_google_iam_composite_creds(void) { test_google_iam_authority_selector}}; request_metadata_state* state = make_request_metadata_state(GRPC_ERROR_NONE, emd, GPR_ARRAY_SIZE(emd)); - grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL, - NULL}; + grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, nullptr, + nullptr}; grpc_call_credentials* oauth2_creds = grpc_md_only_test_credentials_create( &exec_ctx, "authorization", test_oauth2_bearer_token, 0); grpc_call_credentials* google_iam_creds = grpc_google_iam_credentials_create( test_google_iam_authorization_token, test_google_iam_authority_selector, - NULL); + nullptr); grpc_call_credentials* composite_creds = grpc_composite_call_credentials_create(oauth2_creds, google_iam_creds, - NULL); + nullptr); grpc_call_credentials_unref(&exec_ctx, oauth2_creds); grpc_call_credentials_unref(&exec_ctx, google_iam_creds); GPR_ASSERT( @@ -502,7 +502,7 @@ check_channel_oauth2_google_iam_create_security_connector( grpc_channel_args** new_args) { const grpc_call_credentials_array* creds_array; GPR_ASSERT(strcmp(c->type, "mock") == 0); - GPR_ASSERT(call_creds != NULL); + GPR_ASSERT(call_creds != nullptr); GPR_ASSERT(strcmp(call_creds->type, GRPC_CALL_CREDENTIALS_TYPE_COMPOSITE) == 0); creds_array = grpc_composite_call_credentials_get_credentials(call_creds); @@ -517,27 +517,27 @@ static void test_channel_oauth2_google_iam_composite_creds(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_channel_args* new_args; grpc_channel_credentials_vtable vtable = { - NULL, check_channel_oauth2_google_iam_create_security_connector, NULL}; + nullptr, check_channel_oauth2_google_iam_create_security_connector, nullptr}; grpc_channel_credentials* channel_creds = grpc_mock_channel_credentials_create(&vtable); grpc_call_credentials* oauth2_creds = - grpc_access_token_credentials_create("blah", NULL); + grpc_access_token_credentials_create("blah", nullptr); grpc_channel_credentials* channel_oauth2_creds = grpc_composite_channel_credentials_create(channel_creds, oauth2_creds, - NULL); + nullptr); grpc_call_credentials* google_iam_creds = grpc_google_iam_credentials_create( test_google_iam_authorization_token, test_google_iam_authority_selector, - NULL); + nullptr); grpc_channel_credentials* channel_oauth2_iam_creds = grpc_composite_channel_credentials_create(channel_oauth2_creds, - google_iam_creds, NULL); + google_iam_creds, nullptr); grpc_channel_credentials_release(channel_creds); grpc_call_credentials_release(oauth2_creds); grpc_channel_credentials_release(channel_oauth2_creds); grpc_call_credentials_release(google_iam_creds); GPR_ASSERT(grpc_channel_credentials_create_security_connector( - &exec_ctx, channel_oauth2_iam_creds, NULL, NULL, NULL, + &exec_ctx, channel_oauth2_iam_creds, nullptr, nullptr, nullptr, &new_args) == GRPC_SECURITY_OK); grpc_channel_credentials_release(channel_oauth2_iam_creds); @@ -581,7 +581,7 @@ static int httpcli_post_should_not_be_called( grpc_exec_ctx* exec_ctx, const grpc_httpcli_request* request, const char* body_bytes, size_t body_size, grpc_millis deadline, grpc_closure* on_done, grpc_httpcli_response* response) { - GPR_ASSERT("HTTP POST should not be called" == NULL); + GPR_ASSERT("HTTP POST should not be called" == nullptr); return 1; } @@ -590,7 +590,7 @@ static int httpcli_get_should_not_be_called(grpc_exec_ctx* exec_ctx, grpc_millis deadline, grpc_closure* on_done, grpc_httpcli_response* response) { - GPR_ASSERT("HTTP GET should not be called" == NULL); + GPR_ASSERT("HTTP GET should not be called" == nullptr); return 1; } @@ -599,9 +599,9 @@ static void test_compute_engine_creds_success(void) { expected_md emd[] = { {"authorization", "Bearer ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_"}}; grpc_call_credentials* creds = - grpc_google_compute_engine_credentials_create(NULL); - grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL, - NULL}; + grpc_google_compute_engine_credentials_create(nullptr); + grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, nullptr, + nullptr}; /* First request: http get should be called. */ request_metadata_state* state = @@ -620,7 +620,7 @@ static void test_compute_engine_creds_success(void) { grpc_exec_ctx_flush(&exec_ctx); grpc_call_credentials_unref(&exec_ctx, creds); - grpc_httpcli_set_override(NULL, NULL); + grpc_httpcli_set_override(nullptr, nullptr); grpc_exec_ctx_finish(&exec_ctx); } @@ -629,24 +629,24 @@ static void test_compute_engine_creds_failure(void) { request_metadata_state* state = make_request_metadata_state( GRPC_ERROR_CREATE_FROM_STATIC_STRING( "Error occured when fetching oauth2 token."), - NULL, 0); - grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL, - NULL}; + nullptr, 0); + grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, nullptr, + nullptr}; grpc_call_credentials* creds = - grpc_google_compute_engine_credentials_create(NULL); + grpc_google_compute_engine_credentials_create(nullptr); grpc_httpcli_set_override(compute_engine_httpcli_get_failure_override, httpcli_post_should_not_be_called); run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, state); grpc_call_credentials_unref(&exec_ctx, creds); - grpc_httpcli_set_override(NULL, NULL); + grpc_httpcli_set_override(nullptr, nullptr); grpc_exec_ctx_finish(&exec_ctx); } static void validate_refresh_token_http_request( const grpc_httpcli_request* request, const char* body, size_t body_size) { /* The content of the assertion is tested extensively in json_token_test. */ - char* expected_body = NULL; - GPR_ASSERT(body != NULL); + char* expected_body = nullptr; + GPR_ASSERT(body != nullptr); GPR_ASSERT(body_size != 0); gpr_asprintf(&expected_body, GRPC_REFRESH_TOKEN_POST_BODY_FORMAT_STRING, "32555999999.apps.googleusercontent.com", @@ -689,10 +689,10 @@ static void test_refresh_token_creds_success(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; expected_md emd[] = { {"authorization", "Bearer ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_"}}; - grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL, - NULL}; + grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, nullptr, + nullptr}; grpc_call_credentials* creds = grpc_google_refresh_token_credentials_create( - test_refresh_token_str, NULL); + test_refresh_token_str, nullptr); /* First request: http get should be called. */ request_metadata_state* state = @@ -711,7 +711,7 @@ static void test_refresh_token_creds_success(void) { grpc_exec_ctx_flush(&exec_ctx); grpc_call_credentials_unref(&exec_ctx, creds); - grpc_httpcli_set_override(NULL, NULL); + grpc_httpcli_set_override(nullptr, nullptr); grpc_exec_ctx_finish(&exec_ctx); } @@ -720,16 +720,16 @@ static void test_refresh_token_creds_failure(void) { request_metadata_state* state = make_request_metadata_state( GRPC_ERROR_CREATE_FROM_STATIC_STRING( "Error occured when fetching oauth2 token."), - NULL, 0); - grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL, - NULL}; + nullptr, 0); + grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, nullptr, + nullptr}; grpc_call_credentials* creds = grpc_google_refresh_token_credentials_create( - test_refresh_token_str, NULL); + test_refresh_token_str, nullptr); grpc_httpcli_set_override(httpcli_get_should_not_be_called, refresh_token_httpcli_post_failure); run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, state); grpc_call_credentials_unref(&exec_ctx, creds); - grpc_httpcli_set_override(NULL, NULL); + grpc_httpcli_set_override(nullptr, nullptr); grpc_exec_ctx_finish(&exec_ctx); } @@ -737,22 +737,22 @@ static void validate_jwt_encode_and_sign_params( const grpc_auth_json_key* json_key, const char* scope, gpr_timespec token_lifetime) { GPR_ASSERT(grpc_auth_json_key_is_valid(json_key)); - GPR_ASSERT(json_key->private_key != NULL); + GPR_ASSERT(json_key->private_key != nullptr); GPR_ASSERT(RSA_check_key(json_key->private_key)); - GPR_ASSERT(json_key->type != NULL && + GPR_ASSERT(json_key->type != nullptr && strcmp(json_key->type, "service_account") == 0); - GPR_ASSERT(json_key->private_key_id != NULL && + GPR_ASSERT(json_key->private_key_id != nullptr && strcmp(json_key->private_key_id, "e6b5137873db8d2ef81e06a47289e6434ec8a165") == 0); - GPR_ASSERT(json_key->client_id != NULL && + GPR_ASSERT(json_key->client_id != nullptr && strcmp(json_key->client_id, "777-abaslkan11hlb6nmim3bpspl31ud.apps." "googleusercontent.com") == 0); - GPR_ASSERT(json_key->client_email != NULL && + GPR_ASSERT(json_key->client_email != nullptr && strcmp(json_key->client_email, "777-abaslkan11hlb6nmim3bpspl31ud@developer." "gserviceaccount.com") == 0); - if (scope != NULL) GPR_ASSERT(strcmp(scope, test_scope) == 0); + if (scope != nullptr) GPR_ASSERT(strcmp(scope, test_scope) == 0); GPR_ASSERT(!gpr_time_cmp(token_lifetime, grpc_max_auth_token_lifetime())); } @@ -769,19 +769,19 @@ static char* encode_and_sign_jwt_failure(const grpc_auth_json_key* json_key, gpr_timespec token_lifetime, const char* scope) { validate_jwt_encode_and_sign_params(json_key, scope, token_lifetime); - return NULL; + return nullptr; } static char* encode_and_sign_jwt_should_not_be_called( const grpc_auth_json_key* json_key, const char* audience, gpr_timespec token_lifetime, const char* scope) { - GPR_ASSERT("grpc_jwt_encode_and_sign should not be called" == NULL); - return NULL; + GPR_ASSERT("grpc_jwt_encode_and_sign should not be called" == nullptr); + return nullptr; } static grpc_service_account_jwt_access_credentials* creds_as_jwt( grpc_call_credentials* creds) { - GPR_ASSERT(creds != NULL); + GPR_ASSERT(creds != nullptr); GPR_ASSERT(strcmp(creds->type, GRPC_CALL_CREDENTIALS_TYPE_JWT) == 0); return (grpc_service_account_jwt_access_credentials*)creds; } @@ -792,7 +792,7 @@ static void test_jwt_creds_lifetime(void) { // Max lifetime. grpc_call_credentials* jwt_creds = grpc_service_account_jwt_access_credentials_create( - json_key_string, grpc_max_auth_token_lifetime(), NULL); + json_key_string, grpc_max_auth_token_lifetime(), nullptr); GPR_ASSERT(gpr_time_cmp(creds_as_jwt(jwt_creds)->jwt_lifetime, grpc_max_auth_token_lifetime()) == 0); grpc_call_credentials_release(jwt_creds); @@ -801,7 +801,7 @@ static void test_jwt_creds_lifetime(void) { gpr_timespec token_lifetime = {10, 0, GPR_TIMESPAN}; GPR_ASSERT(gpr_time_cmp(grpc_max_auth_token_lifetime(), token_lifetime) > 0); jwt_creds = grpc_service_account_jwt_access_credentials_create( - json_key_string, token_lifetime, NULL); + json_key_string, token_lifetime, nullptr); GPR_ASSERT( gpr_time_cmp(creds_as_jwt(jwt_creds)->jwt_lifetime, token_lifetime) == 0); grpc_call_credentials_release(jwt_creds); @@ -810,7 +810,7 @@ static void test_jwt_creds_lifetime(void) { gpr_timespec add_to_max = {10, 0, GPR_TIMESPAN}; token_lifetime = gpr_time_add(grpc_max_auth_token_lifetime(), add_to_max); jwt_creds = grpc_service_account_jwt_access_credentials_create( - json_key_string, token_lifetime, NULL); + json_key_string, token_lifetime, nullptr); GPR_ASSERT(gpr_time_cmp(creds_as_jwt(jwt_creds)->jwt_lifetime, grpc_max_auth_token_lifetime()) == 0); grpc_call_credentials_release(jwt_creds); @@ -821,14 +821,14 @@ static void test_jwt_creds_lifetime(void) { static void test_jwt_creds_success(void) { char* json_key_string = test_json_key_str(); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL, - NULL}; + grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, nullptr, + nullptr}; char* expected_md_value; gpr_asprintf(&expected_md_value, "Bearer %s", test_signed_jwt); expected_md emd[] = {{"authorization", expected_md_value}}; grpc_call_credentials* creds = grpc_service_account_jwt_access_credentials_create( - json_key_string, grpc_max_auth_token_lifetime(), NULL); + json_key_string, grpc_max_auth_token_lifetime(), nullptr); /* First request: jwt_encode_and_sign should be called. */ request_metadata_state* state = @@ -857,27 +857,27 @@ static void test_jwt_creds_success(void) { grpc_call_credentials_unref(&exec_ctx, creds); gpr_free(json_key_string); gpr_free(expected_md_value); - grpc_jwt_encode_and_sign_set_override(NULL); + grpc_jwt_encode_and_sign_set_override(nullptr); grpc_exec_ctx_finish(&exec_ctx); } static void test_jwt_creds_signing_failure(void) { char* json_key_string = test_json_key_str(); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL, - NULL}; + grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, nullptr, + nullptr}; request_metadata_state* state = make_request_metadata_state( - GRPC_ERROR_CREATE_FROM_STATIC_STRING("Could not generate JWT."), NULL, 0); + GRPC_ERROR_CREATE_FROM_STATIC_STRING("Could not generate JWT."), nullptr, 0); grpc_call_credentials* creds = grpc_service_account_jwt_access_credentials_create( - json_key_string, grpc_max_auth_token_lifetime(), NULL); + json_key_string, grpc_max_auth_token_lifetime(), nullptr); grpc_jwt_encode_and_sign_set_override(encode_and_sign_jwt_failure); run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, state); gpr_free(json_key_string); grpc_call_credentials_unref(&exec_ctx, creds); - grpc_jwt_encode_and_sign_set_override(NULL); + grpc_jwt_encode_and_sign_set_override(nullptr); grpc_exec_ctx_finish(&exec_ctx); } @@ -886,8 +886,8 @@ static void set_google_default_creds_env_var_with_file_contents( size_t contents_len = strlen(contents); char* creds_file_name; FILE* creds_file = gpr_tmpfile(file_prefix, &creds_file_name); - GPR_ASSERT(creds_file_name != NULL); - GPR_ASSERT(creds_file != NULL); + GPR_ASSERT(creds_file_name != nullptr); + GPR_ASSERT(creds_file != nullptr); GPR_ASSERT(fwrite(contents, 1, contents_len, creds_file) == contents_len); fclose(creds_file); gpr_setenv(GRPC_GOOGLE_CREDENTIALS_ENV_VAR, creds_file_name); @@ -905,7 +905,7 @@ static void test_google_default_creds_auth_key(void) { gpr_free(json_key); creds = (grpc_composite_channel_credentials*) grpc_google_default_credentials_create(); - GPR_ASSERT(creds != NULL); + GPR_ASSERT(creds != nullptr); jwt = (grpc_service_account_jwt_access_credentials*)creds->call_creds; GPR_ASSERT( strcmp(jwt->key.client_id, @@ -925,7 +925,7 @@ static void test_google_default_creds_refresh_token(void) { "refresh_token_google_default_creds", test_refresh_token_str); creds = (grpc_composite_channel_credentials*) grpc_google_default_credentials_create(); - GPR_ASSERT(creds != NULL); + GPR_ASSERT(creds != nullptr); refresh = (grpc_google_refresh_token_credentials*)creds->call_creds; GPR_ASSERT(strcmp(refresh->refresh_token.client_id, "32555999999.apps.googleusercontent.com") == 0); @@ -951,7 +951,7 @@ static int default_creds_gce_detection_httpcli_get_success_override( return 1; } -static char* null_well_known_creds_path_getter(void) { return NULL; } +static char* null_well_known_creds_path_getter(void) { return nullptr; } static void test_google_default_creds_gce(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; @@ -959,8 +959,8 @@ static void test_google_default_creds_gce(void) { {"authorization", "Bearer ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_"}}; request_metadata_state* state = make_request_metadata_state(GRPC_ERROR_NONE, emd, GPR_ARRAY_SIZE(emd)); - grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL, - NULL}; + grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, nullptr, + nullptr}; grpc_flush_cached_google_default_credentials(); gpr_setenv(GRPC_GOOGLE_CREDENTIALS_ENV_VAR, ""); /* Reset. */ grpc_override_well_known_credentials_path_getter( @@ -975,8 +975,8 @@ static void test_google_default_creds_gce(void) { grpc_google_default_credentials_create(); /* Verify that the default creds actually embeds a GCE creds. */ - GPR_ASSERT(creds != NULL); - GPR_ASSERT(creds->call_creds != NULL); + GPR_ASSERT(creds != nullptr); + GPR_ASSERT(creds->call_creds != nullptr); grpc_httpcli_set_override(compute_engine_httpcli_get_success_override, httpcli_post_should_not_be_called); run_request_metadata_test(&exec_ctx, creds->call_creds, auth_md_ctx, state); @@ -994,8 +994,8 @@ static void test_google_default_creds_gce(void) { /* Cleanup. */ grpc_channel_credentials_unref(&exec_ctx, cached_creds); grpc_channel_credentials_unref(&exec_ctx, &creds->base); - grpc_httpcli_set_override(NULL, NULL); - grpc_override_well_known_credentials_path_getter(NULL); + grpc_httpcli_set_override(nullptr, nullptr); + grpc_override_well_known_credentials_path_getter(nullptr); grpc_exec_ctx_finish(&exec_ctx); } @@ -1021,16 +1021,16 @@ static void test_no_google_default_creds(void) { grpc_httpcli_set_override( default_creds_gce_detection_httpcli_get_failure_override, httpcli_post_should_not_be_called); - GPR_ASSERT(grpc_google_default_credentials_create() == NULL); + GPR_ASSERT(grpc_google_default_credentials_create() == nullptr); /* Try a cached one. GCE detection should not occur anymore. */ grpc_httpcli_set_override(httpcli_get_should_not_be_called, httpcli_post_should_not_be_called); - GPR_ASSERT(grpc_google_default_credentials_create() == NULL); + GPR_ASSERT(grpc_google_default_credentials_create() == nullptr); /* Cleanup. */ - grpc_httpcli_set_override(NULL, NULL); - grpc_override_well_known_credentials_path_getter(NULL); + grpc_httpcli_set_override(nullptr, nullptr); + grpc_override_well_known_credentials_path_getter(nullptr); } typedef enum { @@ -1049,8 +1049,8 @@ static int plugin_get_metadata_success( const char** error_details) { GPR_ASSERT(strcmp(context.service_url, test_service_url) == 0); GPR_ASSERT(strcmp(context.method_name, test_method) == 0); - GPR_ASSERT(context.channel_auth_context == NULL); - GPR_ASSERT(context.reserved == NULL); + GPR_ASSERT(context.channel_auth_context == nullptr); + GPR_ASSERT(context.reserved == nullptr); GPR_ASSERT(GPR_ARRAY_SIZE(plugin_md) < GRPC_METADATA_CREDENTIALS_PLUGIN_SYNC_MAX); plugin_state* s = (plugin_state*)state; @@ -1074,8 +1074,8 @@ static int plugin_get_metadata_failure( const char** error_details) { GPR_ASSERT(strcmp(context.service_url, test_service_url) == 0); GPR_ASSERT(strcmp(context.method_name, test_method) == 0); - GPR_ASSERT(context.channel_auth_context == NULL); - GPR_ASSERT(context.reserved == NULL); + GPR_ASSERT(context.channel_auth_context == nullptr); + GPR_ASSERT(context.reserved == nullptr); plugin_state* s = (plugin_state*)state; *s = PLUGIN_GET_METADATA_CALLED_STATE; *status = GRPC_STATUS_UNAUTHENTICATED; @@ -1092,8 +1092,8 @@ static void test_metadata_plugin_success(void) { plugin_state state = PLUGIN_INITIAL_STATE; grpc_metadata_credentials_plugin plugin; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL, - NULL}; + grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, nullptr, + nullptr}; request_metadata_state* md_state = make_request_metadata_state( GRPC_ERROR_NONE, plugin_md, GPR_ARRAY_SIZE(plugin_md)); @@ -1102,7 +1102,7 @@ static void test_metadata_plugin_success(void) { plugin.destroy = plugin_destroy; grpc_call_credentials* creds = - grpc_metadata_credentials_create_from_plugin(plugin, NULL); + grpc_metadata_credentials_create_from_plugin(plugin, nullptr); GPR_ASSERT(state == PLUGIN_INITIAL_STATE); run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, md_state); GPR_ASSERT(state == PLUGIN_GET_METADATA_CALLED_STATE); @@ -1115,14 +1115,14 @@ static void test_metadata_plugin_failure(void) { plugin_state state = PLUGIN_INITIAL_STATE; grpc_metadata_credentials_plugin plugin; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, NULL, - NULL}; + grpc_auth_metadata_context auth_md_ctx = {test_service_url, test_method, nullptr, + nullptr}; char* expected_error; gpr_asprintf(&expected_error, "Getting metadata from plugin failed with error: %s", plugin_error_details); request_metadata_state* md_state = make_request_metadata_state( - GRPC_ERROR_CREATE_FROM_COPIED_STRING(expected_error), NULL, 0); + GRPC_ERROR_CREATE_FROM_COPIED_STRING(expected_error), nullptr, 0); gpr_free(expected_error); plugin.state = &state; @@ -1130,7 +1130,7 @@ static void test_metadata_plugin_failure(void) { plugin.destroy = plugin_destroy; grpc_call_credentials* creds = - grpc_metadata_credentials_create_from_plugin(plugin, NULL); + grpc_metadata_credentials_create_from_plugin(plugin, nullptr); GPR_ASSERT(state == PLUGIN_INITIAL_STATE); run_request_metadata_test(&exec_ctx, creds, auth_md_ctx, md_state); GPR_ASSERT(state == PLUGIN_GET_METADATA_CALLED_STATE); @@ -1143,12 +1143,12 @@ static void test_get_well_known_google_credentials_file_path(void) { char* path; char* home = gpr_getenv("HOME"); path = grpc_get_well_known_google_credentials_file_path(); - GPR_ASSERT(path != NULL); + GPR_ASSERT(path != nullptr); gpr_free(path); #if defined(GPR_POSIX_ENV) || defined(GPR_LINUX_ENV) unsetenv("HOME"); path = grpc_get_well_known_google_credentials_file_path(); - GPR_ASSERT(path == NULL); + GPR_ASSERT(path == nullptr); gpr_setenv("HOME", home); gpr_free(path); #endif /* GPR_POSIX_ENV || GPR_LINUX_ENV */ @@ -1168,10 +1168,10 @@ static void test_channel_creds_duplicate_without_call_creds(void) { grpc_channel_credentials_unref(&exec_ctx, dup); grpc_call_credentials* call_creds = - grpc_access_token_credentials_create("blah", NULL); + grpc_access_token_credentials_create("blah", nullptr); grpc_channel_credentials* composite_creds = grpc_composite_channel_credentials_create(channel_creds, call_creds, - NULL); + nullptr); grpc_call_credentials_unref(&exec_ctx, call_creds); dup = grpc_channel_credentials_duplicate_without_call_credentials( composite_creds); @@ -1234,7 +1234,7 @@ static void test_auth_metadata_context(void) { grpc_slice_from_copied_string(test_cases[i].call_method); grpc_auth_metadata_context auth_md_context; memset(&auth_md_context, 0, sizeof(auth_md_context)); - grpc_auth_metadata_context_build(url_scheme, call_host, call_method, NULL, + grpc_auth_metadata_context_build(url_scheme, call_host, call_method, nullptr, &auth_md_context); if (strcmp(auth_md_context.service_url, test_cases[i].desired_service_url) != 0) { @@ -1248,7 +1248,7 @@ static void test_auth_metadata_context(void) { test_cases[i].desired_method_name, auth_md_context.method_name); GPR_ASSERT(false); } - GPR_ASSERT(auth_md_context.channel_auth_context == NULL); + GPR_ASSERT(auth_md_context.channel_auth_context == nullptr); grpc_slice_unref(call_host); grpc_slice_unref(call_method); grpc_auth_metadata_context_reset(&auth_md_context); diff --git a/test/core/security/fetch_oauth2.cc b/test/core/security/fetch_oauth2.cc index fa8036e581842..69c470641a92d 100644 --- a/test/core/security/fetch_oauth2.cc +++ b/test/core/security/fetch_oauth2.cc @@ -38,16 +38,16 @@ static grpc_call_credentials* create_refresh_token_creds( "load_file", grpc_load_file(json_refresh_token_file_path, 1, &refresh_token))); return grpc_google_refresh_token_credentials_create( - (const char*)GRPC_SLICE_START_PTR(refresh_token), NULL); + (const char*)GRPC_SLICE_START_PTR(refresh_token), nullptr); } int main(int argc, char** argv) { - grpc_call_credentials* creds = NULL; - char* json_key_file_path = NULL; - const char* json_refresh_token_file_path = NULL; - char* token = NULL; + grpc_call_credentials* creds = nullptr; + char* json_key_file_path = nullptr; + const char* json_refresh_token_file_path = nullptr; + char* token = nullptr; int use_gce = 0; - char* scope = NULL; + char* scope = nullptr; gpr_cmdline* cl = gpr_cmdline_create("fetch_oauth2"); gpr_cmdline_add_string(cl, "json_refresh_token", "File path of the json refresh token.", @@ -60,26 +60,26 @@ int main(int argc, char** argv) { grpc_init(); - if (json_key_file_path != NULL && json_refresh_token_file_path != NULL) { + if (json_key_file_path != nullptr && json_refresh_token_file_path != nullptr) { gpr_log(GPR_ERROR, "--json_key and --json_refresh_token are mutually exclusive."); exit(1); } if (use_gce) { - if (json_key_file_path != NULL || scope != NULL) { + if (json_key_file_path != nullptr || scope != nullptr) { gpr_log(GPR_INFO, "Ignoring json key and scope to get a token from the GCE " "metadata server."); } - creds = grpc_google_compute_engine_credentials_create(NULL); - if (creds == NULL) { + creds = grpc_google_compute_engine_credentials_create(nullptr); + if (creds == nullptr) { gpr_log(GPR_ERROR, "Could not create gce credentials."); exit(1); } - } else if (json_refresh_token_file_path != NULL) { + } else if (json_refresh_token_file_path != nullptr) { creds = create_refresh_token_creds(json_refresh_token_file_path); - if (creds == NULL) { + if (creds == nullptr) { gpr_log(GPR_ERROR, "Could not create refresh token creds. %s does probably not " "contain a valid json refresh token.", @@ -90,10 +90,10 @@ int main(int argc, char** argv) { gpr_log(GPR_ERROR, "Missing --gce or --json_refresh_token option."); exit(1); } - GPR_ASSERT(creds != NULL); + GPR_ASSERT(creds != nullptr); token = grpc_test_fetch_oauth2_token_with_credentials(creds); - if (token != NULL) { + if (token != nullptr) { printf("Got token: %s.\n", token); gpr_free(token); } diff --git a/test/core/security/json_token_test.cc b/test/core/security/json_token_test.cc index a06e1d05ceb9e..0dee34116958c 100644 --- a/test/core/security/json_token_test.cc +++ b/test/core/security/json_token_test.cc @@ -78,7 +78,7 @@ static const char test_scope[] = "myperm1 myperm2"; static const char test_service_url[] = "https://foo.com/foo.v1"; static char* test_json_key_str(const char* bad_part3) { - const char* part3 = bad_part3 != NULL ? bad_part3 : test_json_key_str_part3; + const char* part3 = bad_part3 != nullptr ? bad_part3 : test_json_key_str_part3; size_t result_len = strlen(test_json_key_str_part1) + strlen(test_json_key_str_part2) + strlen(part3); char* result = static_cast(gpr_malloc(result_len + 1)); @@ -92,24 +92,24 @@ static char* test_json_key_str(const char* bad_part3) { } static void test_parse_json_key_success(void) { - char* json_string = test_json_key_str(NULL); + char* json_string = test_json_key_str(nullptr); grpc_auth_json_key json_key = grpc_auth_json_key_create_from_string(json_string); GPR_ASSERT(grpc_auth_json_key_is_valid(&json_key)); - GPR_ASSERT(json_key.type != NULL && + GPR_ASSERT(json_key.type != nullptr && strcmp(json_key.type, "service_account") == 0); - GPR_ASSERT(json_key.private_key_id != NULL && + GPR_ASSERT(json_key.private_key_id != nullptr && strcmp(json_key.private_key_id, "e6b5137873db8d2ef81e06a47289e6434ec8a165") == 0); - GPR_ASSERT(json_key.client_id != NULL && + GPR_ASSERT(json_key.client_id != nullptr && strcmp(json_key.client_id, "777-abaslkan11hlb6nmim3bpspl31ud.apps." "googleusercontent.com") == 0); - GPR_ASSERT(json_key.client_email != NULL && + GPR_ASSERT(json_key.client_email != nullptr && strcmp(json_key.client_email, "777-abaslkan11hlb6nmim3bpspl31ud@developer." "gserviceaccount.com") == 0); - GPR_ASSERT(json_key.private_key != NULL); + GPR_ASSERT(json_key.private_key != nullptr); gpr_free(json_string); grpc_auth_json_key_destruct(&json_key); } @@ -230,9 +230,9 @@ static grpc_json* parse_json_part_from_jwt(const char* str, size_t len, static void check_jwt_header(grpc_json* header) { grpc_json* ptr; - grpc_json* alg = NULL; - grpc_json* typ = NULL; - grpc_json* kid = NULL; + grpc_json* alg = nullptr; + grpc_json* typ = nullptr; + grpc_json* kid = nullptr; for (ptr = header->child; ptr; ptr = ptr->next) { if (strcmp(ptr->key, "alg") == 0) { @@ -243,15 +243,15 @@ static void check_jwt_header(grpc_json* header) { kid = ptr; } } - GPR_ASSERT(alg != NULL); + GPR_ASSERT(alg != nullptr); GPR_ASSERT(alg->type == GRPC_JSON_STRING); GPR_ASSERT(strcmp(alg->value, "RS256") == 0); - GPR_ASSERT(typ != NULL); + GPR_ASSERT(typ != nullptr); GPR_ASSERT(typ->type == GRPC_JSON_STRING); GPR_ASSERT(strcmp(typ->value, "JWT") == 0); - GPR_ASSERT(kid != NULL); + GPR_ASSERT(kid != nullptr); GPR_ASSERT(kid->type == GRPC_JSON_STRING); GPR_ASSERT(strcmp(kid->value, "e6b5137873db8d2ef81e06a47289e6434ec8a165") == 0); @@ -262,12 +262,12 @@ static void check_jwt_claim(grpc_json* claim, const char* expected_audience, gpr_timespec expiration = gpr_time_0(GPR_CLOCK_REALTIME); gpr_timespec issue_time = gpr_time_0(GPR_CLOCK_REALTIME); gpr_timespec parsed_lifetime; - grpc_json* iss = NULL; - grpc_json* scope = NULL; - grpc_json* aud = NULL; - grpc_json* exp = NULL; - grpc_json* iat = NULL; - grpc_json* sub = NULL; + grpc_json* iss = nullptr; + grpc_json* scope = nullptr; + grpc_json* aud = nullptr; + grpc_json* exp = nullptr; + grpc_json* iat = nullptr; + grpc_json* sub = nullptr; grpc_json* ptr; for (ptr = claim->child; ptr; ptr = ptr->next) { @@ -286,7 +286,7 @@ static void check_jwt_claim(grpc_json* claim, const char* expected_audience, } } - GPR_ASSERT(iss != NULL); + GPR_ASSERT(iss != nullptr); GPR_ASSERT(iss->type == GRPC_JSON_STRING); GPR_ASSERT( strcmp( @@ -294,30 +294,30 @@ static void check_jwt_claim(grpc_json* claim, const char* expected_audience, "777-abaslkan11hlb6nmim3bpspl31ud@developer.gserviceaccount.com") == 0); - if (expected_scope != NULL) { - GPR_ASSERT(scope != NULL); - GPR_ASSERT(sub == NULL); + if (expected_scope != nullptr) { + GPR_ASSERT(scope != nullptr); + GPR_ASSERT(sub == nullptr); GPR_ASSERT(scope->type == GRPC_JSON_STRING); GPR_ASSERT(strcmp(scope->value, expected_scope) == 0); } else { /* Claims without scope must have a sub. */ - GPR_ASSERT(scope == NULL); - GPR_ASSERT(sub != NULL); + GPR_ASSERT(scope == nullptr); + GPR_ASSERT(sub != nullptr); GPR_ASSERT(sub->type == GRPC_JSON_STRING); GPR_ASSERT(strcmp(iss->value, sub->value) == 0); } - GPR_ASSERT(aud != NULL); + GPR_ASSERT(aud != nullptr); GPR_ASSERT(aud->type == GRPC_JSON_STRING); GPR_ASSERT(strcmp(aud->value, expected_audience) == 0); - GPR_ASSERT(exp != NULL); + GPR_ASSERT(exp != nullptr); GPR_ASSERT(exp->type == GRPC_JSON_NUMBER); - expiration.tv_sec = strtol(exp->value, NULL, 10); + expiration.tv_sec = strtol(exp->value, nullptr, 10); - GPR_ASSERT(iat != NULL); + GPR_ASSERT(iat != nullptr); GPR_ASSERT(iat->type == GRPC_JSON_NUMBER); - issue_time.tv_sec = strtol(iat->value, NULL, 10); + issue_time.tv_sec = strtol(iat->value, nullptr, 10); parsed_lifetime = gpr_time_sub(expiration, issue_time); GPR_ASSERT(parsed_lifetime.tv_sec == grpc_max_auth_token_lifetime().tv_sec); @@ -335,19 +335,19 @@ static void check_jwt_signature(const char* b64_signature, RSA* rsa_key, GPR_ASSERT(!GRPC_SLICE_IS_EMPTY(sig)); GPR_ASSERT(GRPC_SLICE_LENGTH(sig) == 128); - GPR_ASSERT(md_ctx != NULL); - GPR_ASSERT(key != NULL); + GPR_ASSERT(md_ctx != nullptr); + GPR_ASSERT(key != nullptr); EVP_PKEY_set1_RSA(key, rsa_key); - GPR_ASSERT(EVP_DigestVerifyInit(md_ctx, NULL, EVP_sha256(), NULL, key) == 1); + GPR_ASSERT(EVP_DigestVerifyInit(md_ctx, nullptr, EVP_sha256(), nullptr, key) == 1); GPR_ASSERT(EVP_DigestVerifyUpdate(md_ctx, signed_data, signed_data_size) == 1); GPR_ASSERT(EVP_DigestVerifyFinal(md_ctx, GRPC_SLICE_START_PTR(sig), GRPC_SLICE_LENGTH(sig)) == 1); grpc_slice_unref_internal(&exec_ctx, sig); - if (key != NULL) EVP_PKEY_free(key); - if (md_ctx != NULL) EVP_MD_CTX_destroy(md_ctx); + if (key != nullptr) EVP_PKEY_free(key); + if (md_ctx != nullptr) EVP_MD_CTX_destroy(md_ctx); grpc_exec_ctx_finish(&exec_ctx); } @@ -360,7 +360,7 @@ static char* service_account_creds_jwt_encode_and_sign( static char* jwt_creds_jwt_encode_and_sign(const grpc_auth_json_key* key) { return grpc_jwt_encode_and_sign(key, test_service_url, - grpc_max_auth_token_lifetime(), NULL); + grpc_max_auth_token_lifetime(), nullptr); } static void service_account_creds_check_jwt_claim(grpc_json* claim) { @@ -368,15 +368,15 @@ static void service_account_creds_check_jwt_claim(grpc_json* claim) { } static void jwt_creds_check_jwt_claim(grpc_json* claim) { - check_jwt_claim(claim, test_service_url, NULL); + check_jwt_claim(claim, test_service_url, nullptr); } static void test_jwt_encode_and_sign( char* (*jwt_encode_and_sign_func)(const grpc_auth_json_key*), void (*check_jwt_claim_func)(grpc_json*)) { - char* json_string = test_json_key_str(NULL); - grpc_json* parsed_header = NULL; - grpc_json* parsed_claim = NULL; + char* json_string = test_json_key_str(nullptr); + grpc_json* parsed_header = nullptr; + grpc_json* parsed_claim = nullptr; char* scratchpad; grpc_auth_json_key json_key = grpc_auth_json_key_create_from_string(json_string); @@ -384,27 +384,27 @@ static void test_jwt_encode_and_sign( size_t offset = 0; char* jwt = jwt_encode_and_sign_func(&json_key); const char* dot = strchr(jwt, '.'); - GPR_ASSERT(dot != NULL); + GPR_ASSERT(dot != nullptr); parsed_header = parse_json_part_from_jwt(jwt, (size_t)(dot - jwt), &scratchpad); - GPR_ASSERT(parsed_header != NULL); + GPR_ASSERT(parsed_header != nullptr); check_jwt_header(parsed_header); offset = (size_t)(dot - jwt) + 1; grpc_json_destroy(parsed_header); gpr_free(scratchpad); dot = strchr(jwt + offset, '.'); - GPR_ASSERT(dot != NULL); + GPR_ASSERT(dot != nullptr); parsed_claim = parse_json_part_from_jwt( jwt + offset, (size_t)(dot - (jwt + offset)), &scratchpad); - GPR_ASSERT(parsed_claim != NULL); + GPR_ASSERT(parsed_claim != nullptr); check_jwt_claim_func(parsed_claim); offset = (size_t)(dot - jwt) + 1; grpc_json_destroy(parsed_claim); gpr_free(scratchpad); dot = strchr(jwt + offset, '.'); - GPR_ASSERT(dot == NULL); /* no more part. */ + GPR_ASSERT(dot == nullptr); /* no more part. */ b64_signature = jwt + offset; check_jwt_signature(b64_signature, json_key.private_key, jwt, offset - 1); @@ -427,15 +427,15 @@ static void test_parse_refresh_token_success(void) { grpc_auth_refresh_token refresh_token = grpc_auth_refresh_token_create_from_string(test_refresh_token_str); GPR_ASSERT(grpc_auth_refresh_token_is_valid(&refresh_token)); - GPR_ASSERT(refresh_token.type != NULL && + GPR_ASSERT(refresh_token.type != nullptr && (strcmp(refresh_token.type, "authorized_user") == 0)); - GPR_ASSERT(refresh_token.client_id != NULL && + GPR_ASSERT(refresh_token.client_id != nullptr && (strcmp(refresh_token.client_id, "32555999999.apps.googleusercontent.com") == 0)); GPR_ASSERT( - refresh_token.client_secret != NULL && + refresh_token.client_secret != nullptr && (strcmp(refresh_token.client_secret, "EmssLNjJy1332hD4KFsecret") == 0)); - GPR_ASSERT(refresh_token.refresh_token != NULL && + GPR_ASSERT(refresh_token.refresh_token != nullptr && (strcmp(refresh_token.refresh_token, "1/Blahblasj424jladJDSGNf-u4Sua3HDA2ngjd42") == 0)); grpc_auth_refresh_token_destruct(&refresh_token); diff --git a/test/core/security/jwt_verifier_test.cc b/test/core/security/jwt_verifier_test.cc index 6858b36141db3..df0ebe56077a5 100644 --- a/test/core/security/jwt_verifier_test.cc +++ b/test/core/security/jwt_verifier_test.cc @@ -173,13 +173,13 @@ typedef struct { static void test_jwt_issuer_email_domain(void) { const char* d = grpc_jwt_issuer_email_domain("https://foo.com"); - GPR_ASSERT(d == NULL); + GPR_ASSERT(d == nullptr); d = grpc_jwt_issuer_email_domain("foo.com"); - GPR_ASSERT(d == NULL); + GPR_ASSERT(d == nullptr); d = grpc_jwt_issuer_email_domain(""); - GPR_ASSERT(d == NULL); + GPR_ASSERT(d == nullptr); d = grpc_jwt_issuer_email_domain("@"); - GPR_ASSERT(d == NULL); + GPR_ASSERT(d == nullptr); d = grpc_jwt_issuer_email_domain("bar@foo"); GPR_ASSERT(strcmp(d, "foo") == 0); d = grpc_jwt_issuer_email_domain("bar@foo.com"); @@ -196,11 +196,11 @@ static void test_jwt_issuer_email_domain(void) { d = grpc_jwt_issuer_email_domain("@foo"); GPR_ASSERT(strcmp(d, "foo") == 0); d = grpc_jwt_issuer_email_domain("bar@."); - GPR_ASSERT(d != NULL); + GPR_ASSERT(d != nullptr); d = grpc_jwt_issuer_email_domain("bar@.."); - GPR_ASSERT(d != NULL); + GPR_ASSERT(d != nullptr); d = grpc_jwt_issuer_email_domain("bar@..."); - GPR_ASSERT(d != NULL); + GPR_ASSERT(d != nullptr); } static void test_claims_success(void) { @@ -208,10 +208,10 @@ static void test_claims_success(void) { grpc_slice s = grpc_slice_from_copied_string(claims_without_time_constraint); grpc_json* json = grpc_json_parse_string_with_len( (char*)GRPC_SLICE_START_PTR(s), GRPC_SLICE_LENGTH(s)); - GPR_ASSERT(json != NULL); + GPR_ASSERT(json != nullptr); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; claims = grpc_jwt_claims_from_json(&exec_ctx, json, s); - GPR_ASSERT(claims != NULL); + GPR_ASSERT(claims != nullptr); GPR_ASSERT(grpc_jwt_claims_json(claims) == json); GPR_ASSERT(strcmp(grpc_jwt_claims_audience(claims), "https://foo.com") == 0); GPR_ASSERT(strcmp(grpc_jwt_claims_issuer(claims), "blah.foo.com") == 0); @@ -231,10 +231,10 @@ static void test_expired_claims_failure(void) { gpr_timespec exp_iat = {100, 0, GPR_CLOCK_REALTIME}; gpr_timespec exp_exp = {120, 0, GPR_CLOCK_REALTIME}; gpr_timespec exp_nbf = {60, 0, GPR_CLOCK_REALTIME}; - GPR_ASSERT(json != NULL); + GPR_ASSERT(json != nullptr); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; claims = grpc_jwt_claims_from_json(&exec_ctx, json, s); - GPR_ASSERT(claims != NULL); + GPR_ASSERT(claims != nullptr); GPR_ASSERT(grpc_jwt_claims_json(claims) == json); GPR_ASSERT(strcmp(grpc_jwt_claims_audience(claims), "https://foo.com") == 0); GPR_ASSERT(strcmp(grpc_jwt_claims_issuer(claims), "blah.foo.com") == 0); @@ -255,7 +255,7 @@ static void test_invalid_claims_failure(void) { grpc_json* json = grpc_json_parse_string_with_len( (char*)GRPC_SLICE_START_PTR(s), GRPC_SLICE_LENGTH(s)); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - GPR_ASSERT(grpc_jwt_claims_from_json(&exec_ctx, json, s) == NULL); + GPR_ASSERT(grpc_jwt_claims_from_json(&exec_ctx, json, s) == nullptr); grpc_exec_ctx_finish(&exec_ctx); } @@ -264,10 +264,10 @@ static void test_bad_audience_claims_failure(void) { grpc_slice s = grpc_slice_from_copied_string(claims_without_time_constraint); grpc_json* json = grpc_json_parse_string_with_len( (char*)GRPC_SLICE_START_PTR(s), GRPC_SLICE_LENGTH(s)); - GPR_ASSERT(json != NULL); + GPR_ASSERT(json != nullptr); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; claims = grpc_jwt_claims_from_json(&exec_ctx, json, s); - GPR_ASSERT(claims != NULL); + GPR_ASSERT(claims != nullptr); GPR_ASSERT(grpc_jwt_claims_check(claims, "https://bar.com") == GRPC_JWT_VERIFIER_BAD_AUDIENCE); grpc_jwt_claims_destroy(&exec_ctx, claims); @@ -279,10 +279,10 @@ static void test_bad_subject_claims_failure(void) { grpc_slice s = grpc_slice_from_copied_string(claims_with_bad_subject); grpc_json* json = grpc_json_parse_string_with_len( (char*)GRPC_SLICE_START_PTR(s), GRPC_SLICE_LENGTH(s)); - GPR_ASSERT(json != NULL); + GPR_ASSERT(json != nullptr); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; claims = grpc_jwt_claims_from_json(&exec_ctx, json, s); - GPR_ASSERT(claims != NULL); + GPR_ASSERT(claims != nullptr); GPR_ASSERT(grpc_jwt_claims_check(claims, "https://foo.com") == GRPC_JWT_VERIFIER_BAD_SUBJECT); grpc_jwt_claims_destroy(&exec_ctx, claims); @@ -326,7 +326,7 @@ static int httpcli_post_should_not_be_called( grpc_exec_ctx* exec_ctx, const grpc_httpcli_request* request, const char* body_bytes, size_t body_size, grpc_millis deadline, grpc_closure* on_done, grpc_httpcli_response* response) { - GPR_ASSERT("HTTP POST should not be called" == NULL); + GPR_ASSERT("HTTP POST should not be called" == nullptr); return 1; } @@ -349,7 +349,7 @@ static void on_verification_success(grpc_exec_ctx* exec_ctx, void* user_data, grpc_jwt_verifier_status status, grpc_jwt_claims* claims) { GPR_ASSERT(status == GRPC_JWT_VERIFIER_OK); - GPR_ASSERT(claims != NULL); + GPR_ASSERT(claims != nullptr); GPR_ASSERT(user_data == (void*)expected_user_data); GPR_ASSERT(strcmp(grpc_jwt_claims_audience(claims), expected_audience) == 0); grpc_jwt_claims_destroy(exec_ctx, claims); @@ -357,8 +357,8 @@ static void on_verification_success(grpc_exec_ctx* exec_ctx, void* user_data, static void test_jwt_verifier_google_email_issuer_success(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_jwt_verifier* verifier = grpc_jwt_verifier_create(NULL, 0); - char* jwt = NULL; + grpc_jwt_verifier* verifier = grpc_jwt_verifier_create(nullptr, 0); + char* jwt = nullptr; char* key_str = json_key_str(json_key_str_part3_for_google_email_issuer); grpc_auth_json_key key = grpc_auth_json_key_create_from_string(key_str); gpr_free(key_str); @@ -366,15 +366,15 @@ static void test_jwt_verifier_google_email_issuer_success(void) { grpc_httpcli_set_override(httpcli_get_google_keys_for_email, httpcli_post_should_not_be_called); jwt = grpc_jwt_encode_and_sign(&key, expected_audience, expected_lifetime, - NULL); + nullptr); grpc_auth_json_key_destruct(&key); - GPR_ASSERT(jwt != NULL); - grpc_jwt_verifier_verify(&exec_ctx, verifier, NULL, jwt, expected_audience, + GPR_ASSERT(jwt != nullptr); + grpc_jwt_verifier_verify(&exec_ctx, verifier, nullptr, jwt, expected_audience, on_verification_success, (void*)expected_user_data); grpc_jwt_verifier_destroy(&exec_ctx, verifier); grpc_exec_ctx_finish(&exec_ctx); gpr_free(jwt); - grpc_httpcli_set_override(NULL, NULL); + grpc_httpcli_set_override(nullptr, nullptr); } static int httpcli_get_custom_keys_for_email( @@ -392,7 +392,7 @@ static int httpcli_get_custom_keys_for_email( static void test_jwt_verifier_custom_email_issuer_success(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_jwt_verifier* verifier = grpc_jwt_verifier_create(&custom_mapping, 1); - char* jwt = NULL; + char* jwt = nullptr; char* key_str = json_key_str(json_key_str_part3_for_custom_email_issuer); grpc_auth_json_key key = grpc_auth_json_key_create_from_string(key_str); gpr_free(key_str); @@ -400,15 +400,15 @@ static void test_jwt_verifier_custom_email_issuer_success(void) { grpc_httpcli_set_override(httpcli_get_custom_keys_for_email, httpcli_post_should_not_be_called); jwt = grpc_jwt_encode_and_sign(&key, expected_audience, expected_lifetime, - NULL); + nullptr); grpc_auth_json_key_destruct(&key); - GPR_ASSERT(jwt != NULL); - grpc_jwt_verifier_verify(&exec_ctx, verifier, NULL, jwt, expected_audience, + GPR_ASSERT(jwt != nullptr); + grpc_jwt_verifier_verify(&exec_ctx, verifier, nullptr, jwt, expected_audience, on_verification_success, (void*)expected_user_data); grpc_jwt_verifier_destroy(&exec_ctx, verifier); grpc_exec_ctx_finish(&exec_ctx); gpr_free(jwt); - grpc_httpcli_set_override(NULL, NULL); + grpc_httpcli_set_override(nullptr, nullptr); } static int httpcli_get_jwk_set(grpc_exec_ctx* exec_ctx, @@ -440,8 +440,8 @@ static int httpcli_get_openid_config(grpc_exec_ctx* exec_ctx, static void test_jwt_verifier_url_issuer_success(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_jwt_verifier* verifier = grpc_jwt_verifier_create(NULL, 0); - char* jwt = NULL; + grpc_jwt_verifier* verifier = grpc_jwt_verifier_create(nullptr, 0); + char* jwt = nullptr; char* key_str = json_key_str(json_key_str_part3_for_url_issuer); grpc_auth_json_key key = grpc_auth_json_key_create_from_string(key_str); gpr_free(key_str); @@ -449,15 +449,15 @@ static void test_jwt_verifier_url_issuer_success(void) { grpc_httpcli_set_override(httpcli_get_openid_config, httpcli_post_should_not_be_called); jwt = grpc_jwt_encode_and_sign(&key, expected_audience, expected_lifetime, - NULL); + nullptr); grpc_auth_json_key_destruct(&key); - GPR_ASSERT(jwt != NULL); - grpc_jwt_verifier_verify(&exec_ctx, verifier, NULL, jwt, expected_audience, + GPR_ASSERT(jwt != nullptr); + grpc_jwt_verifier_verify(&exec_ctx, verifier, nullptr, jwt, expected_audience, on_verification_success, (void*)expected_user_data); grpc_jwt_verifier_destroy(&exec_ctx, verifier); grpc_exec_ctx_finish(&exec_ctx); gpr_free(jwt); - grpc_httpcli_set_override(NULL, NULL); + grpc_httpcli_set_override(nullptr, nullptr); } static void on_verification_key_retrieval_error(grpc_exec_ctx* exec_ctx, @@ -465,7 +465,7 @@ static void on_verification_key_retrieval_error(grpc_exec_ctx* exec_ctx, grpc_jwt_verifier_status status, grpc_jwt_claims* claims) { GPR_ASSERT(status == GRPC_JWT_VERIFIER_KEY_RETRIEVAL_ERROR); - GPR_ASSERT(claims == NULL); + GPR_ASSERT(claims == nullptr); GPR_ASSERT(user_data == (void*)expected_user_data); } @@ -481,8 +481,8 @@ static int httpcli_get_bad_json(grpc_exec_ctx* exec_ctx, static void test_jwt_verifier_url_issuer_bad_config(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_jwt_verifier* verifier = grpc_jwt_verifier_create(NULL, 0); - char* jwt = NULL; + grpc_jwt_verifier* verifier = grpc_jwt_verifier_create(nullptr, 0); + char* jwt = nullptr; char* key_str = json_key_str(json_key_str_part3_for_url_issuer); grpc_auth_json_key key = grpc_auth_json_key_create_from_string(key_str); gpr_free(key_str); @@ -490,22 +490,22 @@ static void test_jwt_verifier_url_issuer_bad_config(void) { grpc_httpcli_set_override(httpcli_get_bad_json, httpcli_post_should_not_be_called); jwt = grpc_jwt_encode_and_sign(&key, expected_audience, expected_lifetime, - NULL); + nullptr); grpc_auth_json_key_destruct(&key); - GPR_ASSERT(jwt != NULL); - grpc_jwt_verifier_verify(&exec_ctx, verifier, NULL, jwt, expected_audience, + GPR_ASSERT(jwt != nullptr); + grpc_jwt_verifier_verify(&exec_ctx, verifier, nullptr, jwt, expected_audience, on_verification_key_retrieval_error, (void*)expected_user_data); grpc_jwt_verifier_destroy(&exec_ctx, verifier); grpc_exec_ctx_finish(&exec_ctx); gpr_free(jwt); - grpc_httpcli_set_override(NULL, NULL); + grpc_httpcli_set_override(nullptr, nullptr); } static void test_jwt_verifier_bad_json_key(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_jwt_verifier* verifier = grpc_jwt_verifier_create(NULL, 0); - char* jwt = NULL; + grpc_jwt_verifier* verifier = grpc_jwt_verifier_create(nullptr, 0); + char* jwt = nullptr; char* key_str = json_key_str(json_key_str_part3_for_google_email_issuer); grpc_auth_json_key key = grpc_auth_json_key_create_from_string(key_str); gpr_free(key_str); @@ -513,16 +513,16 @@ static void test_jwt_verifier_bad_json_key(void) { grpc_httpcli_set_override(httpcli_get_bad_json, httpcli_post_should_not_be_called); jwt = grpc_jwt_encode_and_sign(&key, expected_audience, expected_lifetime, - NULL); + nullptr); grpc_auth_json_key_destruct(&key); - GPR_ASSERT(jwt != NULL); - grpc_jwt_verifier_verify(&exec_ctx, verifier, NULL, jwt, expected_audience, + GPR_ASSERT(jwt != nullptr); + grpc_jwt_verifier_verify(&exec_ctx, verifier, nullptr, jwt, expected_audience, on_verification_key_retrieval_error, (void*)expected_user_data); grpc_jwt_verifier_destroy(&exec_ctx, verifier); grpc_exec_ctx_finish(&exec_ctx); gpr_free(jwt); - grpc_httpcli_set_override(NULL, NULL); + grpc_httpcli_set_override(nullptr, nullptr); } static void corrupt_jwt_sig(char* jwt) { @@ -530,7 +530,7 @@ static void corrupt_jwt_sig(char* jwt) { char* bad_b64_sig; uint8_t* sig_bytes; char* last_dot = strrchr(jwt, '.'); - GPR_ASSERT(last_dot != NULL); + GPR_ASSERT(last_dot != nullptr); { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; sig = grpc_base64_decode(&exec_ctx, last_dot + 1, 1); @@ -551,14 +551,14 @@ static void on_verification_bad_signature(grpc_exec_ctx* exec_ctx, grpc_jwt_verifier_status status, grpc_jwt_claims* claims) { GPR_ASSERT(status == GRPC_JWT_VERIFIER_BAD_SIGNATURE); - GPR_ASSERT(claims == NULL); + GPR_ASSERT(claims == nullptr); GPR_ASSERT(user_data == (void*)expected_user_data); } static void test_jwt_verifier_bad_signature(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_jwt_verifier* verifier = grpc_jwt_verifier_create(NULL, 0); - char* jwt = NULL; + grpc_jwt_verifier* verifier = grpc_jwt_verifier_create(nullptr, 0); + char* jwt = nullptr; char* key_str = json_key_str(json_key_str_part3_for_url_issuer); grpc_auth_json_key key = grpc_auth_json_key_create_from_string(key_str); gpr_free(key_str); @@ -566,17 +566,17 @@ static void test_jwt_verifier_bad_signature(void) { grpc_httpcli_set_override(httpcli_get_openid_config, httpcli_post_should_not_be_called); jwt = grpc_jwt_encode_and_sign(&key, expected_audience, expected_lifetime, - NULL); + nullptr); grpc_auth_json_key_destruct(&key); corrupt_jwt_sig(jwt); - GPR_ASSERT(jwt != NULL); - grpc_jwt_verifier_verify(&exec_ctx, verifier, NULL, jwt, expected_audience, + GPR_ASSERT(jwt != nullptr); + grpc_jwt_verifier_verify(&exec_ctx, verifier, nullptr, jwt, expected_audience, on_verification_bad_signature, (void*)expected_user_data); gpr_free(jwt); grpc_jwt_verifier_destroy(&exec_ctx, verifier); grpc_exec_ctx_finish(&exec_ctx); - grpc_httpcli_set_override(NULL, NULL); + grpc_httpcli_set_override(nullptr, nullptr); } static int httpcli_get_should_not_be_called(grpc_exec_ctx* exec_ctx, @@ -592,21 +592,21 @@ static void on_verification_bad_format(grpc_exec_ctx* exec_ctx, void* user_data, grpc_jwt_verifier_status status, grpc_jwt_claims* claims) { GPR_ASSERT(status == GRPC_JWT_VERIFIER_BAD_FORMAT); - GPR_ASSERT(claims == NULL); + GPR_ASSERT(claims == nullptr); GPR_ASSERT(user_data == (void*)expected_user_data); } static void test_jwt_verifier_bad_format(void) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_jwt_verifier* verifier = grpc_jwt_verifier_create(NULL, 0); + grpc_jwt_verifier* verifier = grpc_jwt_verifier_create(nullptr, 0); grpc_httpcli_set_override(httpcli_get_should_not_be_called, httpcli_post_should_not_be_called); - grpc_jwt_verifier_verify(&exec_ctx, verifier, NULL, "bad jwt", + grpc_jwt_verifier_verify(&exec_ctx, verifier, nullptr, "bad jwt", expected_audience, on_verification_bad_format, (void*)expected_user_data); grpc_jwt_verifier_destroy(&exec_ctx, verifier); grpc_exec_ctx_finish(&exec_ctx); - grpc_httpcli_set_override(NULL, NULL); + grpc_httpcli_set_override(nullptr, nullptr); } /* find verification key: bad jks, cannot find key in jks */ diff --git a/test/core/security/oauth2_utils.cc b/test/core/security/oauth2_utils.cc index fda3d96e18be7..602041eecc3a9 100644 --- a/test/core/security/oauth2_utils.cc +++ b/test/core/security/oauth2_utils.cc @@ -42,7 +42,7 @@ typedef struct { static void on_oauth2_response(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) { oauth2_request* request = (oauth2_request*)arg; - char* token = NULL; + char* token = nullptr; grpc_slice token_slice; if (error != GRPC_ERROR_NONE) { gpr_log(GPR_ERROR, "Fetching token failed: %s", grpc_error_string(error)); @@ -61,7 +61,7 @@ static void on_oauth2_response(grpc_exec_ctx* exec_ctx, void* arg, GRPC_LOG_IF_ERROR( "pollset_kick", grpc_pollset_kick(exec_ctx, grpc_polling_entity_pollset(&request->pops), - NULL)); + nullptr)); gpr_mu_unlock(request->mu); } @@ -74,14 +74,14 @@ char* grpc_test_fetch_oauth2_token_with_credentials( memset(&request, 0, sizeof(request)); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_closure do_nothing_closure; - grpc_auth_metadata_context null_ctx = {"", "", NULL, NULL}; + grpc_auth_metadata_context null_ctx = {"", "", nullptr, nullptr}; grpc_pollset* pollset = (grpc_pollset*)gpr_zalloc(grpc_pollset_size()); grpc_pollset_init(pollset, &request.mu); request.pops = grpc_polling_entity_create_from_pollset(pollset); request.is_done = false; - GRPC_CLOSURE_INIT(&do_nothing_closure, do_nothing, NULL, + GRPC_CLOSURE_INIT(&do_nothing_closure, do_nothing, nullptr, grpc_schedule_on_exec_ctx); GRPC_CLOSURE_INIT(&request.closure, on_oauth2_response, &request, @@ -99,7 +99,7 @@ char* grpc_test_fetch_oauth2_token_with_credentials( gpr_mu_lock(request.mu); while (!request.is_done) { - grpc_pollset_worker* worker = NULL; + grpc_pollset_worker* worker = nullptr; if (!GRPC_LOG_IF_ERROR( "pollset_work", grpc_pollset_work(&exec_ctx, diff --git a/test/core/security/print_google_default_creds_token.cc b/test/core/security/print_google_default_creds_token.cc index a57180b57d95e..f4acf023bd0d6 100644 --- a/test/core/security/print_google_default_creds_token.cc +++ b/test/core/security/print_google_default_creds_token.cc @@ -58,7 +58,7 @@ static void on_metadata_response(grpc_exec_ctx* exec_ctx, void* arg, GRPC_LOG_IF_ERROR( "pollset_kick", grpc_pollset_kick(exec_ctx, grpc_polling_entity_pollset(&sync->pops), - NULL)); + nullptr)); gpr_mu_unlock(sync->mu); } @@ -66,7 +66,7 @@ int main(int argc, char** argv) { int result = 0; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; synchronizer sync; - grpc_channel_credentials* creds = NULL; + grpc_channel_credentials* creds = nullptr; const char* service_url = "https://test.foo.google.com/Foo"; grpc_auth_metadata_context context; gpr_cmdline* cl = gpr_cmdline_create("print_google_default_creds_token"); @@ -81,7 +81,7 @@ int main(int argc, char** argv) { grpc_init(); creds = grpc_google_default_credentials_create(); - if (creds == NULL) { + if (creds == nullptr) { fprintf(stderr, "\nCould not find default credentials.\n\n"); result = 1; goto end; @@ -107,7 +107,7 @@ int main(int argc, char** argv) { gpr_mu_lock(sync.mu); while (!sync.is_done) { - grpc_pollset_worker* worker = NULL; + grpc_pollset_worker* worker = nullptr; if (!GRPC_LOG_IF_ERROR( "pollset_work", grpc_pollset_work(&exec_ctx, diff --git a/test/core/security/secure_endpoint_test.cc b/test/core/security/secure_endpoint_test.cc index 11d1e5fcf48b6..2d4c6b1b887d3 100644 --- a/test/core/security/secure_endpoint_test.cc +++ b/test/core/security/secure_endpoint_test.cc @@ -40,15 +40,15 @@ static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair( bool use_zero_copy_protector) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; tsi_frame_protector* fake_read_protector = - tsi_create_fake_frame_protector(NULL); + tsi_create_fake_frame_protector(nullptr); tsi_frame_protector* fake_write_protector = - tsi_create_fake_frame_protector(NULL); + tsi_create_fake_frame_protector(nullptr); tsi_zero_copy_grpc_protector* fake_read_zero_copy_protector = - use_zero_copy_protector ? tsi_create_fake_zero_copy_grpc_protector(NULL) - : NULL; + use_zero_copy_protector ? tsi_create_fake_zero_copy_grpc_protector(nullptr) + : nullptr; tsi_zero_copy_grpc_protector* fake_write_zero_copy_protector = - use_zero_copy_protector ? tsi_create_fake_zero_copy_grpc_protector(NULL) - : NULL; + use_zero_copy_protector ? tsi_create_fake_zero_copy_grpc_protector(nullptr) + : nullptr; grpc_endpoint_test_fixture f; grpc_endpoint_pair tcp; @@ -64,7 +64,7 @@ static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair( if (leftover_nslices == 0) { f.client_ep = grpc_secure_endpoint_create(fake_read_protector, fake_read_zero_copy_protector, - tcp.client, NULL, 0); + tcp.client, nullptr, 0); } else { unsigned i; tsi_result result; @@ -114,21 +114,21 @@ static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair( f.server_ep = grpc_secure_endpoint_create(fake_write_protector, fake_write_zero_copy_protector, - tcp.server, NULL, 0); + tcp.server, nullptr, 0); grpc_exec_ctx_finish(&exec_ctx); return f; } static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair_noleftover(size_t slice_size) { - return secure_endpoint_create_fixture_tcp_socketpair(slice_size, NULL, 0, + return secure_endpoint_create_fixture_tcp_socketpair(slice_size, nullptr, 0, false); } static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair_noleftover_zero_copy( size_t slice_size) { - return secure_endpoint_create_fixture_tcp_socketpair(slice_size, NULL, 0, + return secure_endpoint_create_fixture_tcp_socketpair(slice_size, nullptr, 0, true); } diff --git a/test/core/security/security_connector_test.cc b/test/core/security/security_connector_test.cc index a0c1e93532b24..9a68e176dbc3a 100644 --- a/test/core/security/security_connector_test.cc +++ b/test/core/security/security_connector_test.cc @@ -39,13 +39,13 @@ static int check_transport_security_type(const grpc_auth_context* ctx) { grpc_auth_property_iterator it = grpc_auth_context_find_properties_by_name( ctx, GRPC_TRANSPORT_SECURITY_TYPE_PROPERTY_NAME); const grpc_auth_property* prop = grpc_auth_property_iterator_next(&it); - if (prop == NULL) return 0; + if (prop == nullptr) return 0; if (strncmp(prop->value, GRPC_SSL_TRANSPORT_SECURITY_TYPE, prop->value_length) != 0) { return 0; } /* Check that we have only one property with this name. */ - if (grpc_auth_property_iterator_next(&it) != NULL) return 0; + if (grpc_auth_property_iterator_next(&it) != nullptr) return 0; return 1; } @@ -89,7 +89,7 @@ static void test_unauthenticated_ssl_peer(void) { TSI_CERTIFICATE_TYPE_PEER_PROPERTY, TSI_X509_CERTIFICATE_TYPE, &peer.properties[0]) == TSI_OK); ctx = tsi_ssl_peer_to_auth_context(&peer); - GPR_ASSERT(ctx != NULL); + GPR_ASSERT(ctx != nullptr); GPR_ASSERT(!grpc_auth_context_peer_is_authenticated(ctx)); GPR_ASSERT(check_transport_security_type(ctx)); @@ -112,7 +112,7 @@ static int check_identity(const grpc_auth_context* ctx, it = grpc_auth_context_peer_identity(ctx); for (i = 0; i < num_identities; i++) { prop = grpc_auth_property_iterator_next(&it); - if (prop == NULL) { + if (prop == nullptr) { gpr_log(GPR_ERROR, "Expected identity value %s not found.", expected_identities[i]); return 0; @@ -136,7 +136,7 @@ static int check_x509_cn(const grpc_auth_context* ctx, grpc_auth_property_iterator it = grpc_auth_context_find_properties_by_name( ctx, GRPC_X509_CN_PROPERTY_NAME); const grpc_auth_property* prop = grpc_auth_property_iterator_next(&it); - if (prop == NULL) { + if (prop == nullptr) { gpr_log(GPR_ERROR, "CN property not found."); return 0; } @@ -144,7 +144,7 @@ static int check_x509_cn(const grpc_auth_context* ctx, gpr_log(GPR_ERROR, "Expected CN %s and got %s", expected_cn, prop->value); return 0; } - if (grpc_auth_property_iterator_next(&it) != NULL) { + if (grpc_auth_property_iterator_next(&it) != nullptr) { gpr_log(GPR_ERROR, "Expected only one property for CN."); return 0; } @@ -156,7 +156,7 @@ static int check_x509_pem_cert(const grpc_auth_context* ctx, grpc_auth_property_iterator it = grpc_auth_context_find_properties_by_name( ctx, GRPC_X509_PEM_CERT_PROPERTY_NAME); const grpc_auth_property* prop = grpc_auth_property_iterator_next(&it); - if (prop == NULL) { + if (prop == nullptr) { gpr_log(GPR_ERROR, "Pem certificate property not found."); return 0; } @@ -165,7 +165,7 @@ static int check_x509_pem_cert(const grpc_auth_context* ctx, prop->value); return 0; } - if (grpc_auth_property_iterator_next(&it) != NULL) { + if (grpc_auth_property_iterator_next(&it) != nullptr) { gpr_log(GPR_ERROR, "Expected only one property for pem cert."); return 0; } @@ -189,7 +189,7 @@ static void test_cn_only_ssl_peer_to_auth_context(void) { TSI_X509_PEM_CERT_PROPERTY, expected_pem_cert, &peer.properties[2]) == TSI_OK); ctx = tsi_ssl_peer_to_auth_context(&peer); - GPR_ASSERT(ctx != NULL); + GPR_ASSERT(ctx != nullptr); GPR_ASSERT(grpc_auth_context_peer_is_authenticated(ctx)); GPR_ASSERT(check_identity(ctx, GRPC_X509_CN_PROPERTY_NAME, &expected_cn, 1)); GPR_ASSERT(check_transport_security_type(ctx)); @@ -225,7 +225,7 @@ static void test_cn_and_one_san_ssl_peer_to_auth_context(void) { TSI_X509_PEM_CERT_PROPERTY, expected_pem_cert, &peer.properties[3]) == TSI_OK); ctx = tsi_ssl_peer_to_auth_context(&peer); - GPR_ASSERT(ctx != NULL); + GPR_ASSERT(ctx != nullptr); GPR_ASSERT(grpc_auth_context_peer_is_authenticated(ctx)); GPR_ASSERT( check_identity(ctx, GRPC_X509_SAN_PROPERTY_NAME, &expected_san, 1)); @@ -266,7 +266,7 @@ static void test_cn_and_multiple_sans_ssl_peer_to_auth_context(void) { expected_sans[i], &peer.properties[3 + i]) == TSI_OK); } ctx = tsi_ssl_peer_to_auth_context(&peer); - GPR_ASSERT(ctx != NULL); + GPR_ASSERT(ctx != nullptr); GPR_ASSERT(grpc_auth_context_peer_is_authenticated(ctx)); GPR_ASSERT(check_identity(ctx, GRPC_X509_SAN_PROPERTY_NAME, expected_sans, GPR_ARRAY_SIZE(expected_sans))); @@ -312,7 +312,7 @@ static void test_cn_and_multiple_sans_and_others_ssl_peer_to_auth_context( expected_sans[i], &peer.properties[5 + i]) == TSI_OK); } ctx = tsi_ssl_peer_to_auth_context(&peer); - GPR_ASSERT(ctx != NULL); + GPR_ASSERT(ctx != nullptr); GPR_ASSERT(grpc_auth_context_peer_is_authenticated(ctx)); GPR_ASSERT(check_identity(ctx, GRPC_X509_SAN_PROPERTY_NAME, expected_sans, GPR_ARRAY_SIZE(expected_sans))); diff --git a/test/core/security/ssl_credentials_test.cc b/test/core/security/ssl_credentials_test.cc index 76ee32b001936..9edcf42d3a4f3 100644 --- a/test/core/security/ssl_credentials_test.cc +++ b/test/core/security/ssl_credentials_test.cc @@ -36,14 +36,14 @@ static void test_convert_grpc_to_tsi_cert_pairs() { { tsi_ssl_pem_key_cert_pair* tsi_pairs = grpc_convert_grpc_to_tsi_cert_pairs(grpc_pairs, 0); - GPR_ASSERT(tsi_pairs == NULL); + GPR_ASSERT(tsi_pairs == nullptr); } { tsi_ssl_pem_key_cert_pair* tsi_pairs = grpc_convert_grpc_to_tsi_cert_pairs(grpc_pairs, num_pairs); - GPR_ASSERT(tsi_pairs != NULL); + GPR_ASSERT(tsi_pairs != nullptr); for (size_t i = 0; i < num_pairs; i++) { GPR_ASSERT(strncmp(grpc_pairs[i].private_key, tsi_pairs[i].private_key, strlen(grpc_pairs[i].private_key)) == 0); diff --git a/test/core/security/ssl_server_fuzzer.cc b/test/core/security/ssl_server_fuzzer.cc index 5c5153b505dac..bbb2f6013eea6 100644 --- a/test/core/security/ssl_server_fuzzer.cc +++ b/test/core/security/ssl_server_fuzzer.cc @@ -78,10 +78,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { pem_key_cert_pair.private_key = (const char*)GRPC_SLICE_START_PTR(key_slice); pem_key_cert_pair.cert_chain = (const char*)GRPC_SLICE_START_PTR(cert_slice); grpc_server_credentials* creds = grpc_ssl_server_credentials_create( - ca_cert, &pem_key_cert_pair, 1, 0, NULL); + ca_cert, &pem_key_cert_pair, 1, 0, nullptr); // Create security connector - grpc_server_security_connector* sc = NULL; + grpc_server_security_connector* sc = nullptr; grpc_security_status status = grpc_server_credentials_create_security_connector(&exec_ctx, creds, &sc); GPR_ASSERT(status == GRPC_SECURITY_OK); @@ -92,8 +92,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { grpc_handshake_manager* handshake_mgr = grpc_handshake_manager_create(); grpc_server_security_connector_add_handshakers(&exec_ctx, sc, handshake_mgr); grpc_handshake_manager_do_handshake( - &exec_ctx, handshake_mgr, mock_endpoint, NULL /* channel_args */, - deadline, NULL /* acceptor */, on_handshake_done, &state); + &exec_ctx, handshake_mgr, mock_endpoint, nullptr /* channel_args */, + deadline, nullptr /* acceptor */, on_handshake_done, &state); grpc_exec_ctx_flush(&exec_ctx); // If the given string happens to be part of the correct client hello, the diff --git a/test/core/security/verify_jwt.cc b/test/core/security/verify_jwt.cc index e0e22d16f98ad..787d58bc377d9 100644 --- a/test/core/security/verify_jwt.cc +++ b/test/core/security/verify_jwt.cc @@ -52,14 +52,14 @@ static void on_jwt_verification_done(grpc_exec_ctx* exec_ctx, void* user_data, sync->success = (status == GRPC_JWT_VERIFIER_OK); if (sync->success) { char* claims_str; - GPR_ASSERT(claims != NULL); + GPR_ASSERT(claims != nullptr); claims_str = grpc_json_dump_to_string((grpc_json*)grpc_jwt_claims_json(claims), 2); printf("Claims: \n\n%s\n", claims_str); gpr_free(claims_str); grpc_jwt_claims_destroy(exec_ctx, claims); } else { - GPR_ASSERT(claims == NULL); + GPR_ASSERT(claims == nullptr); fprintf(stderr, "Verification failed with error %s\n", grpc_jwt_verifier_status_to_string(status)); } @@ -67,7 +67,7 @@ static void on_jwt_verification_done(grpc_exec_ctx* exec_ctx, void* user_data, gpr_mu_lock(sync->mu); sync->is_done = 1; GRPC_LOG_IF_ERROR("pollset_kick", - grpc_pollset_kick(exec_ctx, sync->pollset, NULL)); + grpc_pollset_kick(exec_ctx, sync->pollset, nullptr)); gpr_mu_unlock(sync->mu); } @@ -75,8 +75,8 @@ int main(int argc, char** argv) { synchronizer sync; grpc_jwt_verifier* verifier; gpr_cmdline* cl; - const char* jwt = NULL; - const char* aud = NULL; + const char* jwt = nullptr; + const char* aud = nullptr; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_init(); @@ -84,11 +84,11 @@ int main(int argc, char** argv) { gpr_cmdline_add_string(cl, "jwt", "JSON web token to verify", &jwt); gpr_cmdline_add_string(cl, "aud", "Audience for the JWT", &aud); gpr_cmdline_parse(cl, argc, argv); - if (jwt == NULL || aud == NULL) { + if (jwt == nullptr || aud == nullptr) { print_usage_and_exit(cl, argv[0]); } - verifier = grpc_jwt_verifier_create(NULL, 0); + verifier = grpc_jwt_verifier_create(nullptr, 0); grpc_init(); @@ -101,7 +101,7 @@ int main(int argc, char** argv) { gpr_mu_lock(sync.mu); while (!sync.is_done) { - grpc_pollset_worker* worker = NULL; + grpc_pollset_worker* worker = nullptr; if (!GRPC_LOG_IF_ERROR("pollset_work", grpc_pollset_work(&exec_ctx, sync.pollset, &worker, GRPC_MILLIS_INF_FUTURE))) diff --git a/test/core/slice/slice_hash_table_test.cc b/test/core/slice/slice_hash_table_test.cc index a2006b3c100cd..0ee4e8617d2a2 100644 --- a/test/core/slice/slice_hash_table_test.cc +++ b/test/core/slice/slice_hash_table_test.cc @@ -46,7 +46,7 @@ static void check_values(const test_entry* input, size_t num_entries, grpc_slice key = grpc_slice_from_static_string(input[i].key); const char* actual = static_cast(grpc_slice_hash_table_get(table, key)); - GPR_ASSERT(actual != NULL); + GPR_ASSERT(actual != nullptr); GPR_ASSERT(strcmp(actual, input[i].value) == 0); grpc_slice_unref(key); } @@ -55,7 +55,7 @@ static void check_values(const test_entry* input, size_t num_entries, static void check_non_existent_value(const char* key_string, grpc_slice_hash_table* table) { grpc_slice key = grpc_slice_from_static_string(key_string); - GPR_ASSERT(grpc_slice_hash_table_get(table, key) == NULL); + GPR_ASSERT(grpc_slice_hash_table_get(table, key) == nullptr); grpc_slice_unref(key); } @@ -116,7 +116,7 @@ static void test_slice_hash_table() { }; const size_t num_entries = GPR_ARRAY_SIZE(test_entries); grpc_slice_hash_table* table = - create_table_from_entries(test_entries, num_entries, NULL); + create_table_from_entries(test_entries, num_entries, nullptr); // Check contents of table. check_values(test_entries, num_entries, table); check_non_existent_value("XX", table); diff --git a/test/core/slice/slice_test.cc b/test/core/slice/slice_test.cc index aec5636376fcc..02f6b1ea79cfe 100644 --- a/test/core/slice/slice_test.cc +++ b/test/core/slice/slice_test.cc @@ -50,10 +50,10 @@ static void test_slice_malloc_returns_something_sensible(void) { GPR_ASSERT(GRPC_SLICE_LENGTH(slice) == length); /* If the slice has a refcount, it must be destroyable. */ if (slice.refcount) { - GPR_ASSERT(slice.refcount->vtable != NULL); - GPR_ASSERT(slice.refcount->vtable->ref != NULL); - GPR_ASSERT(slice.refcount->vtable->unref != NULL); - GPR_ASSERT(slice.refcount->vtable->hash != NULL); + GPR_ASSERT(slice.refcount->vtable != nullptr); + GPR_ASSERT(slice.refcount->vtable->ref != nullptr); + GPR_ASSERT(slice.refcount->vtable->unref != nullptr); + GPR_ASSERT(slice.refcount->vtable->hash != nullptr); } /* We must be able to write to every byte of the data */ for (i = 0; i < length; i++) { diff --git a/test/core/statistics/census_log_tests.cc b/test/core/statistics/census_log_tests.cc deleted file mode 100644 index e6eda5486cfb8..0000000000000 --- a/test/core/statistics/census_log_tests.cc +++ /dev/null @@ -1,576 +0,0 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "src/core/ext/census/census_log.h" -#include "test/core/util/test_config.h" - -/* Fills in 'record' of size 'size'. Each byte in record is filled in with the - same value. The value is extracted from 'record' pointer. */ -static void write_record(char* record, size_t size) { - char data = (uintptr_t)record % 255; - memset(record, data, size); -} - -/* Reads fixed size records. Returns the number of records read in - 'num_records'. */ -static void read_records(size_t record_size, const char* buffer, - size_t buffer_size, int32_t* num_records) { - int32_t ix; - GPR_ASSERT(buffer_size >= record_size); - GPR_ASSERT(buffer_size % record_size == 0); - *num_records = buffer_size / record_size; - for (ix = 0; ix < *num_records; ++ix) { - size_t jx; - const char* record = buffer + (record_size * ix); - char data = (uintptr_t)record % 255; - for (jx = 0; jx < record_size; ++jx) { - GPR_ASSERT(data == record[jx]); - } - } -} - -/* Tries to write the specified number of records. Stops when the log gets - full. Returns the number of records written. Spins for random - number of times, up to 'max_spin_count', between writes. */ -static size_t write_records_to_log(int writer_id, int32_t record_size, - int32_t num_records, - int32_t max_spin_count) { - int32_t ix; - int counter = 0; - for (ix = 0; ix < num_records; ++ix) { - int32_t jx; - int32_t spin_count = max_spin_count ? rand() % max_spin_count : 0; - char* record; - if (counter++ == num_records / 10) { - printf(" Writer %d: %d out of %d written\n", writer_id, ix, - num_records); - counter = 0; - } - record = (char*)(census_log_start_write(record_size)); - if (record == NULL) { - return ix; - } - write_record(record, record_size); - census_log_end_write(record, record_size); - for (jx = 0; jx < spin_count; ++jx) { - GPR_ASSERT(jx >= 0); - } - } - return num_records; -} - -/* Performs a single read iteration. Returns the number of records read. */ -static size_t perform_read_iteration(size_t record_size) { - const void* read_buffer = NULL; - size_t bytes_available; - size_t records_read = 0; - census_log_init_reader(); - while ((read_buffer = census_log_read_next(&bytes_available))) { - int32_t num_records = 0; - read_records(record_size, (const char*)read_buffer, bytes_available, - &num_records); - records_read += num_records; - } - return records_read; -} - -/* Asserts that the log is empty. */ -static void assert_log_empty(void) { - size_t bytes_available; - census_log_init_reader(); - GPR_ASSERT(census_log_read_next(&bytes_available) == NULL); -} - -/* Given log size and record size, computes the minimum usable space. */ -static int32_t min_usable_space(size_t log_size, size_t record_size) { - int32_t usable_space; - int32_t num_blocks = - GPR_MAX(log_size / CENSUS_LOG_MAX_RECORD_SIZE, gpr_cpu_num_cores()); - int32_t waste_per_block = CENSUS_LOG_MAX_RECORD_SIZE % record_size; - /* In the worst case, all except one core-local block is full. */ - int32_t num_full_blocks = num_blocks - 1; - usable_space = (int32_t)log_size - - (num_full_blocks * CENSUS_LOG_MAX_RECORD_SIZE) - - ((num_blocks - num_full_blocks) * waste_per_block); - GPR_ASSERT(usable_space > 0); - return usable_space; -} - -/* Fills the log and verifies data. If 'no fragmentation' is true, records - are sized such that CENSUS_LOG_2_MAX_RECORD_SIZE is a multiple of record - size. If not a circular log, verifies that the number of records written - match the number of records read. */ -static void fill_log(size_t log_size, int no_fragmentation, int circular_log) { - int size; - int32_t records_written; - int32_t usable_space; - int32_t records_read; - if (no_fragmentation) { - int log2size = rand() % (CENSUS_LOG_2_MAX_RECORD_SIZE + 1); - size = (1 << log2size); - } else { - while (1) { - size = 1 + (rand() % CENSUS_LOG_MAX_RECORD_SIZE); - if (CENSUS_LOG_MAX_RECORD_SIZE % size) { - break; - } - } - } - printf(" Fill record size: %d\n", size); - records_written = write_records_to_log( - 0 /* writer id */, size, (log_size / size) * 2, 0 /* spin count */); - usable_space = min_usable_space(log_size, size); - GPR_ASSERT(records_written * size >= usable_space); - records_read = perform_read_iteration(size); - if (!circular_log) { - GPR_ASSERT(records_written == records_read); - } - assert_log_empty(); -} - -/* Structure to pass args to writer_thread */ -typedef struct writer_thread_args { - /* Index of this thread in the writers vector. */ - int index; - /* Record size. */ - size_t record_size; - /* Number of records to write. */ - int32_t num_records; - /* Used to signal when writer is complete */ - gpr_cv* done; - gpr_mu* mu; - int* count; -} writer_thread_args; - -/* Writes the given number of records of random size (up to kMaxRecordSize) and - random data to the specified log. */ -static void writer_thread(void* arg) { - writer_thread_args* args = (writer_thread_args*)arg; - /* Maximum number of times to spin between writes. */ - static const int32_t MAX_SPIN_COUNT = 50; - int records_written = 0; - printf(" Writer: %d\n", args->index); - while (records_written < args->num_records) { - records_written += write_records_to_log(args->index, args->record_size, - args->num_records - records_written, - MAX_SPIN_COUNT); - if (records_written < args->num_records) { - /* Ran out of log space. Sleep for a bit and let the reader catch up. - This should never happen for circular logs. */ - printf(" Writer stalled due to out-of-space: %d out of %d written\n", - records_written, args->num_records); - gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(10)); - } - } - /* Done. Decrement count and signal. */ - gpr_mu_lock(args->mu); - (*args->count)--; - gpr_cv_broadcast(args->done); - printf(" Writer done: %d\n", args->index); - gpr_mu_unlock(args->mu); -} - -/* struct to pass args to reader_thread */ -typedef struct reader_thread_args { - /* Record size. */ - size_t record_size; - /* Interval between read iterations. */ - int32_t read_iteration_interval_in_msec; - /* Total number of records. */ - int32_t total_records; - /* Signalled when reader should stop. */ - gpr_cv stop; - int stop_flag; - /* Used to signal when reader has finished */ - gpr_cv* done; - gpr_mu* mu; - int running; -} reader_thread_args; - -/* Reads and verifies the specified number of records. Reader can also be - stopped via gpr_cv_signal(&args->stop). Sleeps for 'read_interval_in_msec' - between read iterations. */ -static void reader_thread(void* arg) { - int32_t records_read = 0; - reader_thread_args* args = (reader_thread_args*)arg; - int32_t num_iterations = 0; - gpr_timespec interval; - int counter = 0; - printf(" Reader starting\n"); - interval = gpr_time_from_micros( - (int64_t)args->read_iteration_interval_in_msec * 1000, GPR_TIMESPAN); - gpr_mu_lock(args->mu); - while (!args->stop_flag && records_read < args->total_records) { - gpr_cv_wait(&args->stop, args->mu, interval); - if (!args->stop_flag) { - records_read += perform_read_iteration(args->record_size); - GPR_ASSERT(records_read <= args->total_records); - if (counter++ == 100000) { - printf(" Reader: %d out of %d read\n", records_read, - args->total_records); - counter = 0; - } - ++num_iterations; - } - } - /* Done */ - args->running = 0; - gpr_cv_broadcast(args->done); - printf(" Reader: records: %d, iterations: %d\n", records_read, - num_iterations); - gpr_mu_unlock(args->mu); -} - -/* Creates NUM_WRITERS writers where each writer writes NUM_RECORDS_PER_WRITER - records. Also, starts a reader that iterates over and reads blocks every - READ_ITERATION_INTERVAL_IN_MSEC. */ -/* Number of writers. */ -#define NUM_WRITERS 5 -static void multiple_writers_single_reader(int circular_log) { - /* Sleep interval between read iterations. */ - static const int32_t READ_ITERATION_INTERVAL_IN_MSEC = 10; - /* Number of records written by each writer. */ - static const int32_t NUM_RECORDS_PER_WRITER = 10 * 1024 * 1024; - /* Maximum record size. */ - static const size_t MAX_RECORD_SIZE = 10; - int ix; - gpr_thd_id id; - gpr_cv writers_done; - int writers_count = NUM_WRITERS; - gpr_mu writers_mu; /* protects writers_done and writers_count */ - writer_thread_args writers[NUM_WRITERS]; - gpr_cv reader_done; - gpr_mu reader_mu; /* protects reader_done and reader.running */ - reader_thread_args reader; - int32_t record_size = 1 + rand() % MAX_RECORD_SIZE; - printf(" Record size: %d\n", record_size); - /* Create and start writers. */ - gpr_cv_init(&writers_done); - gpr_mu_init(&writers_mu); - for (ix = 0; ix < NUM_WRITERS; ++ix) { - writers[ix].index = ix; - writers[ix].record_size = record_size; - writers[ix].num_records = NUM_RECORDS_PER_WRITER; - writers[ix].done = &writers_done; - writers[ix].count = &writers_count; - writers[ix].mu = &writers_mu; - gpr_thd_new(&id, &writer_thread, &writers[ix], NULL); - } - /* Start reader. */ - reader.record_size = record_size; - reader.read_iteration_interval_in_msec = READ_ITERATION_INTERVAL_IN_MSEC; - reader.total_records = NUM_WRITERS * NUM_RECORDS_PER_WRITER; - reader.stop_flag = 0; - gpr_cv_init(&reader.stop); - gpr_cv_init(&reader_done); - reader.done = &reader_done; - gpr_mu_init(&reader_mu); - reader.mu = &reader_mu; - reader.running = 1; - gpr_thd_new(&id, &reader_thread, &reader, NULL); - /* Wait for writers to finish. */ - gpr_mu_lock(&writers_mu); - while (writers_count != 0) { - gpr_cv_wait(&writers_done, &writers_mu, gpr_inf_future(GPR_CLOCK_REALTIME)); - } - gpr_mu_unlock(&writers_mu); - gpr_mu_destroy(&writers_mu); - gpr_cv_destroy(&writers_done); - gpr_mu_lock(&reader_mu); - if (circular_log) { - /* Stop reader. */ - reader.stop_flag = 1; - gpr_cv_signal(&reader.stop); - } - /* wait for reader to finish */ - while (reader.running) { - gpr_cv_wait(&reader_done, &reader_mu, gpr_inf_future(GPR_CLOCK_REALTIME)); - } - if (circular_log) { - /* Assert that there were no out-of-space errors. */ - GPR_ASSERT(0 == census_log_out_of_space_count()); - } - gpr_mu_unlock(&reader_mu); - gpr_mu_destroy(&reader_mu); - gpr_cv_destroy(&reader_done); - printf(" Reader: finished\n"); -} - -/* Log sizes to use for all tests. */ -#define LOG_SIZE_IN_MB 1 -#define LOG_SIZE_IN_BYTES (LOG_SIZE_IN_MB << 20) - -static void setup_test(int circular_log) { - census_log_initialize(LOG_SIZE_IN_MB, circular_log); - GPR_ASSERT(census_log_remaining_space() == LOG_SIZE_IN_BYTES); -} - -/* Attempts to create a record of invalid size (size > - CENSUS_LOG_MAX_RECORD_SIZE). */ -void test_invalid_record_size(void) { - static const size_t INVALID_SIZE = CENSUS_LOG_MAX_RECORD_SIZE + 1; - static const size_t VALID_SIZE = 1; - void* record; - printf("Starting test: invalid record size\n"); - setup_test(0); - record = census_log_start_write(INVALID_SIZE); - GPR_ASSERT(record == NULL); - /* Now try writing a valid record. */ - record = census_log_start_write(VALID_SIZE); - GPR_ASSERT(record != NULL); - census_log_end_write(record, VALID_SIZE); - /* Verifies that available space went down by one block. In theory, this - check can fail if the thread is context switched to a new CPU during the - start_write execution (multiple blocks get allocated), but this has not - been observed in practice. */ - GPR_ASSERT(LOG_SIZE_IN_BYTES - CENSUS_LOG_MAX_RECORD_SIZE == - census_log_remaining_space()); - census_log_shutdown(); -} - -/* Tests end_write() with a different size than what was specified in - start_write(). */ -void test_end_write_with_different_size(void) { - static const size_t START_WRITE_SIZE = 10; - static const size_t END_WRITE_SIZE = 7; - void* record_written; - const void* record_read; - size_t bytes_available; - printf("Starting test: end write with different size\n"); - setup_test(0); - record_written = census_log_start_write(START_WRITE_SIZE); - GPR_ASSERT(record_written != NULL); - census_log_end_write(record_written, END_WRITE_SIZE); - census_log_init_reader(); - record_read = census_log_read_next(&bytes_available); - GPR_ASSERT(record_written == record_read); - GPR_ASSERT(END_WRITE_SIZE == bytes_available); - assert_log_empty(); - census_log_shutdown(); -} - -/* Verifies that pending records are not available via read_next(). */ -void test_read_pending_record(void) { - static const size_t PR_RECORD_SIZE = 1024; - size_t bytes_available; - const void* record_read; - void* record_written; - printf("Starting test: read pending record\n"); - setup_test(0); - /* Start a write. */ - record_written = census_log_start_write(PR_RECORD_SIZE); - GPR_ASSERT(record_written != NULL); - /* As write is pending, read should fail. */ - census_log_init_reader(); - record_read = census_log_read_next(&bytes_available); - GPR_ASSERT(record_read == NULL); - /* A read followed by end_write() should succeed. */ - census_log_end_write(record_written, PR_RECORD_SIZE); - census_log_init_reader(); - record_read = census_log_read_next(&bytes_available); - GPR_ASSERT(record_written == record_read); - GPR_ASSERT(PR_RECORD_SIZE == bytes_available); - assert_log_empty(); - census_log_shutdown(); -} - -/* Tries reading beyond pending write. */ -void test_read_beyond_pending_record(void) { - /* Start a write. */ - uint32_t incomplete_record_size = 10; - uint32_t complete_record_size = 20; - size_t bytes_available; - void* complete_record; - const void* record_read; - void* incomplete_record; - printf("Starting test: read beyond pending record\n"); - setup_test(0); - incomplete_record = census_log_start_write(incomplete_record_size); - GPR_ASSERT(incomplete_record != NULL); - complete_record = census_log_start_write(complete_record_size); - GPR_ASSERT(complete_record != NULL); - GPR_ASSERT(complete_record != incomplete_record); - census_log_end_write(complete_record, complete_record_size); - /* Now iterate over blocks to read completed records. */ - census_log_init_reader(); - record_read = census_log_read_next(&bytes_available); - GPR_ASSERT(complete_record == record_read); - GPR_ASSERT(complete_record_size == bytes_available); - /* Complete first record. */ - census_log_end_write(incomplete_record, incomplete_record_size); - /* Have read past the incomplete record, so read_next() should return NULL. */ - /* NB: this test also assumes our thread did not get switched to a different - CPU between the two start_write calls */ - record_read = census_log_read_next(&bytes_available); - GPR_ASSERT(record_read == NULL); - /* Reset reader to get the newly completed record. */ - census_log_init_reader(); - record_read = census_log_read_next(&bytes_available); - GPR_ASSERT(incomplete_record == record_read); - GPR_ASSERT(incomplete_record_size == bytes_available); - assert_log_empty(); - census_log_shutdown(); -} - -/* Tests scenario where block being read is detached from a core and put on the - dirty list. */ -void test_detached_while_reading(void) { - static const size_t DWR_RECORD_SIZE = 10; - size_t bytes_available; - const void* record_read; - void* record_written; - uint32_t block_read = 0; - printf("Starting test: detached while reading\n"); - setup_test(0); - /* Start a write. */ - record_written = census_log_start_write(DWR_RECORD_SIZE); - GPR_ASSERT(record_written != NULL); - census_log_end_write(record_written, DWR_RECORD_SIZE); - /* Read this record. */ - census_log_init_reader(); - record_read = census_log_read_next(&bytes_available); - GPR_ASSERT(record_read != NULL); - GPR_ASSERT(DWR_RECORD_SIZE == bytes_available); - /* Now fill the log. This will move the block being read from core-local - array to the dirty list. */ - while ((record_written = census_log_start_write(DWR_RECORD_SIZE))) { - census_log_end_write(record_written, DWR_RECORD_SIZE); - } - - /* In this iteration, read_next() should only traverse blocks in the - core-local array. Therefore, we expect at most gpr_cpu_num_cores() more - blocks. As log is full, if read_next() is traversing the dirty list, we - will get more than gpr_cpu_num_cores() blocks. */ - while ((record_read = census_log_read_next(&bytes_available))) { - ++block_read; - GPR_ASSERT(block_read <= gpr_cpu_num_cores()); - } - census_log_shutdown(); -} - -/* Fills non-circular log with records sized such that size is a multiple of - CENSUS_LOG_MAX_RECORD_SIZE (no per-block fragmentation). */ -void test_fill_log_no_fragmentation(void) { - const int circular = 0; - printf("Starting test: fill log no fragmentation\n"); - setup_test(circular); - fill_log(LOG_SIZE_IN_BYTES, 1 /* no fragmentation */, circular); - census_log_shutdown(); -} - -/* Fills circular log with records sized such that size is a multiple of - CENSUS_LOG_MAX_RECORD_SIZE (no per-block fragmentation). */ -void test_fill_circular_log_no_fragmentation(void) { - const int circular = 1; - printf("Starting test: fill circular log no fragmentation\n"); - setup_test(circular); - fill_log(LOG_SIZE_IN_BYTES, 1 /* no fragmentation */, circular); - census_log_shutdown(); -} - -/* Fills non-circular log with records that may straddle end of a block. */ -void test_fill_log_with_straddling_records(void) { - const int circular = 0; - printf("Starting test: fill log with straddling records\n"); - setup_test(circular); - fill_log(LOG_SIZE_IN_BYTES, 0 /* block straddling records */, circular); - census_log_shutdown(); -} - -/* Fills circular log with records that may straddle end of a block. */ -void test_fill_circular_log_with_straddling_records(void) { - const int circular = 1; - printf("Starting test: fill circular log with straddling records\n"); - setup_test(circular); - fill_log(LOG_SIZE_IN_BYTES, 0 /* block straddling records */, circular); - census_log_shutdown(); -} - -/* Tests scenario where multiple writers and a single reader are using a log - that is configured to discard old records. */ -void test_multiple_writers_circular_log(void) { - const int circular = 1; - printf("Starting test: multiple writers circular log\n"); - setup_test(circular); - multiple_writers_single_reader(circular); - census_log_shutdown(); -} - -/* Tests scenario where multiple writers and a single reader are using a log - that is configured to discard old records. */ -void test_multiple_writers(void) { - const int circular = 0; - printf("Starting test: multiple writers\n"); - setup_test(circular); - multiple_writers_single_reader(circular); - census_log_shutdown(); -} - -/* Repeat the straddling records and multiple writers tests with a small log. */ -void test_small_log(void) { - size_t log_size; - const int circular = 0; - printf("Starting test: small log\n"); - census_log_initialize(0, circular); - log_size = census_log_remaining_space(); - GPR_ASSERT(log_size > 0); - fill_log(log_size, 0, circular); - census_log_shutdown(); - census_log_initialize(0, circular); - multiple_writers_single_reader(circular); - census_log_shutdown(); -} - -void test_performance(void) { - int write_size = 1; - for (; write_size < CENSUS_LOG_MAX_RECORD_SIZE; write_size *= 2) { - gpr_timespec write_time; - gpr_timespec start_time; - double write_time_micro = 0.0; - int nrecords = 0; - setup_test(0); - start_time = gpr_now(GPR_CLOCK_REALTIME); - while (1) { - void* record = census_log_start_write(write_size); - if (record == NULL) { - break; - } - census_log_end_write(record, write_size); - nrecords++; - } - write_time = gpr_time_sub(gpr_now(GPR_CLOCK_REALTIME), start_time); - write_time_micro = write_time.tv_sec * 1000000 + write_time.tv_nsec / 1000; - census_log_shutdown(); - printf( - "Wrote %d %d byte records in %.3g microseconds: %g records/us " - "(%g ns/record), %g gigabytes/s\n", - nrecords, write_size, write_time_micro, nrecords / write_time_micro, - 1000 * write_time_micro / nrecords, - (write_size * nrecords) / write_time_micro / 1000); - } -} diff --git a/test/core/statistics/hash_table_test.cc b/test/core/statistics/hash_table_test.cc deleted file mode 100644 index b660006b8a7aa..0000000000000 --- a/test/core/statistics/hash_table_test.cc +++ /dev/null @@ -1,286 +0,0 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include -#include -#include - -#include "src/core/ext/census/hash_table.h" - -#include -#include -#include -#include "src/core/lib/support/murmur_hash.h" -#include "src/core/lib/support/string.h" -#include "test/core/util/test_config.h" - -static uint64_t hash64(const void* k) { - size_t len = strlen(k); - uint64_t higher = gpr_murmur_hash3((const char*)k, len / 2, 0); - return higher << 32 | - gpr_murmur_hash3((const char*)(k) + len / 2, len - len / 2, 0); -} - -static int cmp_str_keys(const void* k1, const void* k2) { - return strcmp((const char*)k1, (const char*)k2); -} - -static uint64_t force_collision(const void* k) { - return (1997 + hash64(k) % 3); -} - -static void free_data(void* data) { gpr_free(data); } - -/* Basic tests that empty hash table can be created and destroyed. */ -static void test_create_table(void) { - /* Create table with uint64 key type */ - census_ht* ht = NULL; - census_ht_option ht_options = { - CENSUS_HT_UINT64, 1999, NULL, NULL, NULL, NULL}; - ht = census_ht_create(&ht_options); - GPR_ASSERT(ht != NULL); - GPR_ASSERT(census_ht_get_size(ht) == 0); - census_ht_destroy(ht); - /* Create table with pointer key type */ - ht = NULL; - ht_options.key_type = CENSUS_HT_POINTER; - ht_options.hash = &hash64; - ht_options.compare_keys = &cmp_str_keys; - ht = census_ht_create(&ht_options); - GPR_ASSERT(ht != NULL); - GPR_ASSERT(census_ht_get_size(ht) == 0); - census_ht_destroy(ht); -} - -static void test_table_with_int_key(void) { - census_ht_option opt = {CENSUS_HT_UINT64, 7, NULL, NULL, NULL, NULL}; - census_ht* ht = census_ht_create(&opt); - uint64_t i = 0; - uint64_t sum_of_keys = 0; - size_t num_elements; - census_ht_kv* elements = NULL; - GPR_ASSERT(ht != NULL); - GPR_ASSERT(census_ht_get_size(ht) == 0); - elements = census_ht_get_all_elements(ht, &num_elements); - GPR_ASSERT(num_elements == 0); - GPR_ASSERT(elements == NULL); - for (i = 0; i < 20; ++i) { - census_ht_key key; - key.val = i; - census_ht_insert(ht, key, (void*)(intptr_t)i); - GPR_ASSERT(census_ht_get_size(ht) == i + 1); - } - for (i = 0; i < 20; i++) { - uint64_t* val = NULL; - census_ht_key key; - key.val = i; - val = static_cast(census_ht_find(ht, key)); - GPR_ASSERT(val == (void*)(intptr_t)i); - } - elements = census_ht_get_all_elements(ht, &num_elements); - GPR_ASSERT(elements != NULL); - GPR_ASSERT(num_elements == 20); - for (i = 0; i < num_elements; i++) { - sum_of_keys += elements[i].k.val; - } - GPR_ASSERT(sum_of_keys == 190); - gpr_free(elements); - census_ht_destroy(ht); -} - -/* Test that there is no memory leak when keys and values are owned by table. */ -static void test_value_and_key_deleter(void) { - census_ht_option opt = {CENSUS_HT_POINTER, 7, &hash64, - &cmp_str_keys, &free_data, &free_data}; - census_ht* ht = census_ht_create(&opt); - census_ht_key key; - char* val = NULL; - char* val2 = NULL; - key.ptr = gpr_malloc(100); - val = static_cast(gpr_malloc(10)); - strcpy(val, "value"); - strcpy(key.ptr, "some string as a key"); - GPR_ASSERT(ht != NULL); - GPR_ASSERT(census_ht_get_size(ht) == 0); - census_ht_insert(ht, key, val); - GPR_ASSERT(census_ht_get_size(ht) == 1); - val = static_cast(census_ht_find(ht, key)); - GPR_ASSERT(val != NULL); - GPR_ASSERT(strcmp(val, "value") == 0); - /* Insert same key different value, old value is overwritten. */ - val2 = static_cast(gpr_malloc(10)); - strcpy(val2, "v2"); - census_ht_insert(ht, key, val2); - GPR_ASSERT(census_ht_get_size(ht) == 1); - val2 = static_cast(census_ht_find(ht, key)); - GPR_ASSERT(val2 != NULL); - GPR_ASSERT(strcmp(val2, "v2") == 0); - census_ht_destroy(ht); -} - -/* Test simple insert and erase operations. */ -static void test_simple_add_and_erase(void) { - census_ht_option opt = {CENSUS_HT_UINT64, 7, NULL, NULL, NULL, NULL}; - census_ht* ht = census_ht_create(&opt); - GPR_ASSERT(ht != NULL); - GPR_ASSERT(census_ht_get_size(ht) == 0); - { - census_ht_key key; - int val = 3; - key.val = 2; - census_ht_insert(ht, key, (void*)&val); - GPR_ASSERT(census_ht_get_size(ht) == 1); - census_ht_erase(ht, key); - GPR_ASSERT(census_ht_get_size(ht) == 0); - /* Erasing a key from an empty table should be noop. */ - census_ht_erase(ht, key); - GPR_ASSERT(census_ht_get_size(ht) == 0); - /* Erasing a non-existant key from a table should be noop. */ - census_ht_insert(ht, key, (void*)&val); - key.val = 3; - census_ht_insert(ht, key, (void*)&val); - key.val = 9; - census_ht_insert(ht, key, (void*)&val); - GPR_ASSERT(census_ht_get_size(ht) == 3); - key.val = 1; - census_ht_erase(ht, key); - /* size unchanged after deleting non-existant key. */ - GPR_ASSERT(census_ht_get_size(ht) == 3); - /* size decrease by 1 after deleting an existant key. */ - key.val = 2; - census_ht_erase(ht, key); - GPR_ASSERT(census_ht_get_size(ht) == 2); - } - census_ht_destroy(ht); -} - -static void test_insertion_and_deletion_with_high_collision_rate(void) { - census_ht_option opt = {CENSUS_HT_POINTER, 13, &force_collision, - &cmp_str_keys, NULL, NULL}; - census_ht* ht = census_ht_create(&opt); - char key_str[1000][GPR_LTOA_MIN_BUFSIZE]; - uint64_t val = 0; - unsigned i = 0; - for (i = 0; i < 1000; i++) { - census_ht_key key; - key.ptr = key_str[i]; - gpr_ltoa(i, key_str[i]); - census_ht_insert(ht, key, (void*)(&val)); - gpr_log(GPR_INFO, "%d\n", i); - GPR_ASSERT(census_ht_get_size(ht) == (i + 1)); - } - for (i = 0; i < 1000; i++) { - census_ht_key key; - key.ptr = key_str[i]; - census_ht_erase(ht, key); - GPR_ASSERT(census_ht_get_size(ht) == (999 - i)); - } - census_ht_destroy(ht); -} - -static void test_table_with_string_key(void) { - census_ht_option opt = {CENSUS_HT_POINTER, 7, &hash64, - &cmp_str_keys, NULL, NULL}; - census_ht* ht = census_ht_create(&opt); - const char* keys[] = { - "k1", "a", "000", "apple", "banana_a_long_long_long_banana", - "%$", "111", "foo", "b"}; - const int vals[] = {0, 1, 2, 3, 4, 5, 6, 7, 8}; - int i = 0; - GPR_ASSERT(ht != NULL); - GPR_ASSERT(census_ht_get_size(ht) == 0); - for (i = 0; i < 9; i++) { - census_ht_key key; - key.ptr = (void*)(keys[i]); - census_ht_insert(ht, key, (void*)(vals + i)); - } - GPR_ASSERT(census_ht_get_size(ht) == 9); - for (i = 0; i < 9; i++) { - census_ht_key key; - int* val_ptr; - key.ptr = (void*)(keys[i]); - val_ptr = static_cast(census_ht_find(ht, key)); - GPR_ASSERT(*val_ptr == vals[i]); - } - { - /* inserts duplicate keys */ - census_ht_key key; - int* val_ptr = NULL; - key.ptr = (void*)(keys[2]); - census_ht_insert(ht, key, (void*)(vals + 8)); - /* expect value to be over written by new insertion */ - GPR_ASSERT(census_ht_get_size(ht) == 9); - val_ptr = static_cast(census_ht_find(ht, key)); - GPR_ASSERT(*val_ptr == vals[8]); - } - for (i = 0; i < 9; i++) { - census_ht_key key; - int* val_ptr; - uint32_t expected_tbl_sz = 9 - i; - GPR_ASSERT(census_ht_get_size(ht) == expected_tbl_sz); - key.ptr = (void*)(keys[i]); - val_ptr = static_cast(census_ht_find(ht, key)); - GPR_ASSERT(val_ptr != NULL); - census_ht_erase(ht, key); - GPR_ASSERT(census_ht_get_size(ht) == expected_tbl_sz - 1); - val_ptr = static_cast(census_ht_find(ht, key)); - GPR_ASSERT(val_ptr == NULL); - } - census_ht_destroy(ht); -} - -static void test_insertion_with_same_key(void) { - census_ht_option opt = {CENSUS_HT_UINT64, 11, NULL, NULL, NULL, NULL}; - census_ht* ht = census_ht_create(&opt); - census_ht_key key; - const char vals[] = {'a', 'b', 'c'}; - char* val_ptr; - key.val = 3; - census_ht_insert(ht, key, (void*)&(vals[0])); - GPR_ASSERT(census_ht_get_size(ht) == 1); - val_ptr = (char*)census_ht_find(ht, key); - GPR_ASSERT(val_ptr != NULL); - GPR_ASSERT(*val_ptr == 'a'); - key.val = 4; - val_ptr = (char*)census_ht_find(ht, key); - GPR_ASSERT(val_ptr == NULL); - key.val = 3; - census_ht_insert(ht, key, (void*)&(vals[1])); - GPR_ASSERT(census_ht_get_size(ht) == 1); - val_ptr = (char*)census_ht_find(ht, key); - GPR_ASSERT(val_ptr != NULL); - GPR_ASSERT(*val_ptr == 'b'); - census_ht_insert(ht, key, (void*)&(vals[2])); - GPR_ASSERT(census_ht_get_size(ht) == 1); - val_ptr = (char*)census_ht_find(ht, key); - GPR_ASSERT(val_ptr != NULL); - GPR_ASSERT(*val_ptr == 'c'); - census_ht_destroy(ht); -} - -int main(int argc, char** argv) { - grpc_test_init(argc, argv); - test_create_table(); - test_simple_add_and_erase(); - test_table_with_int_key(); - test_table_with_string_key(); - test_value_and_key_deleter(); - test_insertion_with_same_key(); - test_insertion_and_deletion_with_high_collision_rate(); - return 0; -} diff --git a/test/core/statistics/trace_test.cc b/test/core/statistics/trace_test.cc deleted file mode 100644 index ecbfed09ee63a..0000000000000 --- a/test/core/statistics/trace_test.cc +++ /dev/null @@ -1,239 +0,0 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include "src/core/ext/census/census_interface.h" -#include "src/core/ext/census/census_tracing.h" -#include "test/core/util/test_config.h" - -/* Ensure all possible state transitions are called without causing problem */ -static void test_init_shutdown(void) { - census_tracing_init(); - census_tracing_init(); - census_tracing_shutdown(); - census_tracing_shutdown(); - census_tracing_init(); -} - -static void test_start_op_generates_locally_unique_ids(void) { -/* Check that ids generated within window size of 1000 are unique. - TODO(hongyu): Replace O(n^2) duplicate detection algorithm with O(nlogn) - algorithm. Enhance the test to larger window size (>10^6) */ -#define WINDOW_SIZE 1000 - census_op_id ids[WINDOW_SIZE]; - int i; - census_init(); - for (i = 0; i < WINDOW_SIZE; i++) { - ids[i] = census_tracing_start_op(); - census_tracing_end_op(ids[i]); - } - for (i = 0; i < WINDOW_SIZE - 1; i++) { - int j; - for (j = i + 1; j < WINDOW_SIZE; j++) { - GPR_ASSERT(ids[i].upper != ids[j].upper || ids[i].lower != ids[j].lower); - } - } -#undef WINDOW_SIZE - census_shutdown(); -} - -static void test_get_trace_method_name(void) { - census_op_id id; - const char write_name[] = "service/method"; - census_tracing_init(); - id = census_tracing_start_op(); - census_add_method_tag(id, write_name); - census_internal_lock_trace_store(); - { - const char* read_name = - census_get_trace_method_name(census_get_trace_obj_locked(id)); - GPR_ASSERT(strcmp(read_name, write_name) == 0); - } - census_internal_unlock_trace_store(); - census_tracing_shutdown(); -} - -typedef struct thd_arg { - int num_done; - gpr_cv done; - gpr_mu mu; -} thd_arg; - -static void mimic_trace_op_sequences(void* arg) { - census_op_id id; - const char* method_name = "service_foo/method_bar"; - int i = 0; - const int num_iter = 200; - thd_arg* args = (thd_arg*)arg; - GPR_ASSERT(args != NULL); - gpr_log(GPR_INFO, "Start trace op sequence thread."); - for (i = 0; i < num_iter; i++) { - id = census_tracing_start_op(); - census_add_method_tag(id, method_name); - /* pretend doing 1us work. */ - gpr_sleep_until(GRPC_TIMEOUT_MICROS_TO_DEADLINE(1)); - census_tracing_end_op(id); - } - gpr_log(GPR_INFO, "End trace op sequence thread."); - gpr_mu_lock(&args->mu); - args->num_done += 1; - gpr_cv_broadcast(&args->done); - gpr_mu_unlock(&args->mu); -} - -static void test_concurrency(void) { -#define NUM_THREADS 1000 - gpr_thd_id tid[NUM_THREADS]; - int i = 0; - thd_arg arg; - arg.num_done = 0; - gpr_mu_init(&arg.mu); - gpr_cv_init(&arg.done); - census_tracing_init(); - for (i = 0; i < NUM_THREADS; ++i) { - gpr_thd_new(tid + i, mimic_trace_op_sequences, &arg, NULL); - } - gpr_mu_lock(&arg.mu); - while (arg.num_done < NUM_THREADS) { - gpr_log(GPR_INFO, "num done %d", arg.num_done); - gpr_cv_wait(&arg.done, &arg.mu, gpr_inf_future(GPR_CLOCK_REALTIME)); - } - gpr_mu_unlock(&arg.mu); - census_tracing_shutdown(); -#undef NUM_THREADS -} - -static void test_add_method_tag_to_unknown_op_id(void) { - census_op_id unknown_id = {0xDEAD, 0xBEEF}; - int ret = 0; - census_tracing_init(); - ret = census_add_method_tag(unknown_id, "foo"); - GPR_ASSERT(ret != 0); - census_tracing_shutdown(); -} - -static void test_trace_print(void) { - census_op_id id; - int i; - const char* annotation_txt[4] = {"abc", "", "$%^ *()_"}; - char long_txt[CENSUS_MAX_ANNOTATION_LENGTH + 10]; - - memset(long_txt, 'a', GPR_ARRAY_SIZE(long_txt)); - long_txt[CENSUS_MAX_ANNOTATION_LENGTH + 9] = '\0'; - annotation_txt[3] = long_txt; - - census_tracing_init(); - id = census_tracing_start_op(); - /* Adds large number of annotations to each trace */ - for (i = 0; i < 1000; i++) { - census_tracing_print(id, - annotation_txt[i % GPR_ARRAY_SIZE(annotation_txt)]); - } - census_tracing_end_op(id); - - census_tracing_shutdown(); -} - -/* Returns 1 if two ids are equal, otherwise returns 0. */ -static int ids_equal(census_op_id id1, census_op_id id2) { - return (id1.upper == id2.upper) && (id1.lower == id2.lower); -} - -static void test_get_active_ops(void) { - census_op_id id_1, id_2, id_3; - census_trace_obj** active_ops; - const char* annotation_txt[] = {"annotation 1", "a2"}; - int i = 0; - int n = 0; - - gpr_log(GPR_INFO, "test_get_active_ops"); - census_tracing_init(); - /* No active ops before calling start_op(). */ - active_ops = census_get_active_ops(&n); - GPR_ASSERT(active_ops == NULL); - GPR_ASSERT(n == 0); - - /* Starts one op */ - id_1 = census_tracing_start_op(); - census_add_method_tag(id_1, "foo_1"); - active_ops = census_get_active_ops(&n); - GPR_ASSERT(active_ops != NULL); - GPR_ASSERT(n == 1); - GPR_ASSERT(ids_equal(active_ops[0]->id, id_1)); - census_trace_obj_destroy(active_ops[0]); - gpr_free(active_ops); - active_ops = NULL; - - /* Start the second and the third ops */ - id_2 = census_tracing_start_op(); - census_add_method_tag(id_2, "foo_2"); - id_3 = census_tracing_start_op(); - census_add_method_tag(id_3, "foo_3"); - - active_ops = census_get_active_ops(&n); - GPR_ASSERT(n == 3); - for (i = 0; i < 3; i++) { - census_trace_obj_destroy(active_ops[i]); - } - gpr_free(active_ops); - active_ops = NULL; - - /* End the second op and add annotations to the third ops */ - census_tracing_end_op(id_2); - census_tracing_print(id_3, annotation_txt[0]); - census_tracing_print(id_3, annotation_txt[1]); - - active_ops = census_get_active_ops(&n); - GPR_ASSERT(active_ops != NULL); - GPR_ASSERT(n == 2); - for (i = 0; i < 2; i++) { - census_trace_obj_destroy(active_ops[i]); - } - gpr_free(active_ops); - active_ops = NULL; - - /* End all ops. */ - census_tracing_end_op(id_1); - census_tracing_end_op(id_3); - active_ops = census_get_active_ops(&n); - GPR_ASSERT(active_ops == NULL); - GPR_ASSERT(n == 0); - - census_tracing_shutdown(); -} - -int main(int argc, char** argv) { - grpc_test_init(argc, argv); - test_init_shutdown(); - test_start_op_generates_locally_unique_ids(); - test_get_trace_method_name(); - test_concurrency(); - test_add_method_tag_to_unknown_op_id(); - test_trace_print(); - test_get_active_ops(); - return 0; -} diff --git a/test/core/statistics/window_stats_test.cc b/test/core/statistics/window_stats_test.cc deleted file mode 100644 index b17c61a47bd7a..0000000000000 --- a/test/core/statistics/window_stats_test.cc +++ /dev/null @@ -1,304 +0,0 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -#include "src/core/ext/census/window_stats.h" -#include -#include -#include -#include "test/core/util/test_config.h" - -typedef struct test_stat { - double value1; - int value2; -} test_stat; - -void add_test_stat(void* base, const void* addme) { - test_stat* b = (test_stat*)base; - const test_stat* a = (const test_stat*)addme; - b->value1 += a->value1; - b->value2 += a->value2; -} - -void add_proportion_test_stat(double p, void* base, const void* addme) { - test_stat* b = (test_stat*)base; - const test_stat* a = (const test_stat*)addme; - b->value1 += p * a->value1; - b->value2 += p * a->value2 + 0.5; /* +0.5 is poor mans (no c99) round() */ -} - -const struct census_window_stats_stat_info kMyStatInfo = { - sizeof(test_stat), NULL, add_test_stat, add_proportion_test_stat}; - -const gpr_timespec kMilliSecInterval = {0, 1000000, GPR_CLOCK_MONOTONIC}; -const gpr_timespec kSecInterval = {1, 0, GPR_CLOCK_MONOTONIC}; -const gpr_timespec kMinInterval = {60, 0 GPR_CLOCK_MONOTONIC}; -const gpr_timespec kHourInterval = {3600, 0, GPR_CLOCK_MONOTONIC}; -const gpr_timespec kPrimeInterval = {0, 101, GPR_CLOCK_MONOTONIC}; - -static int compare_double(double a, double b, double epsilon) { - if (a >= b) { - return (a > b + epsilon) ? 1 : 0; - } else { - return (b > a + epsilon) ? -1 : 0; - } -} - -void empty_test(void) { - census_window_stats_sums result; - const gpr_timespec zero = {0, 0, GPR_CLOCK_MONOTONIC}; - test_stat sum; - struct census_window_stats* stats = - census_window_stats_create(1, &kMinInterval, 5, &kMyStatInfo); - GPR_ASSERT(stats != NULL); - result.statistic = ∑ - census_window_stats_get_sums(stats, zero, &result); - GPR_ASSERT(result.count == 0 && sum.value1 == 0 && sum.value2 == 0); - census_window_stats_get_sums(stats, gpr_now(GPR_CLOCK_REALTIME), &result); - GPR_ASSERT(result.count == 0 && sum.value1 == 0 && sum.value2 == 0); - census_window_stats_destroy(stats); -} - -void one_interval_test(void) { - const test_stat value = {0.1, 4}; - const double epsilon = 1e10 - 11; - gpr_timespec when = {0, 0, GPR_CLOCK_MONOTONIC}; - census_window_stats_sums result; - test_stat sum; - /* granularity == 5 so width of internal windows should be 12s */ - struct census_window_stats* stats = - census_window_stats_create(1, &kMinInterval, 5, &kMyStatInfo); - GPR_ASSERT(stats != NULL); - /* phase 1: insert a single value at t=0s, and check that various measurement - times result in expected output values */ - census_window_stats_add(stats, when, &value); - result.statistic = ∑ - /* when = 0s, values extracted should be everything */ - census_window_stats_get_sums(stats, when, &result); - GPR_ASSERT(compare_double(result.count, 1, epsilon) == 0 && - compare_double(sum.value1, value.value1, epsilon) == 0 && - sum.value2 == value.value2); - /* when = 6,30,60s, should be all of the data */ - when.tv_sec = 6; - census_window_stats_get_sums(stats, when, &result); - GPR_ASSERT(compare_double(result.count, 1.0, epsilon) == 0 && - compare_double(sum.value1, value.value1, epsilon) == 0 && - sum.value2 == value.value2); - /* when == 30s,60s, should be all of the data */ - when.tv_sec = 30; - census_window_stats_get_sums(stats, when, &result); - GPR_ASSERT(compare_double(result.count, 1.0, epsilon) == 0 && - compare_double(sum.value1, value.value1, epsilon) == 0 && - sum.value2 == value.value2); - when.tv_sec = 60; - census_window_stats_get_sums(stats, when, &result); - GPR_ASSERT(compare_double(result.count, 1.0, epsilon) == 0 && - compare_double(sum.value1, value.value1, epsilon) == 0 && - sum.value2 == value.value2); - /* when = 66s, should be half (only take half of bottom bucket) */ - when.tv_sec = 66; - census_window_stats_get_sums(stats, when, &result); - GPR_ASSERT(compare_double(result.count, 0.5, epsilon) == 0 && - compare_double(sum.value1, value.value1 / 2, epsilon) == 0 && - sum.value2 == value.value2 / 2); - /* when = 72s, should be completely out of window */ - when.tv_sec = 72; - census_window_stats_get_sums(stats, when, &result); - GPR_ASSERT(compare_double(result.count, 0, epsilon) == 0 && - compare_double(sum.value1, 0, epsilon) == 0 && sum.value2 == 0); - - /* phase 2: tear down and do as before, but inserting two values */ - census_window_stats_destroy(stats); - stats = census_window_stats_create(1, &kMinInterval, 5, &kMyStatInfo); - GPR_ASSERT(stats != NULL); - when.tv_sec = 0; - when.tv_nsec = 17; - census_window_stats_add(stats, when, &value); - when.tv_sec = 1; - census_window_stats_add(stats, when, &value); - when.tv_sec = 0; - census_window_stats_get_sums(stats, when, &result); - GPR_ASSERT(compare_double(result.count, 0, epsilon) == 0 && - compare_double(sum.value1, 0, epsilon) == 0 && sum.value2 == 0); - /* time = 3s, 30s, should get all data */ - when.tv_sec = 3; - census_window_stats_get_sums(stats, when, &result); - GPR_ASSERT(compare_double(result.count, 2, epsilon) == 0 && - compare_double(sum.value1, 2 * value.value1, epsilon) == 0 && - sum.value2 == 2 * value.value2); - when.tv_sec = 30; - census_window_stats_get_sums(stats, when, &result); - GPR_ASSERT(compare_double(result.count, 2, epsilon) == 0 && - compare_double(sum.value1, 2 * value.value1, epsilon) == 0 && - sum.value2 == 2 * value.value2); - - /* phase 3: insert into "middle" bucket, and force a shift, pushing out - the two values in bottom bucket */ - when.tv_sec = 30; - census_window_stats_add(stats, when, &value); - when.tv_sec = 76; - census_window_stats_add(stats, when, &value); - when.tv_sec = 0; - census_window_stats_get_sums(stats, when, &result); - GPR_ASSERT(result.count == 0 && sum.value1 == 0 && sum.value2 == 0); - when.tv_sec = 30; - census_window_stats_get_sums(stats, when, &result); - /* half of the single value in the 30 second bucket */ - GPR_ASSERT(compare_double(result.count, 0.5, epsilon) == 0 && - compare_double(sum.value1, value.value1 / 2, epsilon) == 0 && - sum.value2 == value.value2 / 2); - when.tv_sec = 74; - census_window_stats_get_sums(stats, when, &result); - /* half of the 76 second bucket, all of the 30 second bucket */ - GPR_ASSERT(compare_double(result.count, 1.5, epsilon) == 0 && - compare_double(sum.value1, value.value1 * 1.5, epsilon) == 0 && - sum.value2 == value.value2 / 2 * 3); - when.tv_sec = 76; - census_window_stats_get_sums(stats, when, &result); - /* >=76s, get all of the 76 second bucket, all of the 30 second bucket */ - GPR_ASSERT(compare_double(result.count, 2, epsilon) == 0 && - compare_double(sum.value1, value.value1 * 2, epsilon) == 0 && - sum.value2 == value.value2 * 2); - when.tv_sec = 78; - census_window_stats_get_sums(stats, when, &result); - /* half of the 76 second bucket, all of the 30 second bucket */ - GPR_ASSERT(compare_double(result.count, 2, epsilon) == 0 && - compare_double(sum.value1, value.value1 * 2, epsilon) == 0 && - sum.value2 == value.value2 * 2); - census_window_stats_destroy(stats); -} - -void many_interval_test(void) { - gpr_timespec intervals[4]; - const test_stat value = {123.45, 8}; - const double epsilon = 1e10 - 11; - gpr_timespec when = {3600, 0, GPR_CLOCK_MONOTONIC}; /* one hour */ - census_window_stats_sums result[4]; - test_stat sums[4]; - int i; - struct census_window_stats* stats; - intervals[0] = kMilliSecInterval; - intervals[1] = kSecInterval; - intervals[2] = kMinInterval; - intervals[3] = kHourInterval; - for (i = 0; i < 4; i++) { - result[i].statistic = &sums[i]; - } - stats = census_window_stats_create(4, intervals, 100, &kMyStatInfo); - GPR_ASSERT(stats != NULL); - /* add 10 stats within half of each time range */ - for (i = 0; i < 10; i++) { - when.tv_sec += 180; /* covers 30 min of one hour range */ - census_window_stats_add(stats, when, &value); - } - when.tv_sec += 120; - for (i = 0; i < 10; i++) { - when.tv_sec += 3; /* covers 30 sec of one minute range */ - census_window_stats_add(stats, when, &value); - } - when.tv_sec += 2; - for (i = 0; i < 10; i++) { - when.tv_nsec += 50000000; /* covers 0.5s of 1s range */ - census_window_stats_add(stats, when, &value); - } - when.tv_nsec += 2000000; - for (i = 0; i < 10; i++) { - when.tv_nsec += 50000; /* covers 0.5 ms of 1 ms range */ - census_window_stats_add(stats, when, &value); - } - when.tv_nsec += 20000; - census_window_stats_get_sums(stats, when, result); - GPR_ASSERT(compare_double(result[0].count, 10, epsilon) == 0 && - compare_double(sums[0].value1, value.value1 * 10, epsilon) == 0 && - sums[0].value2 == value.value2 * 10); - when.tv_nsec += 20000000; - census_window_stats_get_sums(stats, when, result); - GPR_ASSERT(compare_double(result[1].count, 20, epsilon) == 0 && - compare_double(sums[1].value1, value.value1 * 20, epsilon) == 0 && - sums[1].value2 == value.value2 * 20); - when.tv_sec += 2; - census_window_stats_get_sums(stats, when, result); - GPR_ASSERT(compare_double(result[2].count, 30, epsilon) == 0 && - compare_double(sums[2].value1, value.value1 * 30, epsilon) == 0 && - sums[2].value2 == value.value2 * 30); - when.tv_sec += 72; - census_window_stats_get_sums(stats, when, result); - GPR_ASSERT(compare_double(result[3].count, 40, epsilon) == 0 && - compare_double(sums[3].value1, value.value1 * 40, epsilon) == 0 && - sums[3].value2 == value.value2 * 40); - census_window_stats_destroy(stats); -} - -void rolling_time_test(void) { - const test_stat value = {0.1, 4}; - gpr_timespec when = {0, 0, GPR_CLOCK_MONOTONIC}; - census_window_stats_sums result; - test_stat sum; - int i; - gpr_timespec increment = {0, 0, GPR_CLOCK_MONOTONIC}; - struct census_window_stats* stats = - census_window_stats_create(1, &kMinInterval, 7, &kMyStatInfo); - GPR_ASSERT(stats != NULL); - srand(gpr_now(GPR_CLOCK_REALTIME).tv_nsec); - for (i = 0; i < 100000; i++) { - increment.tv_nsec = rand() % 100000000; /* up to 1/10th second */ - when = gpr_time_add(when, increment); - census_window_stats_add(stats, when, &value); - } - result.statistic = ∑ - census_window_stats_get_sums(stats, when, &result); - /* With 1/20th second average between samples, we expect 20*60 = 1200 - samples on average. Make sure we are within 100 of that. */ - GPR_ASSERT(compare_double(result.count, 1200, 100) == 0); - census_window_stats_destroy(stats); -} - -#include -void infinite_interval_test(void) { - const test_stat value = {0.1, 4}; - gpr_timespec when = {0, 0, GPR_CLOCK_MONOTONIC}; - census_window_stats_sums result; - test_stat sum; - int i; - const int count = 100000; - gpr_timespec increment = {0, 0, GPR_CLOCK_MONOTONIC}; - gpr_timespec temp = gpr_inf_future(GPR_CLOCK_REALTIME); - struct census_window_stats* stats = census_window_stats_create( - 1, &gpr_inf_future(GPR_CLOCK_REALTIME), 10, &kMyStatInfo); - srand(gpr_now(GPR_CLOCK_REALTIME).tv_nsec); - for (i = 0; i < count; i++) { - increment.tv_sec = rand() % 21600; /* 6 hours */ - when = gpr_time_add(when, increment); - census_window_stats_add(stats, when, &value); - } - result.statistic = ∑ - census_window_stats_get_sums(stats, when, &result); - /* The only thing it makes sense to compare for "infinite" periods is the - total counts */ - GPR_ASSERT(result.count == count); - census_window_stats_destroy(stats); -} - -int main(int argc, char* argv[]) { - grpc_test_init(argc, argv); - empty_test(); - one_interval_test(); - many_interval_test(); - rolling_time_test(); - infinite_interval_test(); - return 0; -} diff --git a/test/core/support/alloc_test.cc b/test/core/support/alloc_test.cc index ee590366b9cbf..c9e88400efc2c 100644 --- a/test/core/support/alloc_test.cc +++ b/test/core/support/alloc_test.cc @@ -30,11 +30,11 @@ static void test_custom_allocs() { const gpr_allocation_functions default_fns = gpr_get_allocation_functions(); intptr_t addr_to_free = 0; char* i; - gpr_allocation_functions fns = {fake_malloc, NULL, fake_realloc, fake_free}; + gpr_allocation_functions fns = {fake_malloc, nullptr, fake_realloc, fake_free}; gpr_set_allocation_functions(fns); GPR_ASSERT((void*)(size_t)0xdeadbeef == gpr_malloc(0xdeadbeef)); - GPR_ASSERT((void*)(size_t)0xcafed00d == gpr_realloc(0, 0xcafed00d)); + GPR_ASSERT((void*)(size_t)0xcafed00d == gpr_realloc(nullptr, 0xcafed00d)); gpr_free(&addr_to_free); GPR_ASSERT(addr_to_free == (intptr_t)0xdeadd00d); diff --git a/test/core/support/arena_test.cc b/test/core/support/arena_test.cc index 6c666af0964c4..244d860639f38 100644 --- a/test/core/support/arena_test.cc +++ b/test/core/support/arena_test.cc @@ -44,7 +44,7 @@ static void test(const char* name, size_t init_size, const size_t* allocs, gpr_strvec_add(&v, s); } gpr_strvec_add(&v, gpr_strdup("}")); - s = gpr_strvec_flatten(&v, NULL); + s = gpr_strvec_flatten(&v, nullptr); gpr_strvec_destroy(&v); gpr_log(GPR_INFO, "%s", s); gpr_free(s); diff --git a/test/core/support/avl_test.cc b/test/core/support/avl_test.cc index cd3a852e9db03..345db557b9b9f 100644 --- a/test/core/support/avl_test.cc +++ b/test/core/support/avl_test.cc @@ -45,19 +45,19 @@ static const gpr_avl_vtable int_int_vtable = {destroy, int_copy, int_compare, static void check_get(gpr_avl avl, int key, int value) { int* k = box(key); - GPR_ASSERT(*(int*)gpr_avl_get(avl, k, NULL) == value); + GPR_ASSERT(*(int*)gpr_avl_get(avl, k, nullptr) == value); gpr_free(k); } static void check_negget(gpr_avl avl, int key) { int* k = box(key); - GPR_ASSERT(gpr_avl_get(avl, k, NULL) == NULL); + GPR_ASSERT(gpr_avl_get(avl, k, nullptr) == nullptr); gpr_free(k); } static gpr_avl remove_int(gpr_avl avl, int key) { int* k = box(key); - avl = gpr_avl_remove(avl, k, NULL); + avl = gpr_avl_remove(avl, k, nullptr); gpr_free(k); return avl; } @@ -66,94 +66,94 @@ static void test_get(void) { gpr_avl avl; gpr_log(GPR_DEBUG, "test_get"); avl = gpr_avl_create(&int_int_vtable); - avl = gpr_avl_add(avl, box(1), box(11), NULL); - avl = gpr_avl_add(avl, box(2), box(22), NULL); - avl = gpr_avl_add(avl, box(3), box(33), NULL); + avl = gpr_avl_add(avl, box(1), box(11), nullptr); + avl = gpr_avl_add(avl, box(2), box(22), nullptr); + avl = gpr_avl_add(avl, box(3), box(33), nullptr); check_get(avl, 1, 11); check_get(avl, 2, 22); check_get(avl, 3, 33); check_negget(avl, 4); - gpr_avl_unref(avl, NULL); + gpr_avl_unref(avl, nullptr); } static void test_ll(void) { gpr_avl avl; gpr_log(GPR_DEBUG, "test_ll"); avl = gpr_avl_create(&int_int_vtable); - avl = gpr_avl_add(avl, box(5), box(1), NULL); - avl = gpr_avl_add(avl, box(4), box(2), NULL); - avl = gpr_avl_add(avl, box(3), box(3), NULL); + avl = gpr_avl_add(avl, box(5), box(1), nullptr); + avl = gpr_avl_add(avl, box(4), box(2), nullptr); + avl = gpr_avl_add(avl, box(3), box(3), nullptr); GPR_ASSERT(*(int*)avl.root->key == 4); GPR_ASSERT(*(int*)avl.root->left->key == 3); GPR_ASSERT(*(int*)avl.root->right->key == 5); - gpr_avl_unref(avl, NULL); + gpr_avl_unref(avl, nullptr); } static void test_lr(void) { gpr_avl avl; gpr_log(GPR_DEBUG, "test_lr"); avl = gpr_avl_create(&int_int_vtable); - avl = gpr_avl_add(avl, box(5), box(1), NULL); - avl = gpr_avl_add(avl, box(3), box(2), NULL); - avl = gpr_avl_add(avl, box(4), box(3), NULL); + avl = gpr_avl_add(avl, box(5), box(1), nullptr); + avl = gpr_avl_add(avl, box(3), box(2), nullptr); + avl = gpr_avl_add(avl, box(4), box(3), nullptr); GPR_ASSERT(*(int*)avl.root->key == 4); GPR_ASSERT(*(int*)avl.root->left->key == 3); GPR_ASSERT(*(int*)avl.root->right->key == 5); - gpr_avl_unref(avl, NULL); + gpr_avl_unref(avl, nullptr); } static void test_rr(void) { gpr_avl avl; gpr_log(GPR_DEBUG, "test_rr"); avl = gpr_avl_create(&int_int_vtable); - avl = gpr_avl_add(avl, box(3), box(1), NULL); - avl = gpr_avl_add(avl, box(4), box(2), NULL); - avl = gpr_avl_add(avl, box(5), box(3), NULL); + avl = gpr_avl_add(avl, box(3), box(1), nullptr); + avl = gpr_avl_add(avl, box(4), box(2), nullptr); + avl = gpr_avl_add(avl, box(5), box(3), nullptr); GPR_ASSERT(*(int*)avl.root->key == 4); GPR_ASSERT(*(int*)avl.root->left->key == 3); GPR_ASSERT(*(int*)avl.root->right->key == 5); - gpr_avl_unref(avl, NULL); + gpr_avl_unref(avl, nullptr); } static void test_rl(void) { gpr_avl avl; gpr_log(GPR_DEBUG, "test_rl"); avl = gpr_avl_create(&int_int_vtable); - avl = gpr_avl_add(avl, box(3), box(1), NULL); - avl = gpr_avl_add(avl, box(5), box(2), NULL); - avl = gpr_avl_add(avl, box(4), box(3), NULL); + avl = gpr_avl_add(avl, box(3), box(1), nullptr); + avl = gpr_avl_add(avl, box(5), box(2), nullptr); + avl = gpr_avl_add(avl, box(4), box(3), nullptr); GPR_ASSERT(*(int*)avl.root->key == 4); GPR_ASSERT(*(int*)avl.root->left->key == 3); GPR_ASSERT(*(int*)avl.root->right->key == 5); - gpr_avl_unref(avl, NULL); + gpr_avl_unref(avl, nullptr); } static void test_unbalanced(void) { gpr_avl avl; gpr_log(GPR_DEBUG, "test_unbalanced"); avl = gpr_avl_create(&int_int_vtable); - avl = gpr_avl_add(avl, box(5), box(1), NULL); - avl = gpr_avl_add(avl, box(4), box(2), NULL); - avl = gpr_avl_add(avl, box(3), box(3), NULL); - avl = gpr_avl_add(avl, box(2), box(4), NULL); - avl = gpr_avl_add(avl, box(1), box(5), NULL); + avl = gpr_avl_add(avl, box(5), box(1), nullptr); + avl = gpr_avl_add(avl, box(4), box(2), nullptr); + avl = gpr_avl_add(avl, box(3), box(3), nullptr); + avl = gpr_avl_add(avl, box(2), box(4), nullptr); + avl = gpr_avl_add(avl, box(1), box(5), nullptr); GPR_ASSERT(*(int*)avl.root->key == 4); GPR_ASSERT(*(int*)avl.root->left->key == 2); GPR_ASSERT(*(int*)avl.root->left->left->key == 1); GPR_ASSERT(*(int*)avl.root->left->right->key == 3); GPR_ASSERT(*(int*)avl.root->right->key == 5); - gpr_avl_unref(avl, NULL); + gpr_avl_unref(avl, nullptr); } static void test_replace(void) { gpr_avl avl; gpr_log(GPR_DEBUG, "test_replace"); avl = gpr_avl_create(&int_int_vtable); - avl = gpr_avl_add(avl, box(1), box(1), NULL); - avl = gpr_avl_add(avl, box(1), box(2), NULL); + avl = gpr_avl_add(avl, box(1), box(1), nullptr); + avl = gpr_avl_add(avl, box(1), box(2), nullptr); check_get(avl, 1, 2); check_negget(avl, 2); - gpr_avl_unref(avl, NULL); + gpr_avl_unref(avl, nullptr); } static void test_remove(void) { @@ -161,36 +161,36 @@ static void test_remove(void) { gpr_avl avl3, avl4, avl5, avln; gpr_log(GPR_DEBUG, "test_remove"); avl = gpr_avl_create(&int_int_vtable); - avl = gpr_avl_add(avl, box(3), box(1), NULL); - avl = gpr_avl_add(avl, box(4), box(2), NULL); - avl = gpr_avl_add(avl, box(5), box(3), NULL); + avl = gpr_avl_add(avl, box(3), box(1), nullptr); + avl = gpr_avl_add(avl, box(4), box(2), nullptr); + avl = gpr_avl_add(avl, box(5), box(3), nullptr); - avl3 = remove_int(gpr_avl_ref(avl, NULL), 3); - avl4 = remove_int(gpr_avl_ref(avl, NULL), 4); - avl5 = remove_int(gpr_avl_ref(avl, NULL), 5); - avln = remove_int(gpr_avl_ref(avl, NULL), 1); + avl3 = remove_int(gpr_avl_ref(avl, nullptr), 3); + avl4 = remove_int(gpr_avl_ref(avl, nullptr), 4); + avl5 = remove_int(gpr_avl_ref(avl, nullptr), 5); + avln = remove_int(gpr_avl_ref(avl, nullptr), 1); - gpr_avl_unref(avl, NULL); + gpr_avl_unref(avl, nullptr); check_negget(avl3, 3); check_get(avl3, 4, 2); check_get(avl3, 5, 3); - gpr_avl_unref(avl3, NULL); + gpr_avl_unref(avl3, nullptr); check_get(avl4, 3, 1); check_negget(avl4, 4); check_get(avl4, 5, 3); - gpr_avl_unref(avl4, NULL); + gpr_avl_unref(avl4, nullptr); check_get(avl5, 3, 1); check_get(avl5, 4, 2); check_negget(avl5, 5); - gpr_avl_unref(avl5, NULL); + gpr_avl_unref(avl5, nullptr); check_get(avln, 3, 1); check_get(avln, 4, 2); check_get(avln, 5, 3); - gpr_avl_unref(avln, NULL); + gpr_avl_unref(avln, nullptr); } static void test_badcase1(void) { @@ -199,44 +199,44 @@ static void test_badcase1(void) { gpr_log(GPR_DEBUG, "test_badcase1"); avl = gpr_avl_create(&int_int_vtable); - avl = gpr_avl_add(avl, box(88), box(1), NULL); + avl = gpr_avl_add(avl, box(88), box(1), nullptr); avl = remove_int(avl, 643); avl = remove_int(avl, 983); - avl = gpr_avl_add(avl, box(985), box(4), NULL); - avl = gpr_avl_add(avl, box(640), box(5), NULL); - avl = gpr_avl_add(avl, box(41), box(6), NULL); - avl = gpr_avl_add(avl, box(112), box(7), NULL); - avl = gpr_avl_add(avl, box(342), box(8), NULL); + avl = gpr_avl_add(avl, box(985), box(4), nullptr); + avl = gpr_avl_add(avl, box(640), box(5), nullptr); + avl = gpr_avl_add(avl, box(41), box(6), nullptr); + avl = gpr_avl_add(avl, box(112), box(7), nullptr); + avl = gpr_avl_add(avl, box(342), box(8), nullptr); avl = remove_int(avl, 1013); - avl = gpr_avl_add(avl, box(434), box(10), NULL); - avl = gpr_avl_add(avl, box(520), box(11), NULL); - avl = gpr_avl_add(avl, box(231), box(12), NULL); - avl = gpr_avl_add(avl, box(852), box(13), NULL); + avl = gpr_avl_add(avl, box(434), box(10), nullptr); + avl = gpr_avl_add(avl, box(520), box(11), nullptr); + avl = gpr_avl_add(avl, box(231), box(12), nullptr); + avl = gpr_avl_add(avl, box(852), box(13), nullptr); avl = remove_int(avl, 461); - avl = gpr_avl_add(avl, box(108), box(15), NULL); - avl = gpr_avl_add(avl, box(806), box(16), NULL); - avl = gpr_avl_add(avl, box(827), box(17), NULL); + avl = gpr_avl_add(avl, box(108), box(15), nullptr); + avl = gpr_avl_add(avl, box(806), box(16), nullptr); + avl = gpr_avl_add(avl, box(827), box(17), nullptr); avl = remove_int(avl, 796); - avl = gpr_avl_add(avl, box(340), box(19), NULL); - avl = gpr_avl_add(avl, box(498), box(20), NULL); - avl = gpr_avl_add(avl, box(203), box(21), NULL); - avl = gpr_avl_add(avl, box(751), box(22), NULL); - avl = gpr_avl_add(avl, box(150), box(23), NULL); + avl = gpr_avl_add(avl, box(340), box(19), nullptr); + avl = gpr_avl_add(avl, box(498), box(20), nullptr); + avl = gpr_avl_add(avl, box(203), box(21), nullptr); + avl = gpr_avl_add(avl, box(751), box(22), nullptr); + avl = gpr_avl_add(avl, box(150), box(23), nullptr); avl = remove_int(avl, 237); - avl = gpr_avl_add(avl, box(830), box(25), NULL); + avl = gpr_avl_add(avl, box(830), box(25), nullptr); avl = remove_int(avl, 1007); avl = remove_int(avl, 394); - avl = gpr_avl_add(avl, box(65), box(28), NULL); + avl = gpr_avl_add(avl, box(65), box(28), nullptr); avl = remove_int(avl, 904); avl = remove_int(avl, 123); - avl = gpr_avl_add(avl, box(238), box(31), NULL); - avl = gpr_avl_add(avl, box(184), box(32), NULL); + avl = gpr_avl_add(avl, box(238), box(31), nullptr); + avl = gpr_avl_add(avl, box(184), box(32), nullptr); avl = remove_int(avl, 331); - avl = gpr_avl_add(avl, box(827), box(34), NULL); + avl = gpr_avl_add(avl, box(827), box(34), nullptr); check_get(avl, 830, 25); - gpr_avl_unref(avl, NULL); + gpr_avl_unref(avl, nullptr); } static void test_badcase2(void) { @@ -245,254 +245,254 @@ static void test_badcase2(void) { gpr_log(GPR_DEBUG, "test_badcase2"); avl = gpr_avl_create(&int_int_vtable); - avl = gpr_avl_add(avl, box(288), box(1), NULL); + avl = gpr_avl_add(avl, box(288), box(1), nullptr); avl = remove_int(avl, 415); - avl = gpr_avl_add(avl, box(953), box(3), NULL); - avl = gpr_avl_add(avl, box(101), box(4), NULL); - avl = gpr_avl_add(avl, box(516), box(5), NULL); - avl = gpr_avl_add(avl, box(547), box(6), NULL); - avl = gpr_avl_add(avl, box(467), box(7), NULL); - avl = gpr_avl_add(avl, box(793), box(8), NULL); + avl = gpr_avl_add(avl, box(953), box(3), nullptr); + avl = gpr_avl_add(avl, box(101), box(4), nullptr); + avl = gpr_avl_add(avl, box(516), box(5), nullptr); + avl = gpr_avl_add(avl, box(547), box(6), nullptr); + avl = gpr_avl_add(avl, box(467), box(7), nullptr); + avl = gpr_avl_add(avl, box(793), box(8), nullptr); avl = remove_int(avl, 190); - avl = gpr_avl_add(avl, box(687), box(10), NULL); - avl = gpr_avl_add(avl, box(242), box(11), NULL); - avl = gpr_avl_add(avl, box(142), box(12), NULL); + avl = gpr_avl_add(avl, box(687), box(10), nullptr); + avl = gpr_avl_add(avl, box(242), box(11), nullptr); + avl = gpr_avl_add(avl, box(142), box(12), nullptr); avl = remove_int(avl, 705); avl = remove_int(avl, 578); avl = remove_int(avl, 767); avl = remove_int(avl, 183); - avl = gpr_avl_add(avl, box(950), box(17), NULL); - avl = gpr_avl_add(avl, box(622), box(18), NULL); + avl = gpr_avl_add(avl, box(950), box(17), nullptr); + avl = gpr_avl_add(avl, box(622), box(18), nullptr); avl = remove_int(avl, 513); avl = remove_int(avl, 429); - avl = gpr_avl_add(avl, box(205), box(21), NULL); + avl = gpr_avl_add(avl, box(205), box(21), nullptr); avl = remove_int(avl, 663); avl = remove_int(avl, 953); avl = remove_int(avl, 892); - avl = gpr_avl_add(avl, box(236), box(25), NULL); + avl = gpr_avl_add(avl, box(236), box(25), nullptr); avl = remove_int(avl, 982); avl = remove_int(avl, 201); avl = remove_int(avl, 684); - avl = gpr_avl_add(avl, box(572), box(29), NULL); + avl = gpr_avl_add(avl, box(572), box(29), nullptr); avl = remove_int(avl, 817); - avl = gpr_avl_add(avl, box(970), box(31), NULL); + avl = gpr_avl_add(avl, box(970), box(31), nullptr); avl = remove_int(avl, 347); avl = remove_int(avl, 574); - avl = gpr_avl_add(avl, box(752), box(34), NULL); - avl = gpr_avl_add(avl, box(670), box(35), NULL); - avl = gpr_avl_add(avl, box(69), box(36), NULL); + avl = gpr_avl_add(avl, box(752), box(34), nullptr); + avl = gpr_avl_add(avl, box(670), box(35), nullptr); + avl = gpr_avl_add(avl, box(69), box(36), nullptr); avl = remove_int(avl, 111); avl = remove_int(avl, 523); - avl = gpr_avl_add(avl, box(141), box(39), NULL); + avl = gpr_avl_add(avl, box(141), box(39), nullptr); avl = remove_int(avl, 159); - avl = gpr_avl_add(avl, box(947), box(41), NULL); - avl = gpr_avl_add(avl, box(855), box(42), NULL); + avl = gpr_avl_add(avl, box(947), box(41), nullptr); + avl = gpr_avl_add(avl, box(855), box(42), nullptr); avl = remove_int(avl, 218); avl = remove_int(avl, 6); - avl = gpr_avl_add(avl, box(753), box(45), NULL); + avl = gpr_avl_add(avl, box(753), box(45), nullptr); avl = remove_int(avl, 82); avl = remove_int(avl, 799); - avl = gpr_avl_add(avl, box(572), box(48), NULL); + avl = gpr_avl_add(avl, box(572), box(48), nullptr); avl = remove_int(avl, 376); avl = remove_int(avl, 413); - avl = gpr_avl_add(avl, box(458), box(51), NULL); + avl = gpr_avl_add(avl, box(458), box(51), nullptr); avl = remove_int(avl, 897); - avl = gpr_avl_add(avl, box(191), box(53), NULL); - avl = gpr_avl_add(avl, box(609), box(54), NULL); + avl = gpr_avl_add(avl, box(191), box(53), nullptr); + avl = gpr_avl_add(avl, box(609), box(54), nullptr); avl = remove_int(avl, 787); avl = remove_int(avl, 710); avl = remove_int(avl, 886); avl = remove_int(avl, 835); avl = remove_int(avl, 33); - avl = gpr_avl_add(avl, box(871), box(60), NULL); + avl = gpr_avl_add(avl, box(871), box(60), nullptr); avl = remove_int(avl, 641); - avl = gpr_avl_add(avl, box(462), box(62), NULL); + avl = gpr_avl_add(avl, box(462), box(62), nullptr); avl = remove_int(avl, 359); avl = remove_int(avl, 767); - avl = gpr_avl_add(avl, box(310), box(65), NULL); + avl = gpr_avl_add(avl, box(310), box(65), nullptr); avl = remove_int(avl, 757); avl = remove_int(avl, 639); avl = remove_int(avl, 314); - avl = gpr_avl_add(avl, box(2), box(69), NULL); + avl = gpr_avl_add(avl, box(2), box(69), nullptr); avl = remove_int(avl, 138); - avl = gpr_avl_add(avl, box(669), box(71), NULL); + avl = gpr_avl_add(avl, box(669), box(71), nullptr); avl = remove_int(avl, 477); - avl = gpr_avl_add(avl, box(366), box(73), NULL); - avl = gpr_avl_add(avl, box(612), box(74), NULL); - avl = gpr_avl_add(avl, box(106), box(75), NULL); + avl = gpr_avl_add(avl, box(366), box(73), nullptr); + avl = gpr_avl_add(avl, box(612), box(74), nullptr); + avl = gpr_avl_add(avl, box(106), box(75), nullptr); avl = remove_int(avl, 161); - avl = gpr_avl_add(avl, box(388), box(77), NULL); - avl = gpr_avl_add(avl, box(141), box(78), NULL); + avl = gpr_avl_add(avl, box(388), box(77), nullptr); + avl = gpr_avl_add(avl, box(141), box(78), nullptr); avl = remove_int(avl, 633); avl = remove_int(avl, 459); - avl = gpr_avl_add(avl, box(40), box(81), NULL); + avl = gpr_avl_add(avl, box(40), box(81), nullptr); avl = remove_int(avl, 689); - avl = gpr_avl_add(avl, box(823), box(83), NULL); + avl = gpr_avl_add(avl, box(823), box(83), nullptr); avl = remove_int(avl, 485); - avl = gpr_avl_add(avl, box(903), box(85), NULL); - avl = gpr_avl_add(avl, box(592), box(86), NULL); + avl = gpr_avl_add(avl, box(903), box(85), nullptr); + avl = gpr_avl_add(avl, box(592), box(86), nullptr); avl = remove_int(avl, 448); - avl = gpr_avl_add(avl, box(56), box(88), NULL); + avl = gpr_avl_add(avl, box(56), box(88), nullptr); avl = remove_int(avl, 333); - avl = gpr_avl_add(avl, box(189), box(90), NULL); - avl = gpr_avl_add(avl, box(103), box(91), NULL); + avl = gpr_avl_add(avl, box(189), box(90), nullptr); + avl = gpr_avl_add(avl, box(103), box(91), nullptr); avl = remove_int(avl, 164); avl = remove_int(avl, 974); - avl = gpr_avl_add(avl, box(215), box(94), NULL); + avl = gpr_avl_add(avl, box(215), box(94), nullptr); avl = remove_int(avl, 189); avl = remove_int(avl, 504); - avl = gpr_avl_add(avl, box(868), box(97), NULL); + avl = gpr_avl_add(avl, box(868), box(97), nullptr); avl = remove_int(avl, 909); avl = remove_int(avl, 148); avl = remove_int(avl, 469); - avl = gpr_avl_add(avl, box(994), box(101), NULL); - avl = gpr_avl_add(avl, box(576), box(102), NULL); + avl = gpr_avl_add(avl, box(994), box(101), nullptr); + avl = gpr_avl_add(avl, box(576), box(102), nullptr); avl = remove_int(avl, 82); avl = remove_int(avl, 209); - avl = gpr_avl_add(avl, box(276), box(105), NULL); + avl = gpr_avl_add(avl, box(276), box(105), nullptr); avl = remove_int(avl, 856); - avl = gpr_avl_add(avl, box(750), box(107), NULL); + avl = gpr_avl_add(avl, box(750), box(107), nullptr); avl = remove_int(avl, 871); - avl = gpr_avl_add(avl, box(301), box(109), NULL); + avl = gpr_avl_add(avl, box(301), box(109), nullptr); avl = remove_int(avl, 260); avl = remove_int(avl, 737); avl = remove_int(avl, 719); - avl = gpr_avl_add(avl, box(933), box(113), NULL); - avl = gpr_avl_add(avl, box(225), box(114), NULL); - avl = gpr_avl_add(avl, box(975), box(115), NULL); - avl = gpr_avl_add(avl, box(86), box(116), NULL); + avl = gpr_avl_add(avl, box(933), box(113), nullptr); + avl = gpr_avl_add(avl, box(225), box(114), nullptr); + avl = gpr_avl_add(avl, box(975), box(115), nullptr); + avl = gpr_avl_add(avl, box(86), box(116), nullptr); avl = remove_int(avl, 732); - avl = gpr_avl_add(avl, box(340), box(118), NULL); - avl = gpr_avl_add(avl, box(271), box(119), NULL); + avl = gpr_avl_add(avl, box(340), box(118), nullptr); + avl = gpr_avl_add(avl, box(271), box(119), nullptr); avl = remove_int(avl, 206); - avl = gpr_avl_add(avl, box(949), box(121), NULL); - avl = gpr_avl_add(avl, box(927), box(122), NULL); - avl = gpr_avl_add(avl, box(34), box(123), NULL); - avl = gpr_avl_add(avl, box(351), box(124), NULL); + avl = gpr_avl_add(avl, box(949), box(121), nullptr); + avl = gpr_avl_add(avl, box(927), box(122), nullptr); + avl = gpr_avl_add(avl, box(34), box(123), nullptr); + avl = gpr_avl_add(avl, box(351), box(124), nullptr); avl = remove_int(avl, 836); - avl = gpr_avl_add(avl, box(825), box(126), NULL); - avl = gpr_avl_add(avl, box(352), box(127), NULL); + avl = gpr_avl_add(avl, box(825), box(126), nullptr); + avl = gpr_avl_add(avl, box(352), box(127), nullptr); avl = remove_int(avl, 107); avl = remove_int(avl, 101); - avl = gpr_avl_add(avl, box(320), box(130), NULL); - avl = gpr_avl_add(avl, box(3), box(131), NULL); + avl = gpr_avl_add(avl, box(320), box(130), nullptr); + avl = gpr_avl_add(avl, box(3), box(131), nullptr); avl = remove_int(avl, 998); avl = remove_int(avl, 44); - avl = gpr_avl_add(avl, box(525), box(134), NULL); - avl = gpr_avl_add(avl, box(864), box(135), NULL); - avl = gpr_avl_add(avl, box(863), box(136), NULL); + avl = gpr_avl_add(avl, box(525), box(134), nullptr); + avl = gpr_avl_add(avl, box(864), box(135), nullptr); + avl = gpr_avl_add(avl, box(863), box(136), nullptr); avl = remove_int(avl, 770); - avl = gpr_avl_add(avl, box(440), box(138), NULL); + avl = gpr_avl_add(avl, box(440), box(138), nullptr); avl = remove_int(avl, 516); - avl = gpr_avl_add(avl, box(116), box(140), NULL); + avl = gpr_avl_add(avl, box(116), box(140), nullptr); avl = remove_int(avl, 380); - avl = gpr_avl_add(avl, box(878), box(142), NULL); + avl = gpr_avl_add(avl, box(878), box(142), nullptr); avl = remove_int(avl, 439); - avl = gpr_avl_add(avl, box(994), box(144), NULL); + avl = gpr_avl_add(avl, box(994), box(144), nullptr); avl = remove_int(avl, 294); avl = remove_int(avl, 593); - avl = gpr_avl_add(avl, box(696), box(147), NULL); + avl = gpr_avl_add(avl, box(696), box(147), nullptr); avl = remove_int(avl, 8); - avl = gpr_avl_add(avl, box(881), box(149), NULL); + avl = gpr_avl_add(avl, box(881), box(149), nullptr); avl = remove_int(avl, 32); avl = remove_int(avl, 242); - avl = gpr_avl_add(avl, box(487), box(152), NULL); - avl = gpr_avl_add(avl, box(637), box(153), NULL); - avl = gpr_avl_add(avl, box(793), box(154), NULL); - avl = gpr_avl_add(avl, box(696), box(155), NULL); + avl = gpr_avl_add(avl, box(487), box(152), nullptr); + avl = gpr_avl_add(avl, box(637), box(153), nullptr); + avl = gpr_avl_add(avl, box(793), box(154), nullptr); + avl = gpr_avl_add(avl, box(696), box(155), nullptr); avl = remove_int(avl, 458); - avl = gpr_avl_add(avl, box(828), box(157), NULL); + avl = gpr_avl_add(avl, box(828), box(157), nullptr); avl = remove_int(avl, 784); avl = remove_int(avl, 274); - avl = gpr_avl_add(avl, box(783), box(160), NULL); + avl = gpr_avl_add(avl, box(783), box(160), nullptr); avl = remove_int(avl, 21); - avl = gpr_avl_add(avl, box(866), box(162), NULL); + avl = gpr_avl_add(avl, box(866), box(162), nullptr); avl = remove_int(avl, 919); - avl = gpr_avl_add(avl, box(435), box(164), NULL); + avl = gpr_avl_add(avl, box(435), box(164), nullptr); avl = remove_int(avl, 385); - avl = gpr_avl_add(avl, box(475), box(166), NULL); + avl = gpr_avl_add(avl, box(475), box(166), nullptr); avl = remove_int(avl, 339); - avl = gpr_avl_add(avl, box(615), box(168), NULL); + avl = gpr_avl_add(avl, box(615), box(168), nullptr); avl = remove_int(avl, 866); avl = remove_int(avl, 82); avl = remove_int(avl, 271); - avl = gpr_avl_add(avl, box(590), box(172), NULL); - avl = gpr_avl_add(avl, box(852), box(173), NULL); + avl = gpr_avl_add(avl, box(590), box(172), nullptr); + avl = gpr_avl_add(avl, box(852), box(173), nullptr); avl = remove_int(avl, 318); avl = remove_int(avl, 82); - avl = gpr_avl_add(avl, box(672), box(176), NULL); + avl = gpr_avl_add(avl, box(672), box(176), nullptr); avl = remove_int(avl, 430); - avl = gpr_avl_add(avl, box(821), box(178), NULL); - avl = gpr_avl_add(avl, box(365), box(179), NULL); + avl = gpr_avl_add(avl, box(821), box(178), nullptr); + avl = gpr_avl_add(avl, box(365), box(179), nullptr); avl = remove_int(avl, 78); - avl = gpr_avl_add(avl, box(700), box(181), NULL); - avl = gpr_avl_add(avl, box(353), box(182), NULL); + avl = gpr_avl_add(avl, box(700), box(181), nullptr); + avl = gpr_avl_add(avl, box(353), box(182), nullptr); avl = remove_int(avl, 492); - avl = gpr_avl_add(avl, box(991), box(184), NULL); + avl = gpr_avl_add(avl, box(991), box(184), nullptr); avl = remove_int(avl, 330); - avl = gpr_avl_add(avl, box(873), box(186), NULL); + avl = gpr_avl_add(avl, box(873), box(186), nullptr); avl = remove_int(avl, 589); - avl = gpr_avl_add(avl, box(676), box(188), NULL); - avl = gpr_avl_add(avl, box(790), box(189), NULL); + avl = gpr_avl_add(avl, box(676), box(188), nullptr); + avl = gpr_avl_add(avl, box(790), box(189), nullptr); avl = remove_int(avl, 521); avl = remove_int(avl, 47); - avl = gpr_avl_add(avl, box(976), box(192), NULL); - avl = gpr_avl_add(avl, box(683), box(193), NULL); + avl = gpr_avl_add(avl, box(976), box(192), nullptr); + avl = gpr_avl_add(avl, box(683), box(193), nullptr); avl = remove_int(avl, 803); avl = remove_int(avl, 1006); - avl = gpr_avl_add(avl, box(775), box(196), NULL); - avl = gpr_avl_add(avl, box(411), box(197), NULL); - avl = gpr_avl_add(avl, box(697), box(198), NULL); + avl = gpr_avl_add(avl, box(775), box(196), nullptr); + avl = gpr_avl_add(avl, box(411), box(197), nullptr); + avl = gpr_avl_add(avl, box(697), box(198), nullptr); avl = remove_int(avl, 50); - avl = gpr_avl_add(avl, box(213), box(200), NULL); + avl = gpr_avl_add(avl, box(213), box(200), nullptr); avl = remove_int(avl, 714); - avl = gpr_avl_add(avl, box(981), box(202), NULL); - avl = gpr_avl_add(avl, box(502), box(203), NULL); - avl = gpr_avl_add(avl, box(697), box(204), NULL); - avl = gpr_avl_add(avl, box(603), box(205), NULL); - avl = gpr_avl_add(avl, box(117), box(206), NULL); + avl = gpr_avl_add(avl, box(981), box(202), nullptr); + avl = gpr_avl_add(avl, box(502), box(203), nullptr); + avl = gpr_avl_add(avl, box(697), box(204), nullptr); + avl = gpr_avl_add(avl, box(603), box(205), nullptr); + avl = gpr_avl_add(avl, box(117), box(206), nullptr); avl = remove_int(avl, 363); - avl = gpr_avl_add(avl, box(104), box(208), NULL); + avl = gpr_avl_add(avl, box(104), box(208), nullptr); avl = remove_int(avl, 842); - avl = gpr_avl_add(avl, box(48), box(210), NULL); + avl = gpr_avl_add(avl, box(48), box(210), nullptr); avl = remove_int(avl, 764); - avl = gpr_avl_add(avl, box(482), box(212), NULL); - avl = gpr_avl_add(avl, box(928), box(213), NULL); - avl = gpr_avl_add(avl, box(30), box(214), NULL); - avl = gpr_avl_add(avl, box(820), box(215), NULL); - avl = gpr_avl_add(avl, box(334), box(216), NULL); + avl = gpr_avl_add(avl, box(482), box(212), nullptr); + avl = gpr_avl_add(avl, box(928), box(213), nullptr); + avl = gpr_avl_add(avl, box(30), box(214), nullptr); + avl = gpr_avl_add(avl, box(820), box(215), nullptr); + avl = gpr_avl_add(avl, box(334), box(216), nullptr); avl = remove_int(avl, 306); - avl = gpr_avl_add(avl, box(789), box(218), NULL); + avl = gpr_avl_add(avl, box(789), box(218), nullptr); avl = remove_int(avl, 924); - avl = gpr_avl_add(avl, box(53), box(220), NULL); + avl = gpr_avl_add(avl, box(53), box(220), nullptr); avl = remove_int(avl, 657); - avl = gpr_avl_add(avl, box(130), box(222), NULL); - avl = gpr_avl_add(avl, box(239), box(223), NULL); + avl = gpr_avl_add(avl, box(130), box(222), nullptr); + avl = gpr_avl_add(avl, box(239), box(223), nullptr); avl = remove_int(avl, 20); - avl = gpr_avl_add(avl, box(117), box(225), NULL); + avl = gpr_avl_add(avl, box(117), box(225), nullptr); avl = remove_int(avl, 882); avl = remove_int(avl, 891); - avl = gpr_avl_add(avl, box(9), box(228), NULL); - avl = gpr_avl_add(avl, box(496), box(229), NULL); - avl = gpr_avl_add(avl, box(750), box(230), NULL); - avl = gpr_avl_add(avl, box(283), box(231), NULL); - avl = gpr_avl_add(avl, box(802), box(232), NULL); + avl = gpr_avl_add(avl, box(9), box(228), nullptr); + avl = gpr_avl_add(avl, box(496), box(229), nullptr); + avl = gpr_avl_add(avl, box(750), box(230), nullptr); + avl = gpr_avl_add(avl, box(283), box(231), nullptr); + avl = gpr_avl_add(avl, box(802), box(232), nullptr); avl = remove_int(avl, 352); - avl = gpr_avl_add(avl, box(374), box(234), NULL); - avl = gpr_avl_add(avl, box(6), box(235), NULL); - avl = gpr_avl_add(avl, box(756), box(236), NULL); - avl = gpr_avl_add(avl, box(597), box(237), NULL); - avl = gpr_avl_add(avl, box(661), box(238), NULL); + avl = gpr_avl_add(avl, box(374), box(234), nullptr); + avl = gpr_avl_add(avl, box(6), box(235), nullptr); + avl = gpr_avl_add(avl, box(756), box(236), nullptr); + avl = gpr_avl_add(avl, box(597), box(237), nullptr); + avl = gpr_avl_add(avl, box(661), box(238), nullptr); avl = remove_int(avl, 96); - avl = gpr_avl_add(avl, box(894), box(240), NULL); + avl = gpr_avl_add(avl, box(894), box(240), nullptr); avl = remove_int(avl, 749); - avl = gpr_avl_add(avl, box(71), box(242), NULL); + avl = gpr_avl_add(avl, box(71), box(242), nullptr); avl = remove_int(avl, 68); - avl = gpr_avl_add(avl, box(388), box(244), NULL); + avl = gpr_avl_add(avl, box(388), box(244), nullptr); avl = remove_int(avl, 119); avl = remove_int(avl, 856); - avl = gpr_avl_add(avl, box(176), box(247), NULL); - avl = gpr_avl_add(avl, box(993), box(248), NULL); + avl = gpr_avl_add(avl, box(176), box(247), nullptr); + avl = gpr_avl_add(avl, box(993), box(248), nullptr); avl = remove_int(avl, 178); avl = remove_int(avl, 781); avl = remove_int(avl, 771); @@ -501,37 +501,37 @@ static void test_badcase2(void) { avl = remove_int(avl, 157); avl = remove_int(avl, 142); avl = remove_int(avl, 686); - avl = gpr_avl_add(avl, box(779), box(257), NULL); - avl = gpr_avl_add(avl, box(484), box(258), NULL); + avl = gpr_avl_add(avl, box(779), box(257), nullptr); + avl = gpr_avl_add(avl, box(484), box(258), nullptr); avl = remove_int(avl, 837); - avl = gpr_avl_add(avl, box(388), box(260), NULL); + avl = gpr_avl_add(avl, box(388), box(260), nullptr); avl = remove_int(avl, 987); - avl = gpr_avl_add(avl, box(336), box(262), NULL); + avl = gpr_avl_add(avl, box(336), box(262), nullptr); avl = remove_int(avl, 855); - avl = gpr_avl_add(avl, box(668), box(264), NULL); + avl = gpr_avl_add(avl, box(668), box(264), nullptr); avl = remove_int(avl, 648); - avl = gpr_avl_add(avl, box(193), box(266), NULL); + avl = gpr_avl_add(avl, box(193), box(266), nullptr); avl = remove_int(avl, 939); - avl = gpr_avl_add(avl, box(740), box(268), NULL); - avl = gpr_avl_add(avl, box(503), box(269), NULL); - avl = gpr_avl_add(avl, box(765), box(270), NULL); + avl = gpr_avl_add(avl, box(740), box(268), nullptr); + avl = gpr_avl_add(avl, box(503), box(269), nullptr); + avl = gpr_avl_add(avl, box(765), box(270), nullptr); avl = remove_int(avl, 924); avl = remove_int(avl, 513); - avl = gpr_avl_add(avl, box(161), box(273), NULL); - avl = gpr_avl_add(avl, box(502), box(274), NULL); - avl = gpr_avl_add(avl, box(846), box(275), NULL); + avl = gpr_avl_add(avl, box(161), box(273), nullptr); + avl = gpr_avl_add(avl, box(502), box(274), nullptr); + avl = gpr_avl_add(avl, box(846), box(275), nullptr); avl = remove_int(avl, 931); - avl = gpr_avl_add(avl, box(87), box(277), NULL); - avl = gpr_avl_add(avl, box(949), box(278), NULL); - avl = gpr_avl_add(avl, box(548), box(279), NULL); - avl = gpr_avl_add(avl, box(951), box(280), NULL); + avl = gpr_avl_add(avl, box(87), box(277), nullptr); + avl = gpr_avl_add(avl, box(949), box(278), nullptr); + avl = gpr_avl_add(avl, box(548), box(279), nullptr); + avl = gpr_avl_add(avl, box(951), box(280), nullptr); avl = remove_int(avl, 1018); avl = remove_int(avl, 568); - avl = gpr_avl_add(avl, box(138), box(283), NULL); - avl = gpr_avl_add(avl, box(202), box(284), NULL); - avl = gpr_avl_add(avl, box(157), box(285), NULL); - avl = gpr_avl_add(avl, box(264), box(286), NULL); - avl = gpr_avl_add(avl, box(370), box(287), NULL); + avl = gpr_avl_add(avl, box(138), box(283), nullptr); + avl = gpr_avl_add(avl, box(202), box(284), nullptr); + avl = gpr_avl_add(avl, box(157), box(285), nullptr); + avl = gpr_avl_add(avl, box(264), box(286), nullptr); + avl = gpr_avl_add(avl, box(370), box(287), nullptr); avl = remove_int(avl, 736); avl = remove_int(avl, 751); avl = remove_int(avl, 506); @@ -539,524 +539,524 @@ static void test_badcase2(void) { avl = remove_int(avl, 358); avl = remove_int(avl, 657); avl = remove_int(avl, 86); - avl = gpr_avl_add(avl, box(876), box(295), NULL); + avl = gpr_avl_add(avl, box(876), box(295), nullptr); avl = remove_int(avl, 354); - avl = gpr_avl_add(avl, box(134), box(297), NULL); + avl = gpr_avl_add(avl, box(134), box(297), nullptr); avl = remove_int(avl, 781); avl = remove_int(avl, 183); - avl = gpr_avl_add(avl, box(914), box(300), NULL); + avl = gpr_avl_add(avl, box(914), box(300), nullptr); avl = remove_int(avl, 926); avl = remove_int(avl, 398); avl = remove_int(avl, 932); avl = remove_int(avl, 804); avl = remove_int(avl, 326); - avl = gpr_avl_add(avl, box(208), box(306), NULL); - avl = gpr_avl_add(avl, box(699), box(307), NULL); + avl = gpr_avl_add(avl, box(208), box(306), nullptr); + avl = gpr_avl_add(avl, box(699), box(307), nullptr); avl = remove_int(avl, 576); avl = remove_int(avl, 850); avl = remove_int(avl, 514); avl = remove_int(avl, 676); avl = remove_int(avl, 549); avl = remove_int(avl, 767); - avl = gpr_avl_add(avl, box(58), box(314), NULL); - avl = gpr_avl_add(avl, box(265), box(315), NULL); - avl = gpr_avl_add(avl, box(268), box(316), NULL); - avl = gpr_avl_add(avl, box(103), box(317), NULL); - avl = gpr_avl_add(avl, box(440), box(318), NULL); + avl = gpr_avl_add(avl, box(58), box(314), nullptr); + avl = gpr_avl_add(avl, box(265), box(315), nullptr); + avl = gpr_avl_add(avl, box(268), box(316), nullptr); + avl = gpr_avl_add(avl, box(103), box(317), nullptr); + avl = gpr_avl_add(avl, box(440), box(318), nullptr); avl = remove_int(avl, 777); - avl = gpr_avl_add(avl, box(670), box(320), NULL); + avl = gpr_avl_add(avl, box(670), box(320), nullptr); avl = remove_int(avl, 506); avl = remove_int(avl, 487); - avl = gpr_avl_add(avl, box(421), box(323), NULL); + avl = gpr_avl_add(avl, box(421), box(323), nullptr); avl = remove_int(avl, 514); - avl = gpr_avl_add(avl, box(701), box(325), NULL); + avl = gpr_avl_add(avl, box(701), box(325), nullptr); avl = remove_int(avl, 949); avl = remove_int(avl, 872); avl = remove_int(avl, 139); - avl = gpr_avl_add(avl, box(781), box(329), NULL); - avl = gpr_avl_add(avl, box(543), box(330), NULL); - avl = gpr_avl_add(avl, box(147), box(331), NULL); + avl = gpr_avl_add(avl, box(781), box(329), nullptr); + avl = gpr_avl_add(avl, box(543), box(330), nullptr); + avl = gpr_avl_add(avl, box(147), box(331), nullptr); avl = remove_int(avl, 190); - avl = gpr_avl_add(avl, box(453), box(333), NULL); + avl = gpr_avl_add(avl, box(453), box(333), nullptr); avl = remove_int(avl, 262); avl = remove_int(avl, 850); avl = remove_int(avl, 286); avl = remove_int(avl, 787); - avl = gpr_avl_add(avl, box(514), box(338), NULL); + avl = gpr_avl_add(avl, box(514), box(338), nullptr); avl = remove_int(avl, 812); - avl = gpr_avl_add(avl, box(431), box(340), NULL); - avl = gpr_avl_add(avl, box(8), box(341), NULL); + avl = gpr_avl_add(avl, box(431), box(340), nullptr); + avl = gpr_avl_add(avl, box(8), box(341), nullptr); avl = remove_int(avl, 843); - avl = gpr_avl_add(avl, box(831), box(343), NULL); + avl = gpr_avl_add(avl, box(831), box(343), nullptr); avl = remove_int(avl, 472); avl = remove_int(avl, 157); - avl = gpr_avl_add(avl, box(612), box(346), NULL); - avl = gpr_avl_add(avl, box(802), box(347), NULL); + avl = gpr_avl_add(avl, box(612), box(346), nullptr); + avl = gpr_avl_add(avl, box(802), box(347), nullptr); avl = remove_int(avl, 554); - avl = gpr_avl_add(avl, box(409), box(349), NULL); - avl = gpr_avl_add(avl, box(439), box(350), NULL); - avl = gpr_avl_add(avl, box(725), box(351), NULL); - avl = gpr_avl_add(avl, box(568), box(352), NULL); + avl = gpr_avl_add(avl, box(409), box(349), nullptr); + avl = gpr_avl_add(avl, box(439), box(350), nullptr); + avl = gpr_avl_add(avl, box(725), box(351), nullptr); + avl = gpr_avl_add(avl, box(568), box(352), nullptr); avl = remove_int(avl, 475); avl = remove_int(avl, 672); avl = remove_int(avl, 62); avl = remove_int(avl, 753); - avl = gpr_avl_add(avl, box(435), box(357), NULL); - avl = gpr_avl_add(avl, box(950), box(358), NULL); - avl = gpr_avl_add(avl, box(532), box(359), NULL); - avl = gpr_avl_add(avl, box(832), box(360), NULL); + avl = gpr_avl_add(avl, box(435), box(357), nullptr); + avl = gpr_avl_add(avl, box(950), box(358), nullptr); + avl = gpr_avl_add(avl, box(532), box(359), nullptr); + avl = gpr_avl_add(avl, box(832), box(360), nullptr); avl = remove_int(avl, 390); - avl = gpr_avl_add(avl, box(993), box(362), NULL); + avl = gpr_avl_add(avl, box(993), box(362), nullptr); avl = remove_int(avl, 198); avl = remove_int(avl, 401); - avl = gpr_avl_add(avl, box(316), box(365), NULL); + avl = gpr_avl_add(avl, box(316), box(365), nullptr); avl = remove_int(avl, 843); - avl = gpr_avl_add(avl, box(541), box(367), NULL); - avl = gpr_avl_add(avl, box(505), box(368), NULL); + avl = gpr_avl_add(avl, box(541), box(367), nullptr); + avl = gpr_avl_add(avl, box(505), box(368), nullptr); avl = remove_int(avl, 445); avl = remove_int(avl, 256); - avl = gpr_avl_add(avl, box(232), box(371), NULL); + avl = gpr_avl_add(avl, box(232), box(371), nullptr); avl = remove_int(avl, 577); avl = remove_int(avl, 558); - avl = gpr_avl_add(avl, box(910), box(374), NULL); + avl = gpr_avl_add(avl, box(910), box(374), nullptr); avl = remove_int(avl, 902); avl = remove_int(avl, 755); avl = remove_int(avl, 114); avl = remove_int(avl, 438); avl = remove_int(avl, 224); - avl = gpr_avl_add(avl, box(920), box(380), NULL); - avl = gpr_avl_add(avl, box(655), box(381), NULL); + avl = gpr_avl_add(avl, box(920), box(380), nullptr); + avl = gpr_avl_add(avl, box(655), box(381), nullptr); avl = remove_int(avl, 557); avl = remove_int(avl, 102); avl = remove_int(avl, 165); - avl = gpr_avl_add(avl, box(191), box(385), NULL); + avl = gpr_avl_add(avl, box(191), box(385), nullptr); avl = remove_int(avl, 30); - avl = gpr_avl_add(avl, box(406), box(387), NULL); - avl = gpr_avl_add(avl, box(66), box(388), NULL); - avl = gpr_avl_add(avl, box(87), box(389), NULL); + avl = gpr_avl_add(avl, box(406), box(387), nullptr); + avl = gpr_avl_add(avl, box(66), box(388), nullptr); + avl = gpr_avl_add(avl, box(87), box(389), nullptr); avl = remove_int(avl, 7); avl = remove_int(avl, 671); - avl = gpr_avl_add(avl, box(234), box(392), NULL); + avl = gpr_avl_add(avl, box(234), box(392), nullptr); avl = remove_int(avl, 463); - avl = gpr_avl_add(avl, box(75), box(394), NULL); - avl = gpr_avl_add(avl, box(487), box(395), NULL); + avl = gpr_avl_add(avl, box(75), box(394), nullptr); + avl = gpr_avl_add(avl, box(487), box(395), nullptr); avl = remove_int(avl, 203); - avl = gpr_avl_add(avl, box(711), box(397), NULL); + avl = gpr_avl_add(avl, box(711), box(397), nullptr); avl = remove_int(avl, 291); avl = remove_int(avl, 798); avl = remove_int(avl, 337); - avl = gpr_avl_add(avl, box(877), box(401), NULL); - avl = gpr_avl_add(avl, box(388), box(402), NULL); + avl = gpr_avl_add(avl, box(877), box(401), nullptr); + avl = gpr_avl_add(avl, box(388), box(402), nullptr); avl = remove_int(avl, 975); - avl = gpr_avl_add(avl, box(200), box(404), NULL); - avl = gpr_avl_add(avl, box(408), box(405), NULL); - avl = gpr_avl_add(avl, box(3), box(406), NULL); - avl = gpr_avl_add(avl, box(971), box(407), NULL); + avl = gpr_avl_add(avl, box(200), box(404), nullptr); + avl = gpr_avl_add(avl, box(408), box(405), nullptr); + avl = gpr_avl_add(avl, box(3), box(406), nullptr); + avl = gpr_avl_add(avl, box(971), box(407), nullptr); avl = remove_int(avl, 841); avl = remove_int(avl, 910); avl = remove_int(avl, 74); avl = remove_int(avl, 888); - avl = gpr_avl_add(avl, box(492), box(412), NULL); + avl = gpr_avl_add(avl, box(492), box(412), nullptr); avl = remove_int(avl, 14); avl = remove_int(avl, 364); - avl = gpr_avl_add(avl, box(215), box(415), NULL); + avl = gpr_avl_add(avl, box(215), box(415), nullptr); avl = remove_int(avl, 778); avl = remove_int(avl, 45); - avl = gpr_avl_add(avl, box(328), box(418), NULL); - avl = gpr_avl_add(avl, box(597), box(419), NULL); + avl = gpr_avl_add(avl, box(328), box(418), nullptr); + avl = gpr_avl_add(avl, box(597), box(419), nullptr); avl = remove_int(avl, 34); - avl = gpr_avl_add(avl, box(736), box(421), NULL); + avl = gpr_avl_add(avl, box(736), box(421), nullptr); avl = remove_int(avl, 37); - avl = gpr_avl_add(avl, box(275), box(423), NULL); - avl = gpr_avl_add(avl, box(70), box(424), NULL); - avl = gpr_avl_add(avl, box(771), box(425), NULL); + avl = gpr_avl_add(avl, box(275), box(423), nullptr); + avl = gpr_avl_add(avl, box(70), box(424), nullptr); + avl = gpr_avl_add(avl, box(771), box(425), nullptr); avl = remove_int(avl, 536); avl = remove_int(avl, 421); - avl = gpr_avl_add(avl, box(186), box(428), NULL); - avl = gpr_avl_add(avl, box(788), box(429), NULL); - avl = gpr_avl_add(avl, box(224), box(430), NULL); + avl = gpr_avl_add(avl, box(186), box(428), nullptr); + avl = gpr_avl_add(avl, box(788), box(429), nullptr); + avl = gpr_avl_add(avl, box(224), box(430), nullptr); avl = remove_int(avl, 228); - avl = gpr_avl_add(avl, box(48), box(432), NULL); - avl = gpr_avl_add(avl, box(120), box(433), NULL); - avl = gpr_avl_add(avl, box(269), box(434), NULL); - avl = gpr_avl_add(avl, box(904), box(435), NULL); + avl = gpr_avl_add(avl, box(48), box(432), nullptr); + avl = gpr_avl_add(avl, box(120), box(433), nullptr); + avl = gpr_avl_add(avl, box(269), box(434), nullptr); + avl = gpr_avl_add(avl, box(904), box(435), nullptr); avl = remove_int(avl, 699); - avl = gpr_avl_add(avl, box(340), box(437), NULL); + avl = gpr_avl_add(avl, box(340), box(437), nullptr); avl = remove_int(avl, 276); - avl = gpr_avl_add(avl, box(591), box(439), NULL); - avl = gpr_avl_add(avl, box(778), box(440), NULL); + avl = gpr_avl_add(avl, box(591), box(439), nullptr); + avl = gpr_avl_add(avl, box(778), box(440), nullptr); avl = remove_int(avl, 490); avl = remove_int(avl, 973); - avl = gpr_avl_add(avl, box(294), box(443), NULL); - avl = gpr_avl_add(avl, box(323), box(444), NULL); + avl = gpr_avl_add(avl, box(294), box(443), nullptr); + avl = gpr_avl_add(avl, box(323), box(444), nullptr); avl = remove_int(avl, 685); - avl = gpr_avl_add(avl, box(38), box(446), NULL); - avl = gpr_avl_add(avl, box(525), box(447), NULL); + avl = gpr_avl_add(avl, box(38), box(446), nullptr); + avl = gpr_avl_add(avl, box(525), box(447), nullptr); avl = remove_int(avl, 162); - avl = gpr_avl_add(avl, box(462), box(449), NULL); - avl = gpr_avl_add(avl, box(340), box(450), NULL); + avl = gpr_avl_add(avl, box(462), box(449), nullptr); + avl = gpr_avl_add(avl, box(340), box(450), nullptr); avl = remove_int(avl, 734); avl = remove_int(avl, 959); - avl = gpr_avl_add(avl, box(752), box(453), NULL); - avl = gpr_avl_add(avl, box(667), box(454), NULL); + avl = gpr_avl_add(avl, box(752), box(453), nullptr); + avl = gpr_avl_add(avl, box(667), box(454), nullptr); avl = remove_int(avl, 558); avl = remove_int(avl, 657); - avl = gpr_avl_add(avl, box(711), box(457), NULL); + avl = gpr_avl_add(avl, box(711), box(457), nullptr); avl = remove_int(avl, 937); - avl = gpr_avl_add(avl, box(741), box(459), NULL); - avl = gpr_avl_add(avl, box(40), box(460), NULL); + avl = gpr_avl_add(avl, box(741), box(459), nullptr); + avl = gpr_avl_add(avl, box(40), box(460), nullptr); avl = remove_int(avl, 784); - avl = gpr_avl_add(avl, box(292), box(462), NULL); + avl = gpr_avl_add(avl, box(292), box(462), nullptr); avl = remove_int(avl, 164); avl = remove_int(avl, 931); avl = remove_int(avl, 886); - avl = gpr_avl_add(avl, box(968), box(466), NULL); + avl = gpr_avl_add(avl, box(968), box(466), nullptr); avl = remove_int(avl, 263); - avl = gpr_avl_add(avl, box(647), box(468), NULL); - avl = gpr_avl_add(avl, box(92), box(469), NULL); + avl = gpr_avl_add(avl, box(647), box(468), nullptr); + avl = gpr_avl_add(avl, box(92), box(469), nullptr); avl = remove_int(avl, 310); - avl = gpr_avl_add(avl, box(711), box(471), NULL); - avl = gpr_avl_add(avl, box(675), box(472), NULL); + avl = gpr_avl_add(avl, box(711), box(471), nullptr); + avl = gpr_avl_add(avl, box(675), box(472), nullptr); avl = remove_int(avl, 549); - avl = gpr_avl_add(avl, box(380), box(474), NULL); + avl = gpr_avl_add(avl, box(380), box(474), nullptr); avl = remove_int(avl, 825); - avl = gpr_avl_add(avl, box(668), box(476), NULL); + avl = gpr_avl_add(avl, box(668), box(476), nullptr); avl = remove_int(avl, 498); - avl = gpr_avl_add(avl, box(870), box(478), NULL); - avl = gpr_avl_add(avl, box(391), box(479), NULL); - avl = gpr_avl_add(avl, box(264), box(480), NULL); + avl = gpr_avl_add(avl, box(870), box(478), nullptr); + avl = gpr_avl_add(avl, box(391), box(479), nullptr); + avl = gpr_avl_add(avl, box(264), box(480), nullptr); avl = remove_int(avl, 1); avl = remove_int(avl, 849); avl = remove_int(avl, 88); avl = remove_int(avl, 255); avl = remove_int(avl, 763); avl = remove_int(avl, 831); - avl = gpr_avl_add(avl, box(508), box(487), NULL); + avl = gpr_avl_add(avl, box(508), box(487), nullptr); avl = remove_int(avl, 849); avl = remove_int(avl, 47); - avl = gpr_avl_add(avl, box(299), box(490), NULL); + avl = gpr_avl_add(avl, box(299), box(490), nullptr); avl = remove_int(avl, 625); avl = remove_int(avl, 433); avl = remove_int(avl, 904); avl = remove_int(avl, 761); - avl = gpr_avl_add(avl, box(33), box(495), NULL); - avl = gpr_avl_add(avl, box(524), box(496), NULL); + avl = gpr_avl_add(avl, box(33), box(495), nullptr); + avl = gpr_avl_add(avl, box(524), box(496), nullptr); avl = remove_int(avl, 210); avl = remove_int(avl, 299); - avl = gpr_avl_add(avl, box(823), box(499), NULL); + avl = gpr_avl_add(avl, box(823), box(499), nullptr); avl = remove_int(avl, 479); avl = remove_int(avl, 96); avl = remove_int(avl, 1013); - avl = gpr_avl_add(avl, box(768), box(503), NULL); + avl = gpr_avl_add(avl, box(768), box(503), nullptr); avl = remove_int(avl, 638); avl = remove_int(avl, 20); - avl = gpr_avl_add(avl, box(663), box(506), NULL); + avl = gpr_avl_add(avl, box(663), box(506), nullptr); avl = remove_int(avl, 882); - avl = gpr_avl_add(avl, box(745), box(508), NULL); + avl = gpr_avl_add(avl, box(745), box(508), nullptr); avl = remove_int(avl, 352); - avl = gpr_avl_add(avl, box(10), box(510), NULL); + avl = gpr_avl_add(avl, box(10), box(510), nullptr); avl = remove_int(avl, 484); - avl = gpr_avl_add(avl, box(420), box(512), NULL); - avl = gpr_avl_add(avl, box(884), box(513), NULL); - avl = gpr_avl_add(avl, box(993), box(514), NULL); - avl = gpr_avl_add(avl, box(251), box(515), NULL); + avl = gpr_avl_add(avl, box(420), box(512), nullptr); + avl = gpr_avl_add(avl, box(884), box(513), nullptr); + avl = gpr_avl_add(avl, box(993), box(514), nullptr); + avl = gpr_avl_add(avl, box(251), box(515), nullptr); avl = remove_int(avl, 222); - avl = gpr_avl_add(avl, box(734), box(517), NULL); - avl = gpr_avl_add(avl, box(952), box(518), NULL); + avl = gpr_avl_add(avl, box(734), box(517), nullptr); + avl = gpr_avl_add(avl, box(952), box(518), nullptr); avl = remove_int(avl, 26); avl = remove_int(avl, 270); avl = remove_int(avl, 481); avl = remove_int(avl, 693); avl = remove_int(avl, 1006); - avl = gpr_avl_add(avl, box(77), box(524), NULL); + avl = gpr_avl_add(avl, box(77), box(524), nullptr); avl = remove_int(avl, 897); - avl = gpr_avl_add(avl, box(719), box(526), NULL); - avl = gpr_avl_add(avl, box(622), box(527), NULL); + avl = gpr_avl_add(avl, box(719), box(526), nullptr); + avl = gpr_avl_add(avl, box(622), box(527), nullptr); avl = remove_int(avl, 28); avl = remove_int(avl, 836); avl = remove_int(avl, 142); - avl = gpr_avl_add(avl, box(445), box(531), NULL); - avl = gpr_avl_add(avl, box(410), box(532), NULL); + avl = gpr_avl_add(avl, box(445), box(531), nullptr); + avl = gpr_avl_add(avl, box(410), box(532), nullptr); avl = remove_int(avl, 575); - avl = gpr_avl_add(avl, box(634), box(534), NULL); - avl = gpr_avl_add(avl, box(906), box(535), NULL); + avl = gpr_avl_add(avl, box(634), box(534), nullptr); + avl = gpr_avl_add(avl, box(906), box(535), nullptr); avl = remove_int(avl, 649); - avl = gpr_avl_add(avl, box(813), box(537), NULL); + avl = gpr_avl_add(avl, box(813), box(537), nullptr); avl = remove_int(avl, 702); avl = remove_int(avl, 732); - avl = gpr_avl_add(avl, box(105), box(540), NULL); - avl = gpr_avl_add(avl, box(867), box(541), NULL); + avl = gpr_avl_add(avl, box(105), box(540), nullptr); + avl = gpr_avl_add(avl, box(867), box(541), nullptr); avl = remove_int(avl, 964); avl = remove_int(avl, 941); - avl = gpr_avl_add(avl, box(947), box(544), NULL); + avl = gpr_avl_add(avl, box(947), box(544), nullptr); avl = remove_int(avl, 990); - avl = gpr_avl_add(avl, box(816), box(546), NULL); + avl = gpr_avl_add(avl, box(816), box(546), nullptr); avl = remove_int(avl, 429); avl = remove_int(avl, 567); avl = remove_int(avl, 541); avl = remove_int(avl, 583); - avl = gpr_avl_add(avl, box(57), box(551), NULL); - avl = gpr_avl_add(avl, box(786), box(552), NULL); - avl = gpr_avl_add(avl, box(526), box(553), NULL); + avl = gpr_avl_add(avl, box(57), box(551), nullptr); + avl = gpr_avl_add(avl, box(786), box(552), nullptr); + avl = gpr_avl_add(avl, box(526), box(553), nullptr); avl = remove_int(avl, 642); avl = remove_int(avl, 220); avl = remove_int(avl, 840); avl = remove_int(avl, 548); - avl = gpr_avl_add(avl, box(528), box(558), NULL); - avl = gpr_avl_add(avl, box(749), box(559), NULL); - avl = gpr_avl_add(avl, box(194), box(560), NULL); + avl = gpr_avl_add(avl, box(528), box(558), nullptr); + avl = gpr_avl_add(avl, box(749), box(559), nullptr); + avl = gpr_avl_add(avl, box(194), box(560), nullptr); avl = remove_int(avl, 517); - avl = gpr_avl_add(avl, box(102), box(562), NULL); + avl = gpr_avl_add(avl, box(102), box(562), nullptr); avl = remove_int(avl, 189); - avl = gpr_avl_add(avl, box(927), box(564), NULL); + avl = gpr_avl_add(avl, box(927), box(564), nullptr); avl = remove_int(avl, 846); avl = remove_int(avl, 130); - avl = gpr_avl_add(avl, box(694), box(567), NULL); + avl = gpr_avl_add(avl, box(694), box(567), nullptr); avl = remove_int(avl, 750); - avl = gpr_avl_add(avl, box(357), box(569), NULL); + avl = gpr_avl_add(avl, box(357), box(569), nullptr); avl = remove_int(avl, 431); avl = remove_int(avl, 91); - avl = gpr_avl_add(avl, box(640), box(572), NULL); + avl = gpr_avl_add(avl, box(640), box(572), nullptr); avl = remove_int(avl, 4); - avl = gpr_avl_add(avl, box(81), box(574), NULL); - avl = gpr_avl_add(avl, box(595), box(575), NULL); + avl = gpr_avl_add(avl, box(81), box(574), nullptr); + avl = gpr_avl_add(avl, box(595), box(575), nullptr); avl = remove_int(avl, 444); avl = remove_int(avl, 262); avl = remove_int(avl, 11); - avl = gpr_avl_add(avl, box(192), box(579), NULL); - avl = gpr_avl_add(avl, box(158), box(580), NULL); + avl = gpr_avl_add(avl, box(192), box(579), nullptr); + avl = gpr_avl_add(avl, box(158), box(580), nullptr); avl = remove_int(avl, 401); avl = remove_int(avl, 918); - avl = gpr_avl_add(avl, box(180), box(583), NULL); + avl = gpr_avl_add(avl, box(180), box(583), nullptr); avl = remove_int(avl, 268); - avl = gpr_avl_add(avl, box(1012), box(585), NULL); - avl = gpr_avl_add(avl, box(90), box(586), NULL); - avl = gpr_avl_add(avl, box(946), box(587), NULL); + avl = gpr_avl_add(avl, box(1012), box(585), nullptr); + avl = gpr_avl_add(avl, box(90), box(586), nullptr); + avl = gpr_avl_add(avl, box(946), box(587), nullptr); avl = remove_int(avl, 719); - avl = gpr_avl_add(avl, box(874), box(589), NULL); - avl = gpr_avl_add(avl, box(679), box(590), NULL); + avl = gpr_avl_add(avl, box(874), box(589), nullptr); + avl = gpr_avl_add(avl, box(679), box(590), nullptr); avl = remove_int(avl, 53); avl = remove_int(avl, 534); - avl = gpr_avl_add(avl, box(646), box(593), NULL); - avl = gpr_avl_add(avl, box(767), box(594), NULL); - avl = gpr_avl_add(avl, box(460), box(595), NULL); - avl = gpr_avl_add(avl, box(852), box(596), NULL); - avl = gpr_avl_add(avl, box(189), box(597), NULL); + avl = gpr_avl_add(avl, box(646), box(593), nullptr); + avl = gpr_avl_add(avl, box(767), box(594), nullptr); + avl = gpr_avl_add(avl, box(460), box(595), nullptr); + avl = gpr_avl_add(avl, box(852), box(596), nullptr); + avl = gpr_avl_add(avl, box(189), box(597), nullptr); avl = remove_int(avl, 932); avl = remove_int(avl, 366); avl = remove_int(avl, 907); - avl = gpr_avl_add(avl, box(875), box(601), NULL); - avl = gpr_avl_add(avl, box(434), box(602), NULL); - avl = gpr_avl_add(avl, box(704), box(603), NULL); - avl = gpr_avl_add(avl, box(724), box(604), NULL); - avl = gpr_avl_add(avl, box(930), box(605), NULL); - avl = gpr_avl_add(avl, box(1000), box(606), NULL); + avl = gpr_avl_add(avl, box(875), box(601), nullptr); + avl = gpr_avl_add(avl, box(434), box(602), nullptr); + avl = gpr_avl_add(avl, box(704), box(603), nullptr); + avl = gpr_avl_add(avl, box(724), box(604), nullptr); + avl = gpr_avl_add(avl, box(930), box(605), nullptr); + avl = gpr_avl_add(avl, box(1000), box(606), nullptr); avl = remove_int(avl, 479); - avl = gpr_avl_add(avl, box(275), box(608), NULL); + avl = gpr_avl_add(avl, box(275), box(608), nullptr); avl = remove_int(avl, 32); - avl = gpr_avl_add(avl, box(939), box(610), NULL); + avl = gpr_avl_add(avl, box(939), box(610), nullptr); avl = remove_int(avl, 943); avl = remove_int(avl, 329); - avl = gpr_avl_add(avl, box(490), box(613), NULL); + avl = gpr_avl_add(avl, box(490), box(613), nullptr); avl = remove_int(avl, 477); avl = remove_int(avl, 414); avl = remove_int(avl, 187); avl = remove_int(avl, 334); - avl = gpr_avl_add(avl, box(40), box(618), NULL); + avl = gpr_avl_add(avl, box(40), box(618), nullptr); avl = remove_int(avl, 751); - avl = gpr_avl_add(avl, box(568), box(620), NULL); - avl = gpr_avl_add(avl, box(120), box(621), NULL); - avl = gpr_avl_add(avl, box(617), box(622), NULL); - avl = gpr_avl_add(avl, box(32), box(623), NULL); + avl = gpr_avl_add(avl, box(568), box(620), nullptr); + avl = gpr_avl_add(avl, box(120), box(621), nullptr); + avl = gpr_avl_add(avl, box(617), box(622), nullptr); + avl = gpr_avl_add(avl, box(32), box(623), nullptr); avl = remove_int(avl, 701); - avl = gpr_avl_add(avl, box(910), box(625), NULL); + avl = gpr_avl_add(avl, box(910), box(625), nullptr); avl = remove_int(avl, 557); avl = remove_int(avl, 361); avl = remove_int(avl, 937); avl = remove_int(avl, 100); avl = remove_int(avl, 684); - avl = gpr_avl_add(avl, box(751), box(631), NULL); + avl = gpr_avl_add(avl, box(751), box(631), nullptr); avl = remove_int(avl, 781); avl = remove_int(avl, 469); avl = remove_int(avl, 75); avl = remove_int(avl, 561); - avl = gpr_avl_add(avl, box(854), box(636), NULL); + avl = gpr_avl_add(avl, box(854), box(636), nullptr); avl = remove_int(avl, 164); avl = remove_int(avl, 258); avl = remove_int(avl, 315); avl = remove_int(avl, 261); - avl = gpr_avl_add(avl, box(552), box(641), NULL); - avl = gpr_avl_add(avl, box(6), box(642), NULL); - avl = gpr_avl_add(avl, box(680), box(643), NULL); + avl = gpr_avl_add(avl, box(552), box(641), nullptr); + avl = gpr_avl_add(avl, box(6), box(642), nullptr); + avl = gpr_avl_add(avl, box(680), box(643), nullptr); avl = remove_int(avl, 741); avl = remove_int(avl, 309); avl = remove_int(avl, 272); - avl = gpr_avl_add(avl, box(249), box(647), NULL); + avl = gpr_avl_add(avl, box(249), box(647), nullptr); avl = remove_int(avl, 97); avl = remove_int(avl, 850); - avl = gpr_avl_add(avl, box(915), box(650), NULL); - avl = gpr_avl_add(avl, box(816), box(651), NULL); - avl = gpr_avl_add(avl, box(45), box(652), NULL); - avl = gpr_avl_add(avl, box(168), box(653), NULL); + avl = gpr_avl_add(avl, box(915), box(650), nullptr); + avl = gpr_avl_add(avl, box(816), box(651), nullptr); + avl = gpr_avl_add(avl, box(45), box(652), nullptr); + avl = gpr_avl_add(avl, box(168), box(653), nullptr); avl = remove_int(avl, 153); avl = remove_int(avl, 239); - avl = gpr_avl_add(avl, box(684), box(656), NULL); - avl = gpr_avl_add(avl, box(208), box(657), NULL); - avl = gpr_avl_add(avl, box(681), box(658), NULL); - avl = gpr_avl_add(avl, box(609), box(659), NULL); - avl = gpr_avl_add(avl, box(645), box(660), NULL); + avl = gpr_avl_add(avl, box(684), box(656), nullptr); + avl = gpr_avl_add(avl, box(208), box(657), nullptr); + avl = gpr_avl_add(avl, box(681), box(658), nullptr); + avl = gpr_avl_add(avl, box(609), box(659), nullptr); + avl = gpr_avl_add(avl, box(645), box(660), nullptr); avl = remove_int(avl, 799); - avl = gpr_avl_add(avl, box(955), box(662), NULL); - avl = gpr_avl_add(avl, box(946), box(663), NULL); - avl = gpr_avl_add(avl, box(744), box(664), NULL); - avl = gpr_avl_add(avl, box(201), box(665), NULL); - avl = gpr_avl_add(avl, box(136), box(666), NULL); + avl = gpr_avl_add(avl, box(955), box(662), nullptr); + avl = gpr_avl_add(avl, box(946), box(663), nullptr); + avl = gpr_avl_add(avl, box(744), box(664), nullptr); + avl = gpr_avl_add(avl, box(201), box(665), nullptr); + avl = gpr_avl_add(avl, box(136), box(666), nullptr); avl = remove_int(avl, 357); - avl = gpr_avl_add(avl, box(974), box(668), NULL); + avl = gpr_avl_add(avl, box(974), box(668), nullptr); avl = remove_int(avl, 485); - avl = gpr_avl_add(avl, box(1009), box(670), NULL); - avl = gpr_avl_add(avl, box(517), box(671), NULL); + avl = gpr_avl_add(avl, box(1009), box(670), nullptr); + avl = gpr_avl_add(avl, box(517), box(671), nullptr); avl = remove_int(avl, 491); - avl = gpr_avl_add(avl, box(336), box(673), NULL); - avl = gpr_avl_add(avl, box(589), box(674), NULL); + avl = gpr_avl_add(avl, box(336), box(673), nullptr); + avl = gpr_avl_add(avl, box(589), box(674), nullptr); avl = remove_int(avl, 546); avl = remove_int(avl, 840); avl = remove_int(avl, 104); avl = remove_int(avl, 347); - avl = gpr_avl_add(avl, box(801), box(679), NULL); + avl = gpr_avl_add(avl, box(801), box(679), nullptr); avl = remove_int(avl, 799); avl = remove_int(avl, 702); avl = remove_int(avl, 996); avl = remove_int(avl, 93); - avl = gpr_avl_add(avl, box(561), box(684), NULL); - avl = gpr_avl_add(avl, box(25), box(685), NULL); + avl = gpr_avl_add(avl, box(561), box(684), nullptr); + avl = gpr_avl_add(avl, box(25), box(685), nullptr); avl = remove_int(avl, 278); - avl = gpr_avl_add(avl, box(191), box(687), NULL); + avl = gpr_avl_add(avl, box(191), box(687), nullptr); avl = remove_int(avl, 243); avl = remove_int(avl, 918); avl = remove_int(avl, 449); - avl = gpr_avl_add(avl, box(19), box(691), NULL); - avl = gpr_avl_add(avl, box(762), box(692), NULL); - avl = gpr_avl_add(avl, box(13), box(693), NULL); - avl = gpr_avl_add(avl, box(151), box(694), NULL); - avl = gpr_avl_add(avl, box(152), box(695), NULL); - avl = gpr_avl_add(avl, box(793), box(696), NULL); + avl = gpr_avl_add(avl, box(19), box(691), nullptr); + avl = gpr_avl_add(avl, box(762), box(692), nullptr); + avl = gpr_avl_add(avl, box(13), box(693), nullptr); + avl = gpr_avl_add(avl, box(151), box(694), nullptr); + avl = gpr_avl_add(avl, box(152), box(695), nullptr); + avl = gpr_avl_add(avl, box(793), box(696), nullptr); avl = remove_int(avl, 862); avl = remove_int(avl, 890); - avl = gpr_avl_add(avl, box(687), box(699), NULL); - avl = gpr_avl_add(avl, box(509), box(700), NULL); - avl = gpr_avl_add(avl, box(973), box(701), NULL); + avl = gpr_avl_add(avl, box(687), box(699), nullptr); + avl = gpr_avl_add(avl, box(509), box(700), nullptr); + avl = gpr_avl_add(avl, box(973), box(701), nullptr); avl = remove_int(avl, 230); - avl = gpr_avl_add(avl, box(532), box(703), NULL); + avl = gpr_avl_add(avl, box(532), box(703), nullptr); avl = remove_int(avl, 668); - avl = gpr_avl_add(avl, box(281), box(705), NULL); - avl = gpr_avl_add(avl, box(867), box(706), NULL); - avl = gpr_avl_add(avl, box(359), box(707), NULL); + avl = gpr_avl_add(avl, box(281), box(705), nullptr); + avl = gpr_avl_add(avl, box(867), box(706), nullptr); + avl = gpr_avl_add(avl, box(359), box(707), nullptr); avl = remove_int(avl, 425); - avl = gpr_avl_add(avl, box(691), box(709), NULL); - avl = gpr_avl_add(avl, box(163), box(710), NULL); - avl = gpr_avl_add(avl, box(502), box(711), NULL); + avl = gpr_avl_add(avl, box(691), box(709), nullptr); + avl = gpr_avl_add(avl, box(163), box(710), nullptr); + avl = gpr_avl_add(avl, box(502), box(711), nullptr); avl = remove_int(avl, 674); - avl = gpr_avl_add(avl, box(697), box(713), NULL); + avl = gpr_avl_add(avl, box(697), box(713), nullptr); avl = remove_int(avl, 271); - avl = gpr_avl_add(avl, box(968), box(715), NULL); - avl = gpr_avl_add(avl, box(48), box(716), NULL); + avl = gpr_avl_add(avl, box(968), box(715), nullptr); + avl = gpr_avl_add(avl, box(48), box(716), nullptr); avl = remove_int(avl, 543); - avl = gpr_avl_add(avl, box(35), box(718), NULL); - avl = gpr_avl_add(avl, box(751), box(719), NULL); - avl = gpr_avl_add(avl, box(478), box(720), NULL); + avl = gpr_avl_add(avl, box(35), box(718), nullptr); + avl = gpr_avl_add(avl, box(751), box(719), nullptr); + avl = gpr_avl_add(avl, box(478), box(720), nullptr); avl = remove_int(avl, 797); avl = remove_int(avl, 309); - avl = gpr_avl_add(avl, box(927), box(723), NULL); + avl = gpr_avl_add(avl, box(927), box(723), nullptr); avl = remove_int(avl, 504); - avl = gpr_avl_add(avl, box(286), box(725), NULL); - avl = gpr_avl_add(avl, box(413), box(726), NULL); - avl = gpr_avl_add(avl, box(599), box(727), NULL); + avl = gpr_avl_add(avl, box(286), box(725), nullptr); + avl = gpr_avl_add(avl, box(413), box(726), nullptr); + avl = gpr_avl_add(avl, box(599), box(727), nullptr); avl = remove_int(avl, 105); avl = remove_int(avl, 605); - avl = gpr_avl_add(avl, box(632), box(730), NULL); - avl = gpr_avl_add(avl, box(133), box(731), NULL); + avl = gpr_avl_add(avl, box(632), box(730), nullptr); + avl = gpr_avl_add(avl, box(133), box(731), nullptr); avl = remove_int(avl, 443); - avl = gpr_avl_add(avl, box(958), box(733), NULL); - avl = gpr_avl_add(avl, box(729), box(734), NULL); + avl = gpr_avl_add(avl, box(958), box(733), nullptr); + avl = gpr_avl_add(avl, box(729), box(734), nullptr); avl = remove_int(avl, 158); - avl = gpr_avl_add(avl, box(694), box(736), NULL); - avl = gpr_avl_add(avl, box(505), box(737), NULL); + avl = gpr_avl_add(avl, box(694), box(736), nullptr); + avl = gpr_avl_add(avl, box(505), box(737), nullptr); avl = remove_int(avl, 63); avl = remove_int(avl, 714); - avl = gpr_avl_add(avl, box(1002), box(740), NULL); + avl = gpr_avl_add(avl, box(1002), box(740), nullptr); avl = remove_int(avl, 211); - avl = gpr_avl_add(avl, box(765), box(742), NULL); - avl = gpr_avl_add(avl, box(455), box(743), NULL); + avl = gpr_avl_add(avl, box(765), box(742), nullptr); + avl = gpr_avl_add(avl, box(455), box(743), nullptr); avl = remove_int(avl, 59); avl = remove_int(avl, 224); - avl = gpr_avl_add(avl, box(586), box(746), NULL); - avl = gpr_avl_add(avl, box(348), box(747), NULL); + avl = gpr_avl_add(avl, box(586), box(746), nullptr); + avl = gpr_avl_add(avl, box(348), box(747), nullptr); avl = remove_int(avl, 10); avl = remove_int(avl, 484); - avl = gpr_avl_add(avl, box(968), box(750), NULL); - avl = gpr_avl_add(avl, box(923), box(751), NULL); + avl = gpr_avl_add(avl, box(968), box(750), nullptr); + avl = gpr_avl_add(avl, box(923), box(751), nullptr); avl = remove_int(avl, 573); avl = remove_int(avl, 617); - avl = gpr_avl_add(avl, box(812), box(754), NULL); - avl = gpr_avl_add(avl, box(179), box(755), NULL); + avl = gpr_avl_add(avl, box(812), box(754), nullptr); + avl = gpr_avl_add(avl, box(179), box(755), nullptr); avl = remove_int(avl, 284); avl = remove_int(avl, 157); avl = remove_int(avl, 177); avl = remove_int(avl, 896); - avl = gpr_avl_add(avl, box(649), box(760), NULL); - avl = gpr_avl_add(avl, box(927), box(761), NULL); - avl = gpr_avl_add(avl, box(454), box(762), NULL); - avl = gpr_avl_add(avl, box(217), box(763), NULL); + avl = gpr_avl_add(avl, box(649), box(760), nullptr); + avl = gpr_avl_add(avl, box(927), box(761), nullptr); + avl = gpr_avl_add(avl, box(454), box(762), nullptr); + avl = gpr_avl_add(avl, box(217), box(763), nullptr); avl = remove_int(avl, 534); - avl = gpr_avl_add(avl, box(180), box(765), NULL); - avl = gpr_avl_add(avl, box(319), box(766), NULL); + avl = gpr_avl_add(avl, box(180), box(765), nullptr); + avl = gpr_avl_add(avl, box(319), box(766), nullptr); avl = remove_int(avl, 92); - avl = gpr_avl_add(avl, box(483), box(768), NULL); + avl = gpr_avl_add(avl, box(483), box(768), nullptr); avl = remove_int(avl, 504); avl = remove_int(avl, 1017); avl = remove_int(avl, 37); avl = remove_int(avl, 50); - avl = gpr_avl_add(avl, box(302), box(773), NULL); + avl = gpr_avl_add(avl, box(302), box(773), nullptr); avl = remove_int(avl, 807); - avl = gpr_avl_add(avl, box(463), box(775), NULL); - avl = gpr_avl_add(avl, box(271), box(776), NULL); - avl = gpr_avl_add(avl, box(644), box(777), NULL); + avl = gpr_avl_add(avl, box(463), box(775), nullptr); + avl = gpr_avl_add(avl, box(271), box(776), nullptr); + avl = gpr_avl_add(avl, box(644), box(777), nullptr); avl = remove_int(avl, 618); - avl = gpr_avl_add(avl, box(166), box(779), NULL); - avl = gpr_avl_add(avl, box(538), box(780), NULL); + avl = gpr_avl_add(avl, box(166), box(779), nullptr); + avl = gpr_avl_add(avl, box(538), box(780), nullptr); avl = remove_int(avl, 606); - avl = gpr_avl_add(avl, box(425), box(782), NULL); + avl = gpr_avl_add(avl, box(425), box(782), nullptr); avl = remove_int(avl, 725); avl = remove_int(avl, 383); - avl = gpr_avl_add(avl, box(155), box(785), NULL); + avl = gpr_avl_add(avl, box(155), box(785), nullptr); avl = remove_int(avl, 889); - avl = gpr_avl_add(avl, box(653), box(787), NULL); + avl = gpr_avl_add(avl, box(653), box(787), nullptr); avl = remove_int(avl, 386); - avl = gpr_avl_add(avl, box(142), box(789), NULL); + avl = gpr_avl_add(avl, box(142), box(789), nullptr); avl = remove_int(avl, 107); avl = remove_int(avl, 603); avl = remove_int(avl, 971); - avl = gpr_avl_add(avl, box(80), box(793), NULL); - avl = gpr_avl_add(avl, box(61), box(794), NULL); - avl = gpr_avl_add(avl, box(693), box(795), NULL); - avl = gpr_avl_add(avl, box(592), box(796), NULL); - avl = gpr_avl_add(avl, box(433), box(797), NULL); - avl = gpr_avl_add(avl, box(973), box(798), NULL); + avl = gpr_avl_add(avl, box(80), box(793), nullptr); + avl = gpr_avl_add(avl, box(61), box(794), nullptr); + avl = gpr_avl_add(avl, box(693), box(795), nullptr); + avl = gpr_avl_add(avl, box(592), box(796), nullptr); + avl = gpr_avl_add(avl, box(433), box(797), nullptr); + avl = gpr_avl_add(avl, box(973), box(798), nullptr); avl = remove_int(avl, 901); avl = remove_int(avl, 340); avl = remove_int(avl, 709); - avl = gpr_avl_add(avl, box(224), box(802), NULL); + avl = gpr_avl_add(avl, box(224), box(802), nullptr); avl = remove_int(avl, 120); avl = remove_int(avl, 271); - avl = gpr_avl_add(avl, box(780), box(805), NULL); - avl = gpr_avl_add(avl, box(867), box(806), NULL); - avl = gpr_avl_add(avl, box(756), box(807), NULL); - avl = gpr_avl_add(avl, box(583), box(808), NULL); - avl = gpr_avl_add(avl, box(356), box(809), NULL); - avl = gpr_avl_add(avl, box(58), box(810), NULL); + avl = gpr_avl_add(avl, box(780), box(805), nullptr); + avl = gpr_avl_add(avl, box(867), box(806), nullptr); + avl = gpr_avl_add(avl, box(756), box(807), nullptr); + avl = gpr_avl_add(avl, box(583), box(808), nullptr); + avl = gpr_avl_add(avl, box(356), box(809), nullptr); + avl = gpr_avl_add(avl, box(58), box(810), nullptr); avl = remove_int(avl, 219); - avl = gpr_avl_add(avl, box(301), box(812), NULL); + avl = gpr_avl_add(avl, box(301), box(812), nullptr); avl = remove_int(avl, 643); avl = remove_int(avl, 787); avl = remove_int(avl, 583); @@ -1065,72 +1065,72 @@ static void test_badcase2(void) { avl = remove_int(avl, 608); avl = remove_int(avl, 363); avl = remove_int(avl, 690); - avl = gpr_avl_add(avl, box(233), box(821), NULL); - avl = gpr_avl_add(avl, box(479), box(822), NULL); - avl = gpr_avl_add(avl, box(323), box(823), NULL); - avl = gpr_avl_add(avl, box(802), box(824), NULL); + avl = gpr_avl_add(avl, box(233), box(821), nullptr); + avl = gpr_avl_add(avl, box(479), box(822), nullptr); + avl = gpr_avl_add(avl, box(323), box(823), nullptr); + avl = gpr_avl_add(avl, box(802), box(824), nullptr); avl = remove_int(avl, 682); avl = remove_int(avl, 705); avl = remove_int(avl, 487); - avl = gpr_avl_add(avl, box(530), box(828), NULL); - avl = gpr_avl_add(avl, box(232), box(829), NULL); + avl = gpr_avl_add(avl, box(530), box(828), nullptr); + avl = gpr_avl_add(avl, box(232), box(829), nullptr); avl = remove_int(avl, 627); - avl = gpr_avl_add(avl, box(396), box(831), NULL); - avl = gpr_avl_add(avl, box(61), box(832), NULL); - avl = gpr_avl_add(avl, box(932), box(833), NULL); - avl = gpr_avl_add(avl, box(108), box(834), NULL); - avl = gpr_avl_add(avl, box(524), box(835), NULL); + avl = gpr_avl_add(avl, box(396), box(831), nullptr); + avl = gpr_avl_add(avl, box(61), box(832), nullptr); + avl = gpr_avl_add(avl, box(932), box(833), nullptr); + avl = gpr_avl_add(avl, box(108), box(834), nullptr); + avl = gpr_avl_add(avl, box(524), box(835), nullptr); avl = remove_int(avl, 390); avl = remove_int(avl, 307); - avl = gpr_avl_add(avl, box(722), box(838), NULL); - avl = gpr_avl_add(avl, box(907), box(839), NULL); + avl = gpr_avl_add(avl, box(722), box(838), nullptr); + avl = gpr_avl_add(avl, box(907), box(839), nullptr); avl = remove_int(avl, 286); avl = remove_int(avl, 337); avl = remove_int(avl, 443); - avl = gpr_avl_add(avl, box(973), box(843), NULL); + avl = gpr_avl_add(avl, box(973), box(843), nullptr); avl = remove_int(avl, 930); avl = remove_int(avl, 242); - avl = gpr_avl_add(avl, box(997), box(846), NULL); - avl = gpr_avl_add(avl, box(689), box(847), NULL); + avl = gpr_avl_add(avl, box(997), box(846), nullptr); + avl = gpr_avl_add(avl, box(689), box(847), nullptr); avl = remove_int(avl, 318); - avl = gpr_avl_add(avl, box(703), box(849), NULL); - avl = gpr_avl_add(avl, box(868), box(850), NULL); - avl = gpr_avl_add(avl, box(200), box(851), NULL); - avl = gpr_avl_add(avl, box(960), box(852), NULL); - avl = gpr_avl_add(avl, box(80), box(853), NULL); + avl = gpr_avl_add(avl, box(703), box(849), nullptr); + avl = gpr_avl_add(avl, box(868), box(850), nullptr); + avl = gpr_avl_add(avl, box(200), box(851), nullptr); + avl = gpr_avl_add(avl, box(960), box(852), nullptr); + avl = gpr_avl_add(avl, box(80), box(853), nullptr); avl = remove_int(avl, 113); - avl = gpr_avl_add(avl, box(135), box(855), NULL); + avl = gpr_avl_add(avl, box(135), box(855), nullptr); avl = remove_int(avl, 529); - avl = gpr_avl_add(avl, box(366), box(857), NULL); + avl = gpr_avl_add(avl, box(366), box(857), nullptr); avl = remove_int(avl, 272); - avl = gpr_avl_add(avl, box(921), box(859), NULL); + avl = gpr_avl_add(avl, box(921), box(859), nullptr); avl = remove_int(avl, 497); - avl = gpr_avl_add(avl, box(712), box(861), NULL); + avl = gpr_avl_add(avl, box(712), box(861), nullptr); avl = remove_int(avl, 777); avl = remove_int(avl, 505); avl = remove_int(avl, 974); avl = remove_int(avl, 497); - avl = gpr_avl_add(avl, box(388), box(866), NULL); - avl = gpr_avl_add(avl, box(29), box(867), NULL); - avl = gpr_avl_add(avl, box(180), box(868), NULL); - avl = gpr_avl_add(avl, box(983), box(869), NULL); - avl = gpr_avl_add(avl, box(72), box(870), NULL); - avl = gpr_avl_add(avl, box(693), box(871), NULL); - avl = gpr_avl_add(avl, box(567), box(872), NULL); + avl = gpr_avl_add(avl, box(388), box(866), nullptr); + avl = gpr_avl_add(avl, box(29), box(867), nullptr); + avl = gpr_avl_add(avl, box(180), box(868), nullptr); + avl = gpr_avl_add(avl, box(983), box(869), nullptr); + avl = gpr_avl_add(avl, box(72), box(870), nullptr); + avl = gpr_avl_add(avl, box(693), box(871), nullptr); + avl = gpr_avl_add(avl, box(567), box(872), nullptr); avl = remove_int(avl, 549); avl = remove_int(avl, 351); - avl = gpr_avl_add(avl, box(1019), box(875), NULL); + avl = gpr_avl_add(avl, box(1019), box(875), nullptr); avl = remove_int(avl, 585); avl = remove_int(avl, 294); avl = remove_int(avl, 61); - avl = gpr_avl_add(avl, box(409), box(879), NULL); - avl = gpr_avl_add(avl, box(984), box(880), NULL); - avl = gpr_avl_add(avl, box(830), box(881), NULL); + avl = gpr_avl_add(avl, box(409), box(879), nullptr); + avl = gpr_avl_add(avl, box(984), box(880), nullptr); + avl = gpr_avl_add(avl, box(830), box(881), nullptr); avl = remove_int(avl, 579); - avl = gpr_avl_add(avl, box(672), box(883), NULL); + avl = gpr_avl_add(avl, box(672), box(883), nullptr); avl = remove_int(avl, 968); - gpr_avl_unref(avl, NULL); + gpr_avl_unref(avl, nullptr); } static void test_badcase3(void) { @@ -1140,191 +1140,191 @@ static void test_badcase3(void) { avl = gpr_avl_create(&int_int_vtable); avl = remove_int(avl, 624); - avl = gpr_avl_add(avl, box(59), box(2), NULL); - avl = gpr_avl_add(avl, box(494), box(3), NULL); - avl = gpr_avl_add(avl, box(226), box(4), NULL); + avl = gpr_avl_add(avl, box(59), box(2), nullptr); + avl = gpr_avl_add(avl, box(494), box(3), nullptr); + avl = gpr_avl_add(avl, box(226), box(4), nullptr); avl = remove_int(avl, 524); - avl = gpr_avl_add(avl, box(540), box(6), NULL); + avl = gpr_avl_add(avl, box(540), box(6), nullptr); avl = remove_int(avl, 1008); - avl = gpr_avl_add(avl, box(502), box(8), NULL); + avl = gpr_avl_add(avl, box(502), box(8), nullptr); avl = remove_int(avl, 267); avl = remove_int(avl, 764); avl = remove_int(avl, 443); - avl = gpr_avl_add(avl, box(8), box(12), NULL); + avl = gpr_avl_add(avl, box(8), box(12), nullptr); avl = remove_int(avl, 291); avl = remove_int(avl, 796); avl = remove_int(avl, 1002); - avl = gpr_avl_add(avl, box(778), box(16), NULL); + avl = gpr_avl_add(avl, box(778), box(16), nullptr); avl = remove_int(avl, 621); avl = remove_int(avl, 891); avl = remove_int(avl, 880); - avl = gpr_avl_add(avl, box(197), box(20), NULL); - avl = gpr_avl_add(avl, box(441), box(21), NULL); - avl = gpr_avl_add(avl, box(719), box(22), NULL); + avl = gpr_avl_add(avl, box(197), box(20), nullptr); + avl = gpr_avl_add(avl, box(441), box(21), nullptr); + avl = gpr_avl_add(avl, box(719), box(22), nullptr); avl = remove_int(avl, 109); - avl = gpr_avl_add(avl, box(458), box(24), NULL); + avl = gpr_avl_add(avl, box(458), box(24), nullptr); avl = remove_int(avl, 86); - avl = gpr_avl_add(avl, box(897), box(26), NULL); - avl = gpr_avl_add(avl, box(997), box(27), NULL); + avl = gpr_avl_add(avl, box(897), box(26), nullptr); + avl = gpr_avl_add(avl, box(997), box(27), nullptr); avl = remove_int(avl, 235); avl = remove_int(avl, 425); avl = remove_int(avl, 186); - avl = gpr_avl_add(avl, box(887), box(31), NULL); - avl = gpr_avl_add(avl, box(1005), box(32), NULL); - avl = gpr_avl_add(avl, box(778), box(33), NULL); - avl = gpr_avl_add(avl, box(575), box(34), NULL); + avl = gpr_avl_add(avl, box(887), box(31), nullptr); + avl = gpr_avl_add(avl, box(1005), box(32), nullptr); + avl = gpr_avl_add(avl, box(778), box(33), nullptr); + avl = gpr_avl_add(avl, box(575), box(34), nullptr); avl = remove_int(avl, 966); avl = remove_int(avl, 1015); - avl = gpr_avl_add(avl, box(486), box(37), NULL); - avl = gpr_avl_add(avl, box(809), box(38), NULL); - avl = gpr_avl_add(avl, box(907), box(39), NULL); - avl = gpr_avl_add(avl, box(971), box(40), NULL); + avl = gpr_avl_add(avl, box(486), box(37), nullptr); + avl = gpr_avl_add(avl, box(809), box(38), nullptr); + avl = gpr_avl_add(avl, box(907), box(39), nullptr); + avl = gpr_avl_add(avl, box(971), box(40), nullptr); avl = remove_int(avl, 441); avl = remove_int(avl, 498); - avl = gpr_avl_add(avl, box(727), box(43), NULL); + avl = gpr_avl_add(avl, box(727), box(43), nullptr); avl = remove_int(avl, 679); avl = remove_int(avl, 740); avl = remove_int(avl, 532); - avl = gpr_avl_add(avl, box(805), box(47), NULL); + avl = gpr_avl_add(avl, box(805), box(47), nullptr); avl = remove_int(avl, 64); - avl = gpr_avl_add(avl, box(362), box(49), NULL); - avl = gpr_avl_add(avl, box(170), box(50), NULL); - avl = gpr_avl_add(avl, box(389), box(51), NULL); - avl = gpr_avl_add(avl, box(689), box(52), NULL); + avl = gpr_avl_add(avl, box(362), box(49), nullptr); + avl = gpr_avl_add(avl, box(170), box(50), nullptr); + avl = gpr_avl_add(avl, box(389), box(51), nullptr); + avl = gpr_avl_add(avl, box(689), box(52), nullptr); avl = remove_int(avl, 871); - avl = gpr_avl_add(avl, box(447), box(54), NULL); + avl = gpr_avl_add(avl, box(447), box(54), nullptr); avl = remove_int(avl, 718); - avl = gpr_avl_add(avl, box(724), box(56), NULL); + avl = gpr_avl_add(avl, box(724), box(56), nullptr); avl = remove_int(avl, 215); - avl = gpr_avl_add(avl, box(550), box(58), NULL); + avl = gpr_avl_add(avl, box(550), box(58), nullptr); avl = remove_int(avl, 932); - avl = gpr_avl_add(avl, box(47), box(60), NULL); + avl = gpr_avl_add(avl, box(47), box(60), nullptr); avl = remove_int(avl, 46); avl = remove_int(avl, 229); - avl = gpr_avl_add(avl, box(68), box(63), NULL); - avl = gpr_avl_add(avl, box(387), box(64), NULL); + avl = gpr_avl_add(avl, box(68), box(63), nullptr); + avl = gpr_avl_add(avl, box(387), box(64), nullptr); avl = remove_int(avl, 933); avl = remove_int(avl, 736); avl = remove_int(avl, 719); - avl = gpr_avl_add(avl, box(150), box(68), NULL); + avl = gpr_avl_add(avl, box(150), box(68), nullptr); avl = remove_int(avl, 875); avl = remove_int(avl, 298); - avl = gpr_avl_add(avl, box(991), box(71), NULL); + avl = gpr_avl_add(avl, box(991), box(71), nullptr); avl = remove_int(avl, 705); - avl = gpr_avl_add(avl, box(197), box(73), NULL); - avl = gpr_avl_add(avl, box(101), box(74), NULL); + avl = gpr_avl_add(avl, box(197), box(73), nullptr); + avl = gpr_avl_add(avl, box(101), box(74), nullptr); avl = remove_int(avl, 436); - avl = gpr_avl_add(avl, box(755), box(76), NULL); - avl = gpr_avl_add(avl, box(727), box(77), NULL); + avl = gpr_avl_add(avl, box(755), box(76), nullptr); + avl = gpr_avl_add(avl, box(727), box(77), nullptr); avl = remove_int(avl, 309); avl = remove_int(avl, 253); - avl = gpr_avl_add(avl, box(203), box(80), NULL); + avl = gpr_avl_add(avl, box(203), box(80), nullptr); avl = remove_int(avl, 231); - avl = gpr_avl_add(avl, box(461), box(82), NULL); + avl = gpr_avl_add(avl, box(461), box(82), nullptr); avl = remove_int(avl, 316); avl = remove_int(avl, 493); - avl = gpr_avl_add(avl, box(184), box(85), NULL); + avl = gpr_avl_add(avl, box(184), box(85), nullptr); avl = remove_int(avl, 737); - avl = gpr_avl_add(avl, box(790), box(87), NULL); - avl = gpr_avl_add(avl, box(335), box(88), NULL); + avl = gpr_avl_add(avl, box(790), box(87), nullptr); + avl = gpr_avl_add(avl, box(335), box(88), nullptr); avl = remove_int(avl, 649); - avl = gpr_avl_add(avl, box(69), box(90), NULL); + avl = gpr_avl_add(avl, box(69), box(90), nullptr); avl = remove_int(avl, 585); avl = remove_int(avl, 543); - avl = gpr_avl_add(avl, box(784), box(93), NULL); - avl = gpr_avl_add(avl, box(60), box(94), NULL); - avl = gpr_avl_add(avl, box(525), box(95), NULL); - avl = gpr_avl_add(avl, box(177), box(96), NULL); - avl = gpr_avl_add(avl, box(178), box(97), NULL); - avl = gpr_avl_add(avl, box(683), box(98), NULL); - avl = gpr_avl_add(avl, box(226), box(99), NULL); - avl = gpr_avl_add(avl, box(662), box(100), NULL); + avl = gpr_avl_add(avl, box(784), box(93), nullptr); + avl = gpr_avl_add(avl, box(60), box(94), nullptr); + avl = gpr_avl_add(avl, box(525), box(95), nullptr); + avl = gpr_avl_add(avl, box(177), box(96), nullptr); + avl = gpr_avl_add(avl, box(178), box(97), nullptr); + avl = gpr_avl_add(avl, box(683), box(98), nullptr); + avl = gpr_avl_add(avl, box(226), box(99), nullptr); + avl = gpr_avl_add(avl, box(662), box(100), nullptr); avl = remove_int(avl, 944); - avl = gpr_avl_add(avl, box(562), box(102), NULL); - avl = gpr_avl_add(avl, box(793), box(103), NULL); + avl = gpr_avl_add(avl, box(562), box(102), nullptr); + avl = gpr_avl_add(avl, box(793), box(103), nullptr); avl = remove_int(avl, 673); - avl = gpr_avl_add(avl, box(310), box(105), NULL); + avl = gpr_avl_add(avl, box(310), box(105), nullptr); avl = remove_int(avl, 479); avl = remove_int(avl, 543); avl = remove_int(avl, 159); avl = remove_int(avl, 850); - avl = gpr_avl_add(avl, box(318), box(110), NULL); - avl = gpr_avl_add(avl, box(483), box(111), NULL); - avl = gpr_avl_add(avl, box(84), box(112), NULL); + avl = gpr_avl_add(avl, box(318), box(110), nullptr); + avl = gpr_avl_add(avl, box(483), box(111), nullptr); + avl = gpr_avl_add(avl, box(84), box(112), nullptr); avl = remove_int(avl, 109); - avl = gpr_avl_add(avl, box(132), box(114), NULL); - avl = gpr_avl_add(avl, box(920), box(115), NULL); + avl = gpr_avl_add(avl, box(132), box(114), nullptr); + avl = gpr_avl_add(avl, box(920), box(115), nullptr); avl = remove_int(avl, 746); - avl = gpr_avl_add(avl, box(145), box(117), NULL); - avl = gpr_avl_add(avl, box(526), box(118), NULL); + avl = gpr_avl_add(avl, box(145), box(117), nullptr); + avl = gpr_avl_add(avl, box(526), box(118), nullptr); avl = remove_int(avl, 158); - avl = gpr_avl_add(avl, box(332), box(120), NULL); - avl = gpr_avl_add(avl, box(918), box(121), NULL); + avl = gpr_avl_add(avl, box(332), box(120), nullptr); + avl = gpr_avl_add(avl, box(918), box(121), nullptr); avl = remove_int(avl, 339); - avl = gpr_avl_add(avl, box(809), box(123), NULL); - avl = gpr_avl_add(avl, box(742), box(124), NULL); - avl = gpr_avl_add(avl, box(718), box(125), NULL); + avl = gpr_avl_add(avl, box(809), box(123), nullptr); + avl = gpr_avl_add(avl, box(742), box(124), nullptr); + avl = gpr_avl_add(avl, box(718), box(125), nullptr); avl = remove_int(avl, 988); avl = remove_int(avl, 531); avl = remove_int(avl, 840); - avl = gpr_avl_add(avl, box(816), box(129), NULL); - avl = gpr_avl_add(avl, box(976), box(130), NULL); + avl = gpr_avl_add(avl, box(816), box(129), nullptr); + avl = gpr_avl_add(avl, box(976), box(130), nullptr); avl = remove_int(avl, 743); avl = remove_int(avl, 528); avl = remove_int(avl, 982); - avl = gpr_avl_add(avl, box(803), box(134), NULL); - avl = gpr_avl_add(avl, box(205), box(135), NULL); - avl = gpr_avl_add(avl, box(584), box(136), NULL); + avl = gpr_avl_add(avl, box(803), box(134), nullptr); + avl = gpr_avl_add(avl, box(205), box(135), nullptr); + avl = gpr_avl_add(avl, box(584), box(136), nullptr); avl = remove_int(avl, 923); avl = remove_int(avl, 538); avl = remove_int(avl, 398); avl = remove_int(avl, 320); avl = remove_int(avl, 292); - avl = gpr_avl_add(avl, box(270), box(142), NULL); - avl = gpr_avl_add(avl, box(333), box(143), NULL); + avl = gpr_avl_add(avl, box(270), box(142), nullptr); + avl = gpr_avl_add(avl, box(333), box(143), nullptr); avl = remove_int(avl, 439); - avl = gpr_avl_add(avl, box(35), box(145), NULL); - avl = gpr_avl_add(avl, box(837), box(146), NULL); + avl = gpr_avl_add(avl, box(35), box(145), nullptr); + avl = gpr_avl_add(avl, box(837), box(146), nullptr); avl = remove_int(avl, 65); avl = remove_int(avl, 642); avl = remove_int(avl, 371); avl = remove_int(avl, 140); avl = remove_int(avl, 533); avl = remove_int(avl, 676); - avl = gpr_avl_add(avl, box(624), box(153), NULL); - avl = gpr_avl_add(avl, box(116), box(154), NULL); - avl = gpr_avl_add(avl, box(446), box(155), NULL); + avl = gpr_avl_add(avl, box(624), box(153), nullptr); + avl = gpr_avl_add(avl, box(116), box(154), nullptr); + avl = gpr_avl_add(avl, box(446), box(155), nullptr); avl = remove_int(avl, 91); avl = remove_int(avl, 721); avl = remove_int(avl, 537); - avl = gpr_avl_add(avl, box(448), box(159), NULL); + avl = gpr_avl_add(avl, box(448), box(159), nullptr); avl = remove_int(avl, 155); avl = remove_int(avl, 344); avl = remove_int(avl, 237); - avl = gpr_avl_add(avl, box(309), box(163), NULL); - avl = gpr_avl_add(avl, box(434), box(164), NULL); - avl = gpr_avl_add(avl, box(277), box(165), NULL); + avl = gpr_avl_add(avl, box(309), box(163), nullptr); + avl = gpr_avl_add(avl, box(434), box(164), nullptr); + avl = gpr_avl_add(avl, box(277), box(165), nullptr); avl = remove_int(avl, 233); - avl = gpr_avl_add(avl, box(275), box(167), NULL); - avl = gpr_avl_add(avl, box(218), box(168), NULL); - avl = gpr_avl_add(avl, box(76), box(169), NULL); - avl = gpr_avl_add(avl, box(898), box(170), NULL); + avl = gpr_avl_add(avl, box(275), box(167), nullptr); + avl = gpr_avl_add(avl, box(218), box(168), nullptr); + avl = gpr_avl_add(avl, box(76), box(169), nullptr); + avl = gpr_avl_add(avl, box(898), box(170), nullptr); avl = remove_int(avl, 771); - avl = gpr_avl_add(avl, box(237), box(172), NULL); + avl = gpr_avl_add(avl, box(237), box(172), nullptr); avl = remove_int(avl, 327); - avl = gpr_avl_add(avl, box(499), box(174), NULL); + avl = gpr_avl_add(avl, box(499), box(174), nullptr); avl = remove_int(avl, 727); avl = remove_int(avl, 234); avl = remove_int(avl, 623); avl = remove_int(avl, 458); avl = remove_int(avl, 326); avl = remove_int(avl, 589); - avl = gpr_avl_add(avl, box(442), box(181), NULL); + avl = gpr_avl_add(avl, box(442), box(181), nullptr); avl = remove_int(avl, 389); - avl = gpr_avl_add(avl, box(708), box(183), NULL); - avl = gpr_avl_add(avl, box(594), box(184), NULL); - avl = gpr_avl_add(avl, box(942), box(185), NULL); - avl = gpr_avl_add(avl, box(282), box(186), NULL); + avl = gpr_avl_add(avl, box(708), box(183), nullptr); + avl = gpr_avl_add(avl, box(594), box(184), nullptr); + avl = gpr_avl_add(avl, box(942), box(185), nullptr); + avl = gpr_avl_add(avl, box(282), box(186), nullptr); avl = remove_int(avl, 434); avl = remove_int(avl, 134); avl = remove_int(avl, 270); @@ -1334,125 +1334,125 @@ static void test_badcase3(void) { avl = remove_int(avl, 193); avl = remove_int(avl, 797); avl = remove_int(avl, 347); - avl = gpr_avl_add(avl, box(99), box(196), NULL); - avl = gpr_avl_add(avl, box(161), box(197), NULL); + avl = gpr_avl_add(avl, box(99), box(196), nullptr); + avl = gpr_avl_add(avl, box(161), box(197), nullptr); avl = remove_int(avl, 484); - avl = gpr_avl_add(avl, box(72), box(199), NULL); + avl = gpr_avl_add(avl, box(72), box(199), nullptr); avl = remove_int(avl, 629); - avl = gpr_avl_add(avl, box(522), box(201), NULL); + avl = gpr_avl_add(avl, box(522), box(201), nullptr); avl = remove_int(avl, 679); - avl = gpr_avl_add(avl, box(407), box(203), NULL); + avl = gpr_avl_add(avl, box(407), box(203), nullptr); avl = remove_int(avl, 693); - avl = gpr_avl_add(avl, box(424), box(205), NULL); - avl = gpr_avl_add(avl, box(651), box(206), NULL); - avl = gpr_avl_add(avl, box(927), box(207), NULL); + avl = gpr_avl_add(avl, box(424), box(205), nullptr); + avl = gpr_avl_add(avl, box(651), box(206), nullptr); + avl = gpr_avl_add(avl, box(927), box(207), nullptr); avl = remove_int(avl, 553); - avl = gpr_avl_add(avl, box(128), box(209), NULL); - avl = gpr_avl_add(avl, box(616), box(210), NULL); - avl = gpr_avl_add(avl, box(690), box(211), NULL); + avl = gpr_avl_add(avl, box(128), box(209), nullptr); + avl = gpr_avl_add(avl, box(616), box(210), nullptr); + avl = gpr_avl_add(avl, box(690), box(211), nullptr); avl = remove_int(avl, 241); avl = remove_int(avl, 179); - avl = gpr_avl_add(avl, box(697), box(214), NULL); + avl = gpr_avl_add(avl, box(697), box(214), nullptr); avl = remove_int(avl, 779); - avl = gpr_avl_add(avl, box(241), box(216), NULL); + avl = gpr_avl_add(avl, box(241), box(216), nullptr); avl = remove_int(avl, 190); avl = remove_int(avl, 210); - avl = gpr_avl_add(avl, box(711), box(219), NULL); + avl = gpr_avl_add(avl, box(711), box(219), nullptr); avl = remove_int(avl, 251); avl = remove_int(avl, 61); - avl = gpr_avl_add(avl, box(800), box(222), NULL); + avl = gpr_avl_add(avl, box(800), box(222), nullptr); avl = remove_int(avl, 551); - avl = gpr_avl_add(avl, box(61), box(224), NULL); - avl = gpr_avl_add(avl, box(656), box(225), NULL); + avl = gpr_avl_add(avl, box(61), box(224), nullptr); + avl = gpr_avl_add(avl, box(656), box(225), nullptr); avl = remove_int(avl, 130); avl = remove_int(avl, 368); avl = remove_int(avl, 150); avl = remove_int(avl, 73); - avl = gpr_avl_add(avl, box(799), box(230), NULL); - avl = gpr_avl_add(avl, box(125), box(231), NULL); + avl = gpr_avl_add(avl, box(799), box(230), nullptr); + avl = gpr_avl_add(avl, box(125), box(231), nullptr); avl = remove_int(avl, 107); - avl = gpr_avl_add(avl, box(938), box(233), NULL); - avl = gpr_avl_add(avl, box(914), box(234), NULL); - avl = gpr_avl_add(avl, box(197), box(235), NULL); + avl = gpr_avl_add(avl, box(938), box(233), nullptr); + avl = gpr_avl_add(avl, box(914), box(234), nullptr); + avl = gpr_avl_add(avl, box(197), box(235), nullptr); avl = remove_int(avl, 736); - avl = gpr_avl_add(avl, box(20), box(237), NULL); + avl = gpr_avl_add(avl, box(20), box(237), nullptr); avl = remove_int(avl, 224); avl = remove_int(avl, 841); - avl = gpr_avl_add(avl, box(226), box(240), NULL); + avl = gpr_avl_add(avl, box(226), box(240), nullptr); avl = remove_int(avl, 963); avl = remove_int(avl, 796); avl = remove_int(avl, 728); - avl = gpr_avl_add(avl, box(855), box(244), NULL); - avl = gpr_avl_add(avl, box(769), box(245), NULL); - avl = gpr_avl_add(avl, box(631), box(246), NULL); + avl = gpr_avl_add(avl, box(855), box(244), nullptr); + avl = gpr_avl_add(avl, box(769), box(245), nullptr); + avl = gpr_avl_add(avl, box(631), box(246), nullptr); avl = remove_int(avl, 648); - avl = gpr_avl_add(avl, box(187), box(248), NULL); - avl = gpr_avl_add(avl, box(31), box(249), NULL); + avl = gpr_avl_add(avl, box(187), box(248), nullptr); + avl = gpr_avl_add(avl, box(31), box(249), nullptr); avl = remove_int(avl, 163); - avl = gpr_avl_add(avl, box(218), box(251), NULL); - avl = gpr_avl_add(avl, box(488), box(252), NULL); - avl = gpr_avl_add(avl, box(387), box(253), NULL); - avl = gpr_avl_add(avl, box(809), box(254), NULL); - avl = gpr_avl_add(avl, box(997), box(255), NULL); + avl = gpr_avl_add(avl, box(218), box(251), nullptr); + avl = gpr_avl_add(avl, box(488), box(252), nullptr); + avl = gpr_avl_add(avl, box(387), box(253), nullptr); + avl = gpr_avl_add(avl, box(809), box(254), nullptr); + avl = gpr_avl_add(avl, box(997), box(255), nullptr); avl = remove_int(avl, 678); - avl = gpr_avl_add(avl, box(368), box(257), NULL); - avl = gpr_avl_add(avl, box(220), box(258), NULL); - avl = gpr_avl_add(avl, box(373), box(259), NULL); + avl = gpr_avl_add(avl, box(368), box(257), nullptr); + avl = gpr_avl_add(avl, box(220), box(258), nullptr); + avl = gpr_avl_add(avl, box(373), box(259), nullptr); avl = remove_int(avl, 874); avl = remove_int(avl, 682); avl = remove_int(avl, 1014); avl = remove_int(avl, 195); - avl = gpr_avl_add(avl, box(868), box(264), NULL); + avl = gpr_avl_add(avl, box(868), box(264), nullptr); avl = remove_int(avl, 254); avl = remove_int(avl, 456); - avl = gpr_avl_add(avl, box(906), box(267), NULL); + avl = gpr_avl_add(avl, box(906), box(267), nullptr); avl = remove_int(avl, 711); - avl = gpr_avl_add(avl, box(632), box(269), NULL); + avl = gpr_avl_add(avl, box(632), box(269), nullptr); avl = remove_int(avl, 474); - avl = gpr_avl_add(avl, box(508), box(271), NULL); - avl = gpr_avl_add(avl, box(518), box(272), NULL); + avl = gpr_avl_add(avl, box(508), box(271), nullptr); + avl = gpr_avl_add(avl, box(518), box(272), nullptr); avl = remove_int(avl, 579); avl = remove_int(avl, 948); - avl = gpr_avl_add(avl, box(789), box(275), NULL); - avl = gpr_avl_add(avl, box(48), box(276), NULL); - avl = gpr_avl_add(avl, box(256), box(277), NULL); - avl = gpr_avl_add(avl, box(754), box(278), NULL); + avl = gpr_avl_add(avl, box(789), box(275), nullptr); + avl = gpr_avl_add(avl, box(48), box(276), nullptr); + avl = gpr_avl_add(avl, box(256), box(277), nullptr); + avl = gpr_avl_add(avl, box(754), box(278), nullptr); avl = remove_int(avl, 215); - avl = gpr_avl_add(avl, box(679), box(280), NULL); - avl = gpr_avl_add(avl, box(606), box(281), NULL); + avl = gpr_avl_add(avl, box(679), box(280), nullptr); + avl = gpr_avl_add(avl, box(606), box(281), nullptr); avl = remove_int(avl, 941); avl = remove_int(avl, 31); - avl = gpr_avl_add(avl, box(758), box(284), NULL); + avl = gpr_avl_add(avl, box(758), box(284), nullptr); avl = remove_int(avl, 101); - avl = gpr_avl_add(avl, box(244), box(286), NULL); - avl = gpr_avl_add(avl, box(337), box(287), NULL); - avl = gpr_avl_add(avl, box(461), box(288), NULL); + avl = gpr_avl_add(avl, box(244), box(286), nullptr); + avl = gpr_avl_add(avl, box(337), box(287), nullptr); + avl = gpr_avl_add(avl, box(461), box(288), nullptr); avl = remove_int(avl, 476); - avl = gpr_avl_add(avl, box(845), box(290), NULL); + avl = gpr_avl_add(avl, box(845), box(290), nullptr); avl = remove_int(avl, 160); - avl = gpr_avl_add(avl, box(690), box(292), NULL); + avl = gpr_avl_add(avl, box(690), box(292), nullptr); avl = remove_int(avl, 931); - avl = gpr_avl_add(avl, box(869), box(294), NULL); - avl = gpr_avl_add(avl, box(1019), box(295), NULL); + avl = gpr_avl_add(avl, box(869), box(294), nullptr); + avl = gpr_avl_add(avl, box(1019), box(295), nullptr); avl = remove_int(avl, 591); avl = remove_int(avl, 635); avl = remove_int(avl, 67); - avl = gpr_avl_add(avl, box(113), box(299), NULL); + avl = gpr_avl_add(avl, box(113), box(299), nullptr); avl = remove_int(avl, 305); - avl = gpr_avl_add(avl, box(10), box(301), NULL); + avl = gpr_avl_add(avl, box(10), box(301), nullptr); avl = remove_int(avl, 823); avl = remove_int(avl, 288); avl = remove_int(avl, 239); - avl = gpr_avl_add(avl, box(646), box(305), NULL); - avl = gpr_avl_add(avl, box(1006), box(306), NULL); - avl = gpr_avl_add(avl, box(954), box(307), NULL); - avl = gpr_avl_add(avl, box(199), box(308), NULL); - avl = gpr_avl_add(avl, box(69), box(309), NULL); - avl = gpr_avl_add(avl, box(984), box(310), NULL); + avl = gpr_avl_add(avl, box(646), box(305), nullptr); + avl = gpr_avl_add(avl, box(1006), box(306), nullptr); + avl = gpr_avl_add(avl, box(954), box(307), nullptr); + avl = gpr_avl_add(avl, box(199), box(308), nullptr); + avl = gpr_avl_add(avl, box(69), box(309), nullptr); + avl = gpr_avl_add(avl, box(984), box(310), nullptr); avl = remove_int(avl, 568); avl = remove_int(avl, 666); avl = remove_int(avl, 37); - avl = gpr_avl_add(avl, box(845), box(314), NULL); + avl = gpr_avl_add(avl, box(845), box(314), nullptr); avl = remove_int(avl, 535); avl = remove_int(avl, 365); avl = remove_int(avl, 676); @@ -1460,372 +1460,372 @@ static void test_badcase3(void) { avl = remove_int(avl, 425); avl = remove_int(avl, 704); avl = remove_int(avl, 168); - avl = gpr_avl_add(avl, box(853), box(322), NULL); - avl = gpr_avl_add(avl, box(335), box(323), NULL); - avl = gpr_avl_add(avl, box(961), box(324), NULL); - avl = gpr_avl_add(avl, box(73), box(325), NULL); + avl = gpr_avl_add(avl, box(853), box(322), nullptr); + avl = gpr_avl_add(avl, box(335), box(323), nullptr); + avl = gpr_avl_add(avl, box(961), box(324), nullptr); + avl = gpr_avl_add(avl, box(73), box(325), nullptr); avl = remove_int(avl, 469); - avl = gpr_avl_add(avl, box(449), box(327), NULL); + avl = gpr_avl_add(avl, box(449), box(327), nullptr); avl = remove_int(avl, 821); - avl = gpr_avl_add(avl, box(845), box(329), NULL); + avl = gpr_avl_add(avl, box(845), box(329), nullptr); avl = remove_int(avl, 637); - avl = gpr_avl_add(avl, box(769), box(331), NULL); - avl = gpr_avl_add(avl, box(901), box(332), NULL); + avl = gpr_avl_add(avl, box(769), box(331), nullptr); + avl = gpr_avl_add(avl, box(901), box(332), nullptr); avl = remove_int(avl, 142); avl = remove_int(avl, 361); avl = remove_int(avl, 876); - avl = gpr_avl_add(avl, box(614), box(336), NULL); - avl = gpr_avl_add(avl, box(729), box(337), NULL); + avl = gpr_avl_add(avl, box(614), box(336), nullptr); + avl = gpr_avl_add(avl, box(729), box(337), nullptr); avl = remove_int(avl, 120); avl = remove_int(avl, 473); avl = remove_int(avl, 445); - avl = gpr_avl_add(avl, box(978), box(341), NULL); - avl = gpr_avl_add(avl, box(164), box(342), NULL); - avl = gpr_avl_add(avl, box(1), box(343), NULL); + avl = gpr_avl_add(avl, box(978), box(341), nullptr); + avl = gpr_avl_add(avl, box(164), box(342), nullptr); + avl = gpr_avl_add(avl, box(1), box(343), nullptr); avl = remove_int(avl, 890); - avl = gpr_avl_add(avl, box(605), box(345), NULL); - avl = gpr_avl_add(avl, box(178), box(346), NULL); - avl = gpr_avl_add(avl, box(481), box(347), NULL); - avl = gpr_avl_add(avl, box(772), box(348), NULL); + avl = gpr_avl_add(avl, box(605), box(345), nullptr); + avl = gpr_avl_add(avl, box(178), box(346), nullptr); + avl = gpr_avl_add(avl, box(481), box(347), nullptr); + avl = gpr_avl_add(avl, box(772), box(348), nullptr); avl = remove_int(avl, 824); avl = remove_int(avl, 167); avl = remove_int(avl, 151); - avl = gpr_avl_add(avl, box(698), box(352), NULL); - avl = gpr_avl_add(avl, box(202), box(353), NULL); - avl = gpr_avl_add(avl, box(921), box(354), NULL); - avl = gpr_avl_add(avl, box(875), box(355), NULL); + avl = gpr_avl_add(avl, box(698), box(352), nullptr); + avl = gpr_avl_add(avl, box(202), box(353), nullptr); + avl = gpr_avl_add(avl, box(921), box(354), nullptr); + avl = gpr_avl_add(avl, box(875), box(355), nullptr); avl = remove_int(avl, 197); avl = remove_int(avl, 232); - avl = gpr_avl_add(avl, box(209), box(358), NULL); + avl = gpr_avl_add(avl, box(209), box(358), nullptr); avl = remove_int(avl, 324); avl = remove_int(avl, 56); avl = remove_int(avl, 579); avl = remove_int(avl, 255); avl = remove_int(avl, 290); - avl = gpr_avl_add(avl, box(661), box(364), NULL); - avl = gpr_avl_add(avl, box(113), box(365), NULL); + avl = gpr_avl_add(avl, box(661), box(364), nullptr); + avl = gpr_avl_add(avl, box(113), box(365), nullptr); avl = remove_int(avl, 767); - avl = gpr_avl_add(avl, box(586), box(367), NULL); - avl = gpr_avl_add(avl, box(121), box(368), NULL); + avl = gpr_avl_add(avl, box(586), box(367), nullptr); + avl = gpr_avl_add(avl, box(121), box(368), nullptr); avl = remove_int(avl, 235); avl = remove_int(avl, 439); avl = remove_int(avl, 360); - avl = gpr_avl_add(avl, box(916), box(372), NULL); + avl = gpr_avl_add(avl, box(916), box(372), nullptr); avl = remove_int(avl, 999); - avl = gpr_avl_add(avl, box(825), box(374), NULL); - avl = gpr_avl_add(avl, box(177), box(375), NULL); + avl = gpr_avl_add(avl, box(825), box(374), nullptr); + avl = gpr_avl_add(avl, box(177), box(375), nullptr); avl = remove_int(avl, 204); avl = remove_int(avl, 92); - avl = gpr_avl_add(avl, box(794), box(378), NULL); - avl = gpr_avl_add(avl, box(463), box(379), NULL); - avl = gpr_avl_add(avl, box(472), box(380), NULL); + avl = gpr_avl_add(avl, box(794), box(378), nullptr); + avl = gpr_avl_add(avl, box(463), box(379), nullptr); + avl = gpr_avl_add(avl, box(472), box(380), nullptr); avl = remove_int(avl, 235); - avl = gpr_avl_add(avl, box(840), box(382), NULL); + avl = gpr_avl_add(avl, box(840), box(382), nullptr); avl = remove_int(avl, 657); - avl = gpr_avl_add(avl, box(586), box(384), NULL); - avl = gpr_avl_add(avl, box(979), box(385), NULL); + avl = gpr_avl_add(avl, box(586), box(384), nullptr); + avl = gpr_avl_add(avl, box(979), box(385), nullptr); avl = remove_int(avl, 979); - avl = gpr_avl_add(avl, box(639), box(387), NULL); + avl = gpr_avl_add(avl, box(639), box(387), nullptr); avl = remove_int(avl, 907); avl = remove_int(avl, 973); - avl = gpr_avl_add(avl, box(913), box(390), NULL); - avl = gpr_avl_add(avl, box(566), box(391), NULL); - avl = gpr_avl_add(avl, box(883), box(392), NULL); - avl = gpr_avl_add(avl, box(552), box(393), NULL); - avl = gpr_avl_add(avl, box(16), box(394), NULL); + avl = gpr_avl_add(avl, box(913), box(390), nullptr); + avl = gpr_avl_add(avl, box(566), box(391), nullptr); + avl = gpr_avl_add(avl, box(883), box(392), nullptr); + avl = gpr_avl_add(avl, box(552), box(393), nullptr); + avl = gpr_avl_add(avl, box(16), box(394), nullptr); avl = remove_int(avl, 60); - avl = gpr_avl_add(avl, box(567), box(396), NULL); - avl = gpr_avl_add(avl, box(705), box(397), NULL); - avl = gpr_avl_add(avl, box(94), box(398), NULL); + avl = gpr_avl_add(avl, box(567), box(396), nullptr); + avl = gpr_avl_add(avl, box(705), box(397), nullptr); + avl = gpr_avl_add(avl, box(94), box(398), nullptr); avl = remove_int(avl, 321); - avl = gpr_avl_add(avl, box(207), box(400), NULL); - avl = gpr_avl_add(avl, box(682), box(401), NULL); - avl = gpr_avl_add(avl, box(592), box(402), NULL); - avl = gpr_avl_add(avl, box(10), box(403), NULL); + avl = gpr_avl_add(avl, box(207), box(400), nullptr); + avl = gpr_avl_add(avl, box(682), box(401), nullptr); + avl = gpr_avl_add(avl, box(592), box(402), nullptr); + avl = gpr_avl_add(avl, box(10), box(403), nullptr); avl = remove_int(avl, 911); avl = remove_int(avl, 161); - avl = gpr_avl_add(avl, box(86), box(406), NULL); + avl = gpr_avl_add(avl, box(86), box(406), nullptr); avl = remove_int(avl, 893); avl = remove_int(avl, 362); - avl = gpr_avl_add(avl, box(599), box(409), NULL); + avl = gpr_avl_add(avl, box(599), box(409), nullptr); avl = remove_int(avl, 413); - avl = gpr_avl_add(avl, box(867), box(411), NULL); + avl = gpr_avl_add(avl, box(867), box(411), nullptr); avl = remove_int(avl, 955); - avl = gpr_avl_add(avl, box(341), box(413), NULL); - avl = gpr_avl_add(avl, box(887), box(414), NULL); + avl = gpr_avl_add(avl, box(341), box(413), nullptr); + avl = gpr_avl_add(avl, box(887), box(414), nullptr); avl = remove_int(avl, 706); - avl = gpr_avl_add(avl, box(939), box(416), NULL); + avl = gpr_avl_add(avl, box(939), box(416), nullptr); avl = remove_int(avl, 233); avl = remove_int(avl, 662); avl = remove_int(avl, 984); avl = remove_int(avl, 203); - avl = gpr_avl_add(avl, box(326), box(421), NULL); + avl = gpr_avl_add(avl, box(326), box(421), nullptr); avl = remove_int(avl, 848); - avl = gpr_avl_add(avl, box(235), box(423), NULL); + avl = gpr_avl_add(avl, box(235), box(423), nullptr); avl = remove_int(avl, 617); - avl = gpr_avl_add(avl, box(565), box(425), NULL); + avl = gpr_avl_add(avl, box(565), box(425), nullptr); avl = remove_int(avl, 469); - avl = gpr_avl_add(avl, box(988), box(427), NULL); + avl = gpr_avl_add(avl, box(988), box(427), nullptr); avl = remove_int(avl, 957); - avl = gpr_avl_add(avl, box(426), box(429), NULL); + avl = gpr_avl_add(avl, box(426), box(429), nullptr); avl = remove_int(avl, 967); - avl = gpr_avl_add(avl, box(890), box(431), NULL); - avl = gpr_avl_add(avl, box(473), box(432), NULL); + avl = gpr_avl_add(avl, box(890), box(431), nullptr); + avl = gpr_avl_add(avl, box(473), box(432), nullptr); avl = remove_int(avl, 367); avl = remove_int(avl, 344); avl = remove_int(avl, 660); avl = remove_int(avl, 448); avl = remove_int(avl, 837); avl = remove_int(avl, 158); - avl = gpr_avl_add(avl, box(459), box(439), NULL); + avl = gpr_avl_add(avl, box(459), box(439), nullptr); avl = remove_int(avl, 882); avl = remove_int(avl, 782); - avl = gpr_avl_add(avl, box(408), box(442), NULL); - avl = gpr_avl_add(avl, box(728), box(443), NULL); + avl = gpr_avl_add(avl, box(408), box(442), nullptr); + avl = gpr_avl_add(avl, box(728), box(443), nullptr); avl = remove_int(avl, 27); - avl = gpr_avl_add(avl, box(137), box(445), NULL); - avl = gpr_avl_add(avl, box(239), box(446), NULL); + avl = gpr_avl_add(avl, box(137), box(445), nullptr); + avl = gpr_avl_add(avl, box(239), box(446), nullptr); avl = remove_int(avl, 854); - avl = gpr_avl_add(avl, box(104), box(448), NULL); - avl = gpr_avl_add(avl, box(823), box(449), NULL); - avl = gpr_avl_add(avl, box(524), box(450), NULL); - avl = gpr_avl_add(avl, box(995), box(451), NULL); + avl = gpr_avl_add(avl, box(104), box(448), nullptr); + avl = gpr_avl_add(avl, box(823), box(449), nullptr); + avl = gpr_avl_add(avl, box(524), box(450), nullptr); + avl = gpr_avl_add(avl, box(995), box(451), nullptr); avl = remove_int(avl, 422); avl = remove_int(avl, 220); - avl = gpr_avl_add(avl, box(856), box(454), NULL); + avl = gpr_avl_add(avl, box(856), box(454), nullptr); avl = remove_int(avl, 332); - avl = gpr_avl_add(avl, box(679), box(456), NULL); + avl = gpr_avl_add(avl, box(679), box(456), nullptr); avl = remove_int(avl, 18); - avl = gpr_avl_add(avl, box(837), box(458), NULL); + avl = gpr_avl_add(avl, box(837), box(458), nullptr); avl = remove_int(avl, 405); avl = remove_int(avl, 877); avl = remove_int(avl, 835); - avl = gpr_avl_add(avl, box(547), box(462), NULL); + avl = gpr_avl_add(avl, box(547), box(462), nullptr); avl = remove_int(avl, 805); avl = remove_int(avl, 862); - avl = gpr_avl_add(avl, box(75), box(465), NULL); + avl = gpr_avl_add(avl, box(75), box(465), nullptr); avl = remove_int(avl, 41); - avl = gpr_avl_add(avl, box(310), box(467), NULL); + avl = gpr_avl_add(avl, box(310), box(467), nullptr); avl = remove_int(avl, 855); - avl = gpr_avl_add(avl, box(20), box(469), NULL); + avl = gpr_avl_add(avl, box(20), box(469), nullptr); avl = remove_int(avl, 186); avl = remove_int(avl, 378); avl = remove_int(avl, 442); avl = remove_int(avl, 930); - avl = gpr_avl_add(avl, box(118), box(474), NULL); - avl = gpr_avl_add(avl, box(96), box(475), NULL); + avl = gpr_avl_add(avl, box(118), box(474), nullptr); + avl = gpr_avl_add(avl, box(96), box(475), nullptr); avl = remove_int(avl, 854); - avl = gpr_avl_add(avl, box(65), box(477), NULL); - avl = gpr_avl_add(avl, box(573), box(478), NULL); - avl = gpr_avl_add(avl, box(4), box(479), NULL); - avl = gpr_avl_add(avl, box(451), box(480), NULL); - avl = gpr_avl_add(avl, box(774), box(481), NULL); - avl = gpr_avl_add(avl, box(126), box(482), NULL); + avl = gpr_avl_add(avl, box(65), box(477), nullptr); + avl = gpr_avl_add(avl, box(573), box(478), nullptr); + avl = gpr_avl_add(avl, box(4), box(479), nullptr); + avl = gpr_avl_add(avl, box(451), box(480), nullptr); + avl = gpr_avl_add(avl, box(774), box(481), nullptr); + avl = gpr_avl_add(avl, box(126), box(482), nullptr); avl = remove_int(avl, 956); avl = remove_int(avl, 591); avl = remove_int(avl, 644); - avl = gpr_avl_add(avl, box(304), box(486), NULL); + avl = gpr_avl_add(avl, box(304), box(486), nullptr); avl = remove_int(avl, 620); avl = remove_int(avl, 394); - avl = gpr_avl_add(avl, box(1002), box(489), NULL); - avl = gpr_avl_add(avl, box(837), box(490), NULL); + avl = gpr_avl_add(avl, box(1002), box(489), nullptr); + avl = gpr_avl_add(avl, box(837), box(490), nullptr); avl = remove_int(avl, 485); - avl = gpr_avl_add(avl, box(1005), box(492), NULL); + avl = gpr_avl_add(avl, box(1005), box(492), nullptr); avl = remove_int(avl, 21); - avl = gpr_avl_add(avl, box(396), box(494), NULL); + avl = gpr_avl_add(avl, box(396), box(494), nullptr); avl = remove_int(avl, 966); - avl = gpr_avl_add(avl, box(105), box(496), NULL); - avl = gpr_avl_add(avl, box(316), box(497), NULL); + avl = gpr_avl_add(avl, box(105), box(496), nullptr); + avl = gpr_avl_add(avl, box(316), box(497), nullptr); avl = remove_int(avl, 776); - avl = gpr_avl_add(avl, box(188), box(499), NULL); + avl = gpr_avl_add(avl, box(188), box(499), nullptr); avl = remove_int(avl, 200); - avl = gpr_avl_add(avl, box(98), box(501), NULL); - avl = gpr_avl_add(avl, box(831), box(502), NULL); - avl = gpr_avl_add(avl, box(227), box(503), NULL); - avl = gpr_avl_add(avl, box(220), box(504), NULL); + avl = gpr_avl_add(avl, box(98), box(501), nullptr); + avl = gpr_avl_add(avl, box(831), box(502), nullptr); + avl = gpr_avl_add(avl, box(227), box(503), nullptr); + avl = gpr_avl_add(avl, box(220), box(504), nullptr); avl = remove_int(avl, 715); avl = remove_int(avl, 279); - avl = gpr_avl_add(avl, box(701), box(507), NULL); - avl = gpr_avl_add(avl, box(726), box(508), NULL); - avl = gpr_avl_add(avl, box(815), box(509), NULL); - avl = gpr_avl_add(avl, box(749), box(510), NULL); + avl = gpr_avl_add(avl, box(701), box(507), nullptr); + avl = gpr_avl_add(avl, box(726), box(508), nullptr); + avl = gpr_avl_add(avl, box(815), box(509), nullptr); + avl = gpr_avl_add(avl, box(749), box(510), nullptr); avl = remove_int(avl, 946); avl = remove_int(avl, 449); avl = remove_int(avl, 62); avl = remove_int(avl, 487); - avl = gpr_avl_add(avl, box(545), box(515), NULL); + avl = gpr_avl_add(avl, box(545), box(515), nullptr); avl = remove_int(avl, 59); - avl = gpr_avl_add(avl, box(168), box(517), NULL); + avl = gpr_avl_add(avl, box(168), box(517), nullptr); avl = remove_int(avl, 337); - avl = gpr_avl_add(avl, box(69), box(519), NULL); + avl = gpr_avl_add(avl, box(69), box(519), nullptr); avl = remove_int(avl, 600); - avl = gpr_avl_add(avl, box(591), box(521), NULL); - avl = gpr_avl_add(avl, box(960), box(522), NULL); - avl = gpr_avl_add(avl, box(116), box(523), NULL); + avl = gpr_avl_add(avl, box(591), box(521), nullptr); + avl = gpr_avl_add(avl, box(960), box(522), nullptr); + avl = gpr_avl_add(avl, box(116), box(523), nullptr); avl = remove_int(avl, 991); - avl = gpr_avl_add(avl, box(760), box(525), NULL); - avl = gpr_avl_add(avl, box(664), box(526), NULL); - avl = gpr_avl_add(avl, box(547), box(527), NULL); + avl = gpr_avl_add(avl, box(760), box(525), nullptr); + avl = gpr_avl_add(avl, box(664), box(526), nullptr); + avl = gpr_avl_add(avl, box(547), box(527), nullptr); avl = remove_int(avl, 922); - avl = gpr_avl_add(avl, box(290), box(529), NULL); - avl = gpr_avl_add(avl, box(859), box(530), NULL); - avl = gpr_avl_add(avl, box(49), box(531), NULL); + avl = gpr_avl_add(avl, box(290), box(529), nullptr); + avl = gpr_avl_add(avl, box(859), box(530), nullptr); + avl = gpr_avl_add(avl, box(49), box(531), nullptr); avl = remove_int(avl, 455); avl = remove_int(avl, 786); - avl = gpr_avl_add(avl, box(613), box(534), NULL); - avl = gpr_avl_add(avl, box(326), box(535), NULL); + avl = gpr_avl_add(avl, box(613), box(534), nullptr); + avl = gpr_avl_add(avl, box(326), box(535), nullptr); avl = remove_int(avl, 615); - avl = gpr_avl_add(avl, box(45), box(537), NULL); - avl = gpr_avl_add(avl, box(162), box(538), NULL); - avl = gpr_avl_add(avl, box(189), box(539), NULL); + avl = gpr_avl_add(avl, box(45), box(537), nullptr); + avl = gpr_avl_add(avl, box(162), box(538), nullptr); + avl = gpr_avl_add(avl, box(189), box(539), nullptr); avl = remove_int(avl, 68); avl = remove_int(avl, 846); - avl = gpr_avl_add(avl, box(608), box(542), NULL); + avl = gpr_avl_add(avl, box(608), box(542), nullptr); avl = remove_int(avl, 821); - avl = gpr_avl_add(avl, box(978), box(544), NULL); - avl = gpr_avl_add(avl, box(892), box(545), NULL); + avl = gpr_avl_add(avl, box(978), box(544), nullptr); + avl = gpr_avl_add(avl, box(892), box(545), nullptr); avl = remove_int(avl, 924); - avl = gpr_avl_add(avl, box(708), box(547), NULL); + avl = gpr_avl_add(avl, box(708), box(547), nullptr); avl = remove_int(avl, 135); avl = remove_int(avl, 124); - avl = gpr_avl_add(avl, box(301), box(550), NULL); - avl = gpr_avl_add(avl, box(939), box(551), NULL); - avl = gpr_avl_add(avl, box(344), box(552), NULL); + avl = gpr_avl_add(avl, box(301), box(550), nullptr); + avl = gpr_avl_add(avl, box(939), box(551), nullptr); + avl = gpr_avl_add(avl, box(344), box(552), nullptr); avl = remove_int(avl, 443); avl = remove_int(avl, 122); - avl = gpr_avl_add(avl, box(636), box(555), NULL); + avl = gpr_avl_add(avl, box(636), box(555), nullptr); avl = remove_int(avl, 558); - avl = gpr_avl_add(avl, box(923), box(557), NULL); + avl = gpr_avl_add(avl, box(923), box(557), nullptr); avl = remove_int(avl, 827); - avl = gpr_avl_add(avl, box(649), box(559), NULL); - avl = gpr_avl_add(avl, box(808), box(560), NULL); + avl = gpr_avl_add(avl, box(649), box(559), nullptr); + avl = gpr_avl_add(avl, box(808), box(560), nullptr); avl = remove_int(avl, 570); avl = remove_int(avl, 434); - avl = gpr_avl_add(avl, box(40), box(563), NULL); - avl = gpr_avl_add(avl, box(725), box(564), NULL); + avl = gpr_avl_add(avl, box(40), box(563), nullptr); + avl = gpr_avl_add(avl, box(725), box(564), nullptr); avl = remove_int(avl, 295); avl = remove_int(avl, 615); avl = remove_int(avl, 919); avl = remove_int(avl, 170); avl = remove_int(avl, 442); avl = remove_int(avl, 971); - avl = gpr_avl_add(avl, box(483), box(571), NULL); - avl = gpr_avl_add(avl, box(512), box(572), NULL); + avl = gpr_avl_add(avl, box(483), box(571), nullptr); + avl = gpr_avl_add(avl, box(512), box(572), nullptr); avl = remove_int(avl, 648); avl = remove_int(avl, 78); avl = remove_int(avl, 72); avl = remove_int(avl, 790); avl = remove_int(avl, 571); - avl = gpr_avl_add(avl, box(898), box(578), NULL); + avl = gpr_avl_add(avl, box(898), box(578), nullptr); avl = remove_int(avl, 770); avl = remove_int(avl, 776); - avl = gpr_avl_add(avl, box(602), box(581), NULL); + avl = gpr_avl_add(avl, box(602), box(581), nullptr); avl = remove_int(avl, 251); - avl = gpr_avl_add(avl, box(303), box(583), NULL); + avl = gpr_avl_add(avl, box(303), box(583), nullptr); avl = remove_int(avl, 837); - avl = gpr_avl_add(avl, box(714), box(585), NULL); + avl = gpr_avl_add(avl, box(714), box(585), nullptr); avl = remove_int(avl, 800); - avl = gpr_avl_add(avl, box(266), box(587), NULL); - avl = gpr_avl_add(avl, box(555), box(588), NULL); + avl = gpr_avl_add(avl, box(266), box(587), nullptr); + avl = gpr_avl_add(avl, box(555), box(588), nullptr); avl = remove_int(avl, 604); avl = remove_int(avl, 163); avl = remove_int(avl, 497); - avl = gpr_avl_add(avl, box(296), box(592), NULL); + avl = gpr_avl_add(avl, box(296), box(592), nullptr); avl = remove_int(avl, 129); - avl = gpr_avl_add(avl, box(656), box(594), NULL); + avl = gpr_avl_add(avl, box(656), box(594), nullptr); avl = remove_int(avl, 769); avl = remove_int(avl, 941); - avl = gpr_avl_add(avl, box(775), box(597), NULL); - avl = gpr_avl_add(avl, box(846), box(598), NULL); + avl = gpr_avl_add(avl, box(775), box(597), nullptr); + avl = gpr_avl_add(avl, box(846), box(598), nullptr); avl = remove_int(avl, 591); avl = remove_int(avl, 801); avl = remove_int(avl, 419); avl = remove_int(avl, 455); - avl = gpr_avl_add(avl, box(866), box(603), NULL); - avl = gpr_avl_add(avl, box(575), box(604), NULL); - avl = gpr_avl_add(avl, box(620), box(605), NULL); + avl = gpr_avl_add(avl, box(866), box(603), nullptr); + avl = gpr_avl_add(avl, box(575), box(604), nullptr); + avl = gpr_avl_add(avl, box(620), box(605), nullptr); avl = remove_int(avl, 100); avl = remove_int(avl, 667); - avl = gpr_avl_add(avl, box(138), box(608), NULL); - avl = gpr_avl_add(avl, box(566), box(609), NULL); - avl = gpr_avl_add(avl, box(673), box(610), NULL); - avl = gpr_avl_add(avl, box(178), box(611), NULL); + avl = gpr_avl_add(avl, box(138), box(608), nullptr); + avl = gpr_avl_add(avl, box(566), box(609), nullptr); + avl = gpr_avl_add(avl, box(673), box(610), nullptr); + avl = gpr_avl_add(avl, box(178), box(611), nullptr); avl = remove_int(avl, 659); - avl = gpr_avl_add(avl, box(759), box(613), NULL); - avl = gpr_avl_add(avl, box(1008), box(614), NULL); + avl = gpr_avl_add(avl, box(759), box(613), nullptr); + avl = gpr_avl_add(avl, box(1008), box(614), nullptr); avl = remove_int(avl, 116); - avl = gpr_avl_add(avl, box(608), box(616), NULL); - avl = gpr_avl_add(avl, box(339), box(617), NULL); - avl = gpr_avl_add(avl, box(197), box(618), NULL); + avl = gpr_avl_add(avl, box(608), box(616), nullptr); + avl = gpr_avl_add(avl, box(339), box(617), nullptr); + avl = gpr_avl_add(avl, box(197), box(618), nullptr); avl = remove_int(avl, 25); avl = remove_int(avl, 628); - avl = gpr_avl_add(avl, box(487), box(621), NULL); + avl = gpr_avl_add(avl, box(487), box(621), nullptr); avl = remove_int(avl, 739); avl = remove_int(avl, 100); avl = remove_int(avl, 928); - avl = gpr_avl_add(avl, box(647), box(625), NULL); + avl = gpr_avl_add(avl, box(647), box(625), nullptr); avl = remove_int(avl, 978); avl = remove_int(avl, 143); avl = remove_int(avl, 755); - avl = gpr_avl_add(avl, box(71), box(629), NULL); + avl = gpr_avl_add(avl, box(71), box(629), nullptr); avl = remove_int(avl, 205); - avl = gpr_avl_add(avl, box(501), box(631), NULL); + avl = gpr_avl_add(avl, box(501), box(631), nullptr); avl = remove_int(avl, 723); avl = remove_int(avl, 852); avl = remove_int(avl, 1021); avl = remove_int(avl, 670); avl = remove_int(avl, 500); - avl = gpr_avl_add(avl, box(330), box(637), NULL); + avl = gpr_avl_add(avl, box(330), box(637), nullptr); avl = remove_int(avl, 264); - avl = gpr_avl_add(avl, box(69), box(639), NULL); + avl = gpr_avl_add(avl, box(69), box(639), nullptr); avl = remove_int(avl, 73); - avl = gpr_avl_add(avl, box(745), box(641), NULL); + avl = gpr_avl_add(avl, box(745), box(641), nullptr); avl = remove_int(avl, 518); avl = remove_int(avl, 641); avl = remove_int(avl, 768); - avl = gpr_avl_add(avl, box(988), box(645), NULL); - avl = gpr_avl_add(avl, box(899), box(646), NULL); + avl = gpr_avl_add(avl, box(988), box(645), nullptr); + avl = gpr_avl_add(avl, box(899), box(646), nullptr); avl = remove_int(avl, 763); avl = remove_int(avl, 281); avl = remove_int(avl, 496); - avl = gpr_avl_add(avl, box(445), box(650), NULL); + avl = gpr_avl_add(avl, box(445), box(650), nullptr); avl = remove_int(avl, 905); - avl = gpr_avl_add(avl, box(275), box(652), NULL); - avl = gpr_avl_add(avl, box(137), box(653), NULL); + avl = gpr_avl_add(avl, box(275), box(652), nullptr); + avl = gpr_avl_add(avl, box(137), box(653), nullptr); avl = remove_int(avl, 642); - avl = gpr_avl_add(avl, box(708), box(655), NULL); + avl = gpr_avl_add(avl, box(708), box(655), nullptr); avl = remove_int(avl, 922); - avl = gpr_avl_add(avl, box(743), box(657), NULL); + avl = gpr_avl_add(avl, box(743), box(657), nullptr); avl = remove_int(avl, 295); avl = remove_int(avl, 665); avl = remove_int(avl, 48); - avl = gpr_avl_add(avl, box(1012), box(661), NULL); + avl = gpr_avl_add(avl, box(1012), box(661), nullptr); avl = remove_int(avl, 71); avl = remove_int(avl, 523); - avl = gpr_avl_add(avl, box(319), box(664), NULL); + avl = gpr_avl_add(avl, box(319), box(664), nullptr); avl = remove_int(avl, 632); - avl = gpr_avl_add(avl, box(137), box(666), NULL); - avl = gpr_avl_add(avl, box(686), box(667), NULL); - avl = gpr_avl_add(avl, box(724), box(668), NULL); - avl = gpr_avl_add(avl, box(952), box(669), NULL); - avl = gpr_avl_add(avl, box(5), box(670), NULL); + avl = gpr_avl_add(avl, box(137), box(666), nullptr); + avl = gpr_avl_add(avl, box(686), box(667), nullptr); + avl = gpr_avl_add(avl, box(724), box(668), nullptr); + avl = gpr_avl_add(avl, box(952), box(669), nullptr); + avl = gpr_avl_add(avl, box(5), box(670), nullptr); avl = remove_int(avl, 35); - avl = gpr_avl_add(avl, box(43), box(672), NULL); - avl = gpr_avl_add(avl, box(320), box(673), NULL); - avl = gpr_avl_add(avl, box(115), box(674), NULL); + avl = gpr_avl_add(avl, box(43), box(672), nullptr); + avl = gpr_avl_add(avl, box(320), box(673), nullptr); + avl = gpr_avl_add(avl, box(115), box(674), nullptr); avl = remove_int(avl, 377); avl = remove_int(avl, 591); avl = remove_int(avl, 87); avl = remove_int(avl, 93); - avl = gpr_avl_add(avl, box(1016), box(679), NULL); - avl = gpr_avl_add(avl, box(605), box(680), NULL); - avl = gpr_avl_add(avl, box(152), box(681), NULL); - avl = gpr_avl_add(avl, box(113), box(682), NULL); + avl = gpr_avl_add(avl, box(1016), box(679), nullptr); + avl = gpr_avl_add(avl, box(605), box(680), nullptr); + avl = gpr_avl_add(avl, box(152), box(681), nullptr); + avl = gpr_avl_add(avl, box(113), box(682), nullptr); avl = remove_int(avl, 131); avl = remove_int(avl, 637); - avl = gpr_avl_add(avl, box(156), box(685), NULL); + avl = gpr_avl_add(avl, box(156), box(685), nullptr); avl = remove_int(avl, 696); - avl = gpr_avl_add(avl, box(546), box(687), NULL); + avl = gpr_avl_add(avl, box(546), box(687), nullptr); avl = remove_int(avl, 970); avl = remove_int(avl, 53); avl = remove_int(avl, 827); @@ -1839,22 +1839,22 @@ static void test_badcase3(void) { avl = remove_int(avl, 244); avl = remove_int(avl, 576); avl = remove_int(avl, 413); - avl = gpr_avl_add(avl, box(500), box(701), NULL); + avl = gpr_avl_add(avl, box(500), box(701), nullptr); avl = remove_int(avl, 924); - avl = gpr_avl_add(avl, box(825), box(703), NULL); + avl = gpr_avl_add(avl, box(825), box(703), nullptr); avl = remove_int(avl, 888); avl = remove_int(avl, 931); - avl = gpr_avl_add(avl, box(285), box(706), NULL); + avl = gpr_avl_add(avl, box(285), box(706), nullptr); avl = remove_int(avl, 62); avl = remove_int(avl, 444); avl = remove_int(avl, 946); - avl = gpr_avl_add(avl, box(122), box(710), NULL); - avl = gpr_avl_add(avl, box(846), box(711), NULL); + avl = gpr_avl_add(avl, box(122), box(710), nullptr); + avl = gpr_avl_add(avl, box(846), box(711), nullptr); avl = remove_int(avl, 628); - avl = gpr_avl_add(avl, box(511), box(713), NULL); - avl = gpr_avl_add(avl, box(398), box(714), NULL); + avl = gpr_avl_add(avl, box(511), box(713), nullptr); + avl = gpr_avl_add(avl, box(398), box(714), nullptr); avl = remove_int(avl, 730); - avl = gpr_avl_add(avl, box(797), box(716), NULL); + avl = gpr_avl_add(avl, box(797), box(716), nullptr); avl = remove_int(avl, 897); avl = remove_int(avl, 228); avl = remove_int(avl, 544); @@ -1863,51 +1863,51 @@ static void test_badcase3(void) { avl = remove_int(avl, 583); avl = remove_int(avl, 894); avl = remove_int(avl, 942); - avl = gpr_avl_add(avl, box(346), box(725), NULL); - avl = gpr_avl_add(avl, box(1015), box(726), NULL); + avl = gpr_avl_add(avl, box(346), box(725), nullptr); + avl = gpr_avl_add(avl, box(1015), box(726), nullptr); avl = remove_int(avl, 813); - avl = gpr_avl_add(avl, box(213), box(728), NULL); + avl = gpr_avl_add(avl, box(213), box(728), nullptr); avl = remove_int(avl, 468); avl = remove_int(avl, 365); avl = remove_int(avl, 399); - avl = gpr_avl_add(avl, box(380), box(732), NULL); + avl = gpr_avl_add(avl, box(380), box(732), nullptr); avl = remove_int(avl, 835); avl = remove_int(avl, 970); - avl = gpr_avl_add(avl, box(700), box(735), NULL); - avl = gpr_avl_add(avl, box(807), box(736), NULL); + avl = gpr_avl_add(avl, box(700), box(735), nullptr); + avl = gpr_avl_add(avl, box(807), box(736), nullptr); avl = remove_int(avl, 312); avl = remove_int(avl, 282); avl = remove_int(avl, 370); avl = remove_int(avl, 999); avl = remove_int(avl, 241); avl = remove_int(avl, 884); - avl = gpr_avl_add(avl, box(587), box(743), NULL); - avl = gpr_avl_add(avl, box(332), box(744), NULL); + avl = gpr_avl_add(avl, box(587), box(743), nullptr); + avl = gpr_avl_add(avl, box(332), box(744), nullptr); avl = remove_int(avl, 686); avl = remove_int(avl, 206); avl = remove_int(avl, 835); - avl = gpr_avl_add(avl, box(334), box(748), NULL); + avl = gpr_avl_add(avl, box(334), box(748), nullptr); avl = remove_int(avl, 171); - avl = gpr_avl_add(avl, box(1002), box(750), NULL); - avl = gpr_avl_add(avl, box(779), box(751), NULL); - avl = gpr_avl_add(avl, box(307), box(752), NULL); - avl = gpr_avl_add(avl, box(127), box(753), NULL); - avl = gpr_avl_add(avl, box(251), box(754), NULL); + avl = gpr_avl_add(avl, box(1002), box(750), nullptr); + avl = gpr_avl_add(avl, box(779), box(751), nullptr); + avl = gpr_avl_add(avl, box(307), box(752), nullptr); + avl = gpr_avl_add(avl, box(127), box(753), nullptr); + avl = gpr_avl_add(avl, box(251), box(754), nullptr); avl = remove_int(avl, 790); avl = remove_int(avl, 189); avl = remove_int(avl, 193); avl = remove_int(avl, 38); avl = remove_int(avl, 124); - avl = gpr_avl_add(avl, box(812), box(760), NULL); + avl = gpr_avl_add(avl, box(812), box(760), nullptr); avl = remove_int(avl, 43); - avl = gpr_avl_add(avl, box(871), box(762), NULL); - avl = gpr_avl_add(avl, box(580), box(763), NULL); + avl = gpr_avl_add(avl, box(871), box(762), nullptr); + avl = gpr_avl_add(avl, box(580), box(763), nullptr); avl = remove_int(avl, 501); avl = remove_int(avl, 462); avl = remove_int(avl, 599); - avl = gpr_avl_add(avl, box(240), box(767), NULL); - avl = gpr_avl_add(avl, box(285), box(768), NULL); - avl = gpr_avl_add(avl, box(472), box(769), NULL); + avl = gpr_avl_add(avl, box(240), box(767), nullptr); + avl = gpr_avl_add(avl, box(285), box(768), nullptr); + avl = gpr_avl_add(avl, box(472), box(769), nullptr); avl = remove_int(avl, 865); avl = remove_int(avl, 763); avl = remove_int(avl, 245); @@ -1915,48 +1915,48 @@ static void test_badcase3(void) { avl = remove_int(avl, 713); avl = remove_int(avl, 654); avl = remove_int(avl, 1014); - avl = gpr_avl_add(avl, box(495), box(777), NULL); - avl = gpr_avl_add(avl, box(552), box(778), NULL); + avl = gpr_avl_add(avl, box(495), box(777), nullptr); + avl = gpr_avl_add(avl, box(552), box(778), nullptr); avl = remove_int(avl, 19); avl = remove_int(avl, 803); - avl = gpr_avl_add(avl, box(508), box(781), NULL); + avl = gpr_avl_add(avl, box(508), box(781), nullptr); avl = remove_int(avl, 699); avl = remove_int(avl, 260); avl = remove_int(avl, 92); avl = remove_int(avl, 497); - avl = gpr_avl_add(avl, box(970), box(786), NULL); + avl = gpr_avl_add(avl, box(970), box(786), nullptr); avl = remove_int(avl, 987); avl = remove_int(avl, 168); avl = remove_int(avl, 476); avl = remove_int(avl, 248); - avl = gpr_avl_add(avl, box(358), box(791), NULL); + avl = gpr_avl_add(avl, box(358), box(791), nullptr); avl = remove_int(avl, 804); avl = remove_int(avl, 77); avl = remove_int(avl, 905); avl = remove_int(avl, 362); - avl = gpr_avl_add(avl, box(578), box(796), NULL); + avl = gpr_avl_add(avl, box(578), box(796), nullptr); avl = remove_int(avl, 38); avl = remove_int(avl, 595); - avl = gpr_avl_add(avl, box(213), box(799), NULL); + avl = gpr_avl_add(avl, box(213), box(799), nullptr); avl = remove_int(avl, 7); avl = remove_int(avl, 620); - avl = gpr_avl_add(avl, box(946), box(802), NULL); + avl = gpr_avl_add(avl, box(946), box(802), nullptr); avl = remove_int(avl, 145); - avl = gpr_avl_add(avl, box(628), box(804), NULL); + avl = gpr_avl_add(avl, box(628), box(804), nullptr); avl = remove_int(avl, 972); - avl = gpr_avl_add(avl, box(728), box(806), NULL); + avl = gpr_avl_add(avl, box(728), box(806), nullptr); avl = remove_int(avl, 91); - avl = gpr_avl_add(avl, box(136), box(808), NULL); - avl = gpr_avl_add(avl, box(841), box(809), NULL); - avl = gpr_avl_add(avl, box(265), box(810), NULL); - avl = gpr_avl_add(avl, box(701), box(811), NULL); - avl = gpr_avl_add(avl, box(27), box(812), NULL); + avl = gpr_avl_add(avl, box(136), box(808), nullptr); + avl = gpr_avl_add(avl, box(841), box(809), nullptr); + avl = gpr_avl_add(avl, box(265), box(810), nullptr); + avl = gpr_avl_add(avl, box(701), box(811), nullptr); + avl = gpr_avl_add(avl, box(27), box(812), nullptr); avl = remove_int(avl, 72); avl = remove_int(avl, 14); - avl = gpr_avl_add(avl, box(286), box(815), NULL); + avl = gpr_avl_add(avl, box(286), box(815), nullptr); avl = remove_int(avl, 996); avl = remove_int(avl, 998); - avl = gpr_avl_add(avl, box(466), box(818), NULL); + avl = gpr_avl_add(avl, box(466), box(818), nullptr); avl = remove_int(avl, 1009); avl = remove_int(avl, 741); avl = remove_int(avl, 947); @@ -1965,138 +1965,138 @@ static void test_badcase3(void) { avl = remove_int(avl, 183); avl = remove_int(avl, 395); avl = remove_int(avl, 951); - avl = gpr_avl_add(avl, box(267), box(827), NULL); + avl = gpr_avl_add(avl, box(267), box(827), nullptr); avl = remove_int(avl, 812); - avl = gpr_avl_add(avl, box(577), box(829), NULL); + avl = gpr_avl_add(avl, box(577), box(829), nullptr); avl = remove_int(avl, 624); avl = remove_int(avl, 847); avl = remove_int(avl, 745); - avl = gpr_avl_add(avl, box(491), box(833), NULL); - avl = gpr_avl_add(avl, box(941), box(834), NULL); + avl = gpr_avl_add(avl, box(491), box(833), nullptr); + avl = gpr_avl_add(avl, box(941), box(834), nullptr); avl = remove_int(avl, 258); - avl = gpr_avl_add(avl, box(410), box(836), NULL); - avl = gpr_avl_add(avl, box(80), box(837), NULL); - avl = gpr_avl_add(avl, box(196), box(838), NULL); - avl = gpr_avl_add(avl, box(5), box(839), NULL); + avl = gpr_avl_add(avl, box(410), box(836), nullptr); + avl = gpr_avl_add(avl, box(80), box(837), nullptr); + avl = gpr_avl_add(avl, box(196), box(838), nullptr); + avl = gpr_avl_add(avl, box(5), box(839), nullptr); avl = remove_int(avl, 782); - avl = gpr_avl_add(avl, box(827), box(841), NULL); + avl = gpr_avl_add(avl, box(827), box(841), nullptr); avl = remove_int(avl, 472); avl = remove_int(avl, 664); - avl = gpr_avl_add(avl, box(409), box(844), NULL); - avl = gpr_avl_add(avl, box(62), box(845), NULL); + avl = gpr_avl_add(avl, box(409), box(844), nullptr); + avl = gpr_avl_add(avl, box(62), box(845), nullptr); avl = remove_int(avl, 56); avl = remove_int(avl, 606); avl = remove_int(avl, 707); avl = remove_int(avl, 989); avl = remove_int(avl, 549); avl = remove_int(avl, 259); - avl = gpr_avl_add(avl, box(405), box(852), NULL); + avl = gpr_avl_add(avl, box(405), box(852), nullptr); avl = remove_int(avl, 587); avl = remove_int(avl, 350); - avl = gpr_avl_add(avl, box(980), box(855), NULL); - avl = gpr_avl_add(avl, box(992), box(856), NULL); - avl = gpr_avl_add(avl, box(818), box(857), NULL); + avl = gpr_avl_add(avl, box(980), box(855), nullptr); + avl = gpr_avl_add(avl, box(992), box(856), nullptr); + avl = gpr_avl_add(avl, box(818), box(857), nullptr); avl = remove_int(avl, 853); avl = remove_int(avl, 701); - avl = gpr_avl_add(avl, box(675), box(860), NULL); + avl = gpr_avl_add(avl, box(675), box(860), nullptr); avl = remove_int(avl, 248); avl = remove_int(avl, 649); - avl = gpr_avl_add(avl, box(508), box(863), NULL); + avl = gpr_avl_add(avl, box(508), box(863), nullptr); avl = remove_int(avl, 927); - avl = gpr_avl_add(avl, box(957), box(865), NULL); - avl = gpr_avl_add(avl, box(698), box(866), NULL); - avl = gpr_avl_add(avl, box(388), box(867), NULL); - avl = gpr_avl_add(avl, box(532), box(868), NULL); - avl = gpr_avl_add(avl, box(681), box(869), NULL); + avl = gpr_avl_add(avl, box(957), box(865), nullptr); + avl = gpr_avl_add(avl, box(698), box(866), nullptr); + avl = gpr_avl_add(avl, box(388), box(867), nullptr); + avl = gpr_avl_add(avl, box(532), box(868), nullptr); + avl = gpr_avl_add(avl, box(681), box(869), nullptr); avl = remove_int(avl, 544); avl = remove_int(avl, 991); avl = remove_int(avl, 397); - avl = gpr_avl_add(avl, box(954), box(873), NULL); - avl = gpr_avl_add(avl, box(219), box(874), NULL); - avl = gpr_avl_add(avl, box(465), box(875), NULL); + avl = gpr_avl_add(avl, box(954), box(873), nullptr); + avl = gpr_avl_add(avl, box(219), box(874), nullptr); + avl = gpr_avl_add(avl, box(465), box(875), nullptr); avl = remove_int(avl, 371); - avl = gpr_avl_add(avl, box(601), box(877), NULL); - avl = gpr_avl_add(avl, box(543), box(878), NULL); + avl = gpr_avl_add(avl, box(601), box(877), nullptr); + avl = gpr_avl_add(avl, box(543), box(878), nullptr); avl = remove_int(avl, 329); - avl = gpr_avl_add(avl, box(560), box(880), NULL); + avl = gpr_avl_add(avl, box(560), box(880), nullptr); avl = remove_int(avl, 898); - avl = gpr_avl_add(avl, box(455), box(882), NULL); + avl = gpr_avl_add(avl, box(455), box(882), nullptr); avl = remove_int(avl, 313); - avl = gpr_avl_add(avl, box(215), box(884), NULL); + avl = gpr_avl_add(avl, box(215), box(884), nullptr); avl = remove_int(avl, 846); - avl = gpr_avl_add(avl, box(608), box(886), NULL); + avl = gpr_avl_add(avl, box(608), box(886), nullptr); avl = remove_int(avl, 248); - avl = gpr_avl_add(avl, box(575), box(888), NULL); + avl = gpr_avl_add(avl, box(575), box(888), nullptr); avl = remove_int(avl, 207); avl = remove_int(avl, 810); avl = remove_int(avl, 665); avl = remove_int(avl, 361); - avl = gpr_avl_add(avl, box(154), box(893), NULL); - avl = gpr_avl_add(avl, box(329), box(894), NULL); - avl = gpr_avl_add(avl, box(326), box(895), NULL); + avl = gpr_avl_add(avl, box(154), box(893), nullptr); + avl = gpr_avl_add(avl, box(329), box(894), nullptr); + avl = gpr_avl_add(avl, box(326), box(895), nullptr); avl = remove_int(avl, 746); avl = remove_int(avl, 99); - avl = gpr_avl_add(avl, box(464), box(898), NULL); - avl = gpr_avl_add(avl, box(141), box(899), NULL); + avl = gpr_avl_add(avl, box(464), box(898), nullptr); + avl = gpr_avl_add(avl, box(141), box(899), nullptr); avl = remove_int(avl, 383); - avl = gpr_avl_add(avl, box(414), box(901), NULL); - avl = gpr_avl_add(avl, box(777), box(902), NULL); + avl = gpr_avl_add(avl, box(414), box(901), nullptr); + avl = gpr_avl_add(avl, box(777), box(902), nullptr); avl = remove_int(avl, 972); avl = remove_int(avl, 841); avl = remove_int(avl, 100); - avl = gpr_avl_add(avl, box(828), box(906), NULL); + avl = gpr_avl_add(avl, box(828), box(906), nullptr); avl = remove_int(avl, 785); - avl = gpr_avl_add(avl, box(1008), box(908), NULL); - avl = gpr_avl_add(avl, box(46), box(909), NULL); + avl = gpr_avl_add(avl, box(1008), box(908), nullptr); + avl = gpr_avl_add(avl, box(46), box(909), nullptr); avl = remove_int(avl, 399); - avl = gpr_avl_add(avl, box(178), box(911), NULL); - avl = gpr_avl_add(avl, box(573), box(912), NULL); + avl = gpr_avl_add(avl, box(178), box(911), nullptr); + avl = gpr_avl_add(avl, box(573), box(912), nullptr); avl = remove_int(avl, 299); - avl = gpr_avl_add(avl, box(690), box(914), NULL); - avl = gpr_avl_add(avl, box(692), box(915), NULL); + avl = gpr_avl_add(avl, box(690), box(914), nullptr); + avl = gpr_avl_add(avl, box(692), box(915), nullptr); avl = remove_int(avl, 404); avl = remove_int(avl, 16); avl = remove_int(avl, 746); avl = remove_int(avl, 486); avl = remove_int(avl, 119); - avl = gpr_avl_add(avl, box(167), box(921), NULL); + avl = gpr_avl_add(avl, box(167), box(921), nullptr); avl = remove_int(avl, 328); - avl = gpr_avl_add(avl, box(89), box(923), NULL); + avl = gpr_avl_add(avl, box(89), box(923), nullptr); avl = remove_int(avl, 867); avl = remove_int(avl, 626); avl = remove_int(avl, 507); - avl = gpr_avl_add(avl, box(365), box(927), NULL); - avl = gpr_avl_add(avl, box(58), box(928), NULL); - avl = gpr_avl_add(avl, box(70), box(929), NULL); + avl = gpr_avl_add(avl, box(365), box(927), nullptr); + avl = gpr_avl_add(avl, box(58), box(928), nullptr); + avl = gpr_avl_add(avl, box(70), box(929), nullptr); avl = remove_int(avl, 81); avl = remove_int(avl, 797); - avl = gpr_avl_add(avl, box(846), box(932), NULL); + avl = gpr_avl_add(avl, box(846), box(932), nullptr); avl = remove_int(avl, 642); - avl = gpr_avl_add(avl, box(777), box(934), NULL); + avl = gpr_avl_add(avl, box(777), box(934), nullptr); avl = remove_int(avl, 107); - avl = gpr_avl_add(avl, box(691), box(936), NULL); - avl = gpr_avl_add(avl, box(820), box(937), NULL); - avl = gpr_avl_add(avl, box(202), box(938), NULL); - avl = gpr_avl_add(avl, box(308), box(939), NULL); - avl = gpr_avl_add(avl, box(20), box(940), NULL); + avl = gpr_avl_add(avl, box(691), box(936), nullptr); + avl = gpr_avl_add(avl, box(820), box(937), nullptr); + avl = gpr_avl_add(avl, box(202), box(938), nullptr); + avl = gpr_avl_add(avl, box(308), box(939), nullptr); + avl = gpr_avl_add(avl, box(20), box(940), nullptr); avl = remove_int(avl, 289); - avl = gpr_avl_add(avl, box(714), box(942), NULL); - avl = gpr_avl_add(avl, box(584), box(943), NULL); + avl = gpr_avl_add(avl, box(714), box(942), nullptr); + avl = gpr_avl_add(avl, box(584), box(943), nullptr); avl = remove_int(avl, 294); - avl = gpr_avl_add(avl, box(496), box(945), NULL); - avl = gpr_avl_add(avl, box(394), box(946), NULL); - avl = gpr_avl_add(avl, box(860), box(947), NULL); - avl = gpr_avl_add(avl, box(58), box(948), NULL); + avl = gpr_avl_add(avl, box(496), box(945), nullptr); + avl = gpr_avl_add(avl, box(394), box(946), nullptr); + avl = gpr_avl_add(avl, box(860), box(947), nullptr); + avl = gpr_avl_add(avl, box(58), box(948), nullptr); avl = remove_int(avl, 784); avl = remove_int(avl, 584); avl = remove_int(avl, 708); - avl = gpr_avl_add(avl, box(142), box(952), NULL); - avl = gpr_avl_add(avl, box(247), box(953), NULL); - avl = gpr_avl_add(avl, box(389), box(954), NULL); + avl = gpr_avl_add(avl, box(142), box(952), nullptr); + avl = gpr_avl_add(avl, box(247), box(953), nullptr); + avl = gpr_avl_add(avl, box(389), box(954), nullptr); avl = remove_int(avl, 390); - avl = gpr_avl_add(avl, box(465), box(956), NULL); - avl = gpr_avl_add(avl, box(936), box(957), NULL); - avl = gpr_avl_add(avl, box(309), box(958), NULL); + avl = gpr_avl_add(avl, box(465), box(956), nullptr); + avl = gpr_avl_add(avl, box(936), box(957), nullptr); + avl = gpr_avl_add(avl, box(309), box(958), nullptr); avl = remove_int(avl, 928); avl = remove_int(avl, 128); avl = remove_int(avl, 979); @@ -2104,15 +2104,15 @@ static void test_badcase3(void) { avl = remove_int(avl, 738); avl = remove_int(avl, 271); avl = remove_int(avl, 540); - avl = gpr_avl_add(avl, box(365), box(966), NULL); + avl = gpr_avl_add(avl, box(365), box(966), nullptr); avl = remove_int(avl, 82); - avl = gpr_avl_add(avl, box(728), box(968), NULL); + avl = gpr_avl_add(avl, box(728), box(968), nullptr); avl = remove_int(avl, 852); - avl = gpr_avl_add(avl, box(884), box(970), NULL); - avl = gpr_avl_add(avl, box(502), box(971), NULL); + avl = gpr_avl_add(avl, box(884), box(970), nullptr); + avl = gpr_avl_add(avl, box(502), box(971), nullptr); avl = remove_int(avl, 898); avl = remove_int(avl, 481); - avl = gpr_avl_add(avl, box(911), box(974), NULL); + avl = gpr_avl_add(avl, box(911), box(974), nullptr); avl = remove_int(avl, 787); avl = remove_int(avl, 785); avl = remove_int(avl, 537); @@ -2121,125 +2121,125 @@ static void test_badcase3(void) { avl = remove_int(avl, 749); avl = remove_int(avl, 637); avl = remove_int(avl, 900); - avl = gpr_avl_add(avl, box(598), box(983), NULL); + avl = gpr_avl_add(avl, box(598), box(983), nullptr); avl = remove_int(avl, 25); avl = remove_int(avl, 697); - avl = gpr_avl_add(avl, box(645), box(986), NULL); - avl = gpr_avl_add(avl, box(211), box(987), NULL); - avl = gpr_avl_add(avl, box(589), box(988), NULL); + avl = gpr_avl_add(avl, box(645), box(986), nullptr); + avl = gpr_avl_add(avl, box(211), box(987), nullptr); + avl = gpr_avl_add(avl, box(589), box(988), nullptr); avl = remove_int(avl, 702); - avl = gpr_avl_add(avl, box(53), box(990), NULL); + avl = gpr_avl_add(avl, box(53), box(990), nullptr); avl = remove_int(avl, 492); avl = remove_int(avl, 185); avl = remove_int(avl, 246); avl = remove_int(avl, 257); avl = remove_int(avl, 502); avl = remove_int(avl, 34); - avl = gpr_avl_add(avl, box(74), box(997), NULL); - avl = gpr_avl_add(avl, box(834), box(998), NULL); - avl = gpr_avl_add(avl, box(514), box(999), NULL); - avl = gpr_avl_add(avl, box(75), box(1000), NULL); + avl = gpr_avl_add(avl, box(74), box(997), nullptr); + avl = gpr_avl_add(avl, box(834), box(998), nullptr); + avl = gpr_avl_add(avl, box(514), box(999), nullptr); + avl = gpr_avl_add(avl, box(75), box(1000), nullptr); avl = remove_int(avl, 745); - avl = gpr_avl_add(avl, box(362), box(1002), NULL); + avl = gpr_avl_add(avl, box(362), box(1002), nullptr); avl = remove_int(avl, 215); - avl = gpr_avl_add(avl, box(624), box(1004), NULL); + avl = gpr_avl_add(avl, box(624), box(1004), nullptr); avl = remove_int(avl, 404); avl = remove_int(avl, 359); avl = remove_int(avl, 491); - avl = gpr_avl_add(avl, box(903), box(1008), NULL); - avl = gpr_avl_add(avl, box(240), box(1009), NULL); + avl = gpr_avl_add(avl, box(903), box(1008), nullptr); + avl = gpr_avl_add(avl, box(240), box(1009), nullptr); avl = remove_int(avl, 95); - avl = gpr_avl_add(avl, box(119), box(1011), NULL); - avl = gpr_avl_add(avl, box(857), box(1012), NULL); + avl = gpr_avl_add(avl, box(119), box(1011), nullptr); + avl = gpr_avl_add(avl, box(857), box(1012), nullptr); avl = remove_int(avl, 39); avl = remove_int(avl, 866); - avl = gpr_avl_add(avl, box(503), box(1015), NULL); - avl = gpr_avl_add(avl, box(740), box(1016), NULL); + avl = gpr_avl_add(avl, box(503), box(1015), nullptr); + avl = gpr_avl_add(avl, box(740), box(1016), nullptr); avl = remove_int(avl, 637); avl = remove_int(avl, 156); avl = remove_int(avl, 6); avl = remove_int(avl, 745); avl = remove_int(avl, 433); avl = remove_int(avl, 283); - avl = gpr_avl_add(avl, box(625), box(1023), NULL); + avl = gpr_avl_add(avl, box(625), box(1023), nullptr); avl = remove_int(avl, 638); - avl = gpr_avl_add(avl, box(299), box(1025), NULL); - avl = gpr_avl_add(avl, box(584), box(1026), NULL); + avl = gpr_avl_add(avl, box(299), box(1025), nullptr); + avl = gpr_avl_add(avl, box(584), box(1026), nullptr); avl = remove_int(avl, 863); - avl = gpr_avl_add(avl, box(612), box(1028), NULL); - avl = gpr_avl_add(avl, box(62), box(1029), NULL); - avl = gpr_avl_add(avl, box(432), box(1030), NULL); + avl = gpr_avl_add(avl, box(612), box(1028), nullptr); + avl = gpr_avl_add(avl, box(62), box(1029), nullptr); + avl = gpr_avl_add(avl, box(432), box(1030), nullptr); avl = remove_int(avl, 371); avl = remove_int(avl, 790); avl = remove_int(avl, 227); avl = remove_int(avl, 836); - avl = gpr_avl_add(avl, box(703), box(1035), NULL); - avl = gpr_avl_add(avl, box(644), box(1036), NULL); + avl = gpr_avl_add(avl, box(703), box(1035), nullptr); + avl = gpr_avl_add(avl, box(644), box(1036), nullptr); avl = remove_int(avl, 638); - avl = gpr_avl_add(avl, box(13), box(1038), NULL); + avl = gpr_avl_add(avl, box(13), box(1038), nullptr); avl = remove_int(avl, 66); avl = remove_int(avl, 82); - avl = gpr_avl_add(avl, box(362), box(1041), NULL); - avl = gpr_avl_add(avl, box(783), box(1042), NULL); + avl = gpr_avl_add(avl, box(362), box(1041), nullptr); + avl = gpr_avl_add(avl, box(783), box(1042), nullptr); avl = remove_int(avl, 60); - avl = gpr_avl_add(avl, box(80), box(1044), NULL); - avl = gpr_avl_add(avl, box(825), box(1045), NULL); - avl = gpr_avl_add(avl, box(688), box(1046), NULL); - avl = gpr_avl_add(avl, box(662), box(1047), NULL); + avl = gpr_avl_add(avl, box(80), box(1044), nullptr); + avl = gpr_avl_add(avl, box(825), box(1045), nullptr); + avl = gpr_avl_add(avl, box(688), box(1046), nullptr); + avl = gpr_avl_add(avl, box(662), box(1047), nullptr); avl = remove_int(avl, 156); avl = remove_int(avl, 376); avl = remove_int(avl, 99); - avl = gpr_avl_add(avl, box(526), box(1051), NULL); - avl = gpr_avl_add(avl, box(168), box(1052), NULL); + avl = gpr_avl_add(avl, box(526), box(1051), nullptr); + avl = gpr_avl_add(avl, box(168), box(1052), nullptr); avl = remove_int(avl, 646); avl = remove_int(avl, 380); avl = remove_int(avl, 833); - avl = gpr_avl_add(avl, box(53), box(1056), NULL); + avl = gpr_avl_add(avl, box(53), box(1056), nullptr); avl = remove_int(avl, 105); - avl = gpr_avl_add(avl, box(373), box(1058), NULL); - avl = gpr_avl_add(avl, box(184), box(1059), NULL); + avl = gpr_avl_add(avl, box(373), box(1058), nullptr); + avl = gpr_avl_add(avl, box(184), box(1059), nullptr); avl = remove_int(avl, 288); - avl = gpr_avl_add(avl, box(966), box(1061), NULL); + avl = gpr_avl_add(avl, box(966), box(1061), nullptr); avl = remove_int(avl, 158); - avl = gpr_avl_add(avl, box(406), box(1063), NULL); + avl = gpr_avl_add(avl, box(406), box(1063), nullptr); avl = remove_int(avl, 470); - avl = gpr_avl_add(avl, box(283), box(1065), NULL); - avl = gpr_avl_add(avl, box(838), box(1066), NULL); - avl = gpr_avl_add(avl, box(288), box(1067), NULL); - avl = gpr_avl_add(avl, box(950), box(1068), NULL); - avl = gpr_avl_add(avl, box(163), box(1069), NULL); + avl = gpr_avl_add(avl, box(283), box(1065), nullptr); + avl = gpr_avl_add(avl, box(838), box(1066), nullptr); + avl = gpr_avl_add(avl, box(288), box(1067), nullptr); + avl = gpr_avl_add(avl, box(950), box(1068), nullptr); + avl = gpr_avl_add(avl, box(163), box(1069), nullptr); avl = remove_int(avl, 623); avl = remove_int(avl, 769); - avl = gpr_avl_add(avl, box(144), box(1072), NULL); - avl = gpr_avl_add(avl, box(489), box(1073), NULL); + avl = gpr_avl_add(avl, box(144), box(1072), nullptr); + avl = gpr_avl_add(avl, box(489), box(1073), nullptr); avl = remove_int(avl, 15); - avl = gpr_avl_add(avl, box(971), box(1075), NULL); + avl = gpr_avl_add(avl, box(971), box(1075), nullptr); avl = remove_int(avl, 660); - avl = gpr_avl_add(avl, box(255), box(1077), NULL); + avl = gpr_avl_add(avl, box(255), box(1077), nullptr); avl = remove_int(avl, 494); - avl = gpr_avl_add(avl, box(109), box(1079), NULL); - avl = gpr_avl_add(avl, box(420), box(1080), NULL); - avl = gpr_avl_add(avl, box(509), box(1081), NULL); + avl = gpr_avl_add(avl, box(109), box(1079), nullptr); + avl = gpr_avl_add(avl, box(420), box(1080), nullptr); + avl = gpr_avl_add(avl, box(509), box(1081), nullptr); avl = remove_int(avl, 178); - avl = gpr_avl_add(avl, box(216), box(1083), NULL); - avl = gpr_avl_add(avl, box(707), box(1084), NULL); - avl = gpr_avl_add(avl, box(411), box(1085), NULL); - avl = gpr_avl_add(avl, box(352), box(1086), NULL); + avl = gpr_avl_add(avl, box(216), box(1083), nullptr); + avl = gpr_avl_add(avl, box(707), box(1084), nullptr); + avl = gpr_avl_add(avl, box(411), box(1085), nullptr); + avl = gpr_avl_add(avl, box(352), box(1086), nullptr); avl = remove_int(avl, 983); - avl = gpr_avl_add(avl, box(6), box(1088), NULL); - avl = gpr_avl_add(avl, box(1014), box(1089), NULL); + avl = gpr_avl_add(avl, box(6), box(1088), nullptr); + avl = gpr_avl_add(avl, box(1014), box(1089), nullptr); avl = remove_int(avl, 98); avl = remove_int(avl, 325); - avl = gpr_avl_add(avl, box(851), box(1092), NULL); + avl = gpr_avl_add(avl, box(851), box(1092), nullptr); avl = remove_int(avl, 553); - avl = gpr_avl_add(avl, box(218), box(1094), NULL); - avl = gpr_avl_add(avl, box(261), box(1095), NULL); + avl = gpr_avl_add(avl, box(218), box(1094), nullptr); + avl = gpr_avl_add(avl, box(261), box(1095), nullptr); avl = remove_int(avl, 31); - avl = gpr_avl_add(avl, box(872), box(1097), NULL); + avl = gpr_avl_add(avl, box(872), box(1097), nullptr); avl = remove_int(avl, 543); avl = remove_int(avl, 314); avl = remove_int(avl, 443); - avl = gpr_avl_add(avl, box(533), box(1101), NULL); + avl = gpr_avl_add(avl, box(533), box(1101), nullptr); avl = remove_int(avl, 881); avl = remove_int(avl, 269); avl = remove_int(avl, 940); @@ -2248,114 +2248,114 @@ static void test_badcase3(void) { avl = remove_int(avl, 773); avl = remove_int(avl, 790); avl = remove_int(avl, 345); - avl = gpr_avl_add(avl, box(965), box(1110), NULL); + avl = gpr_avl_add(avl, box(965), box(1110), nullptr); avl = remove_int(avl, 622); - avl = gpr_avl_add(avl, box(352), box(1112), NULL); + avl = gpr_avl_add(avl, box(352), box(1112), nullptr); avl = remove_int(avl, 182); - avl = gpr_avl_add(avl, box(534), box(1114), NULL); - avl = gpr_avl_add(avl, box(97), box(1115), NULL); - avl = gpr_avl_add(avl, box(198), box(1116), NULL); + avl = gpr_avl_add(avl, box(534), box(1114), nullptr); + avl = gpr_avl_add(avl, box(97), box(1115), nullptr); + avl = gpr_avl_add(avl, box(198), box(1116), nullptr); avl = remove_int(avl, 750); - avl = gpr_avl_add(avl, box(98), box(1118), NULL); + avl = gpr_avl_add(avl, box(98), box(1118), nullptr); avl = remove_int(avl, 943); - avl = gpr_avl_add(avl, box(254), box(1120), NULL); - avl = gpr_avl_add(avl, box(30), box(1121), NULL); + avl = gpr_avl_add(avl, box(254), box(1120), nullptr); + avl = gpr_avl_add(avl, box(30), box(1121), nullptr); avl = remove_int(avl, 14); avl = remove_int(avl, 475); avl = remove_int(avl, 82); - avl = gpr_avl_add(avl, box(789), box(1125), NULL); - avl = gpr_avl_add(avl, box(402), box(1126), NULL); + avl = gpr_avl_add(avl, box(789), box(1125), nullptr); + avl = gpr_avl_add(avl, box(402), box(1126), nullptr); avl = remove_int(avl, 1019); - avl = gpr_avl_add(avl, box(858), box(1128), NULL); - avl = gpr_avl_add(avl, box(625), box(1129), NULL); + avl = gpr_avl_add(avl, box(858), box(1128), nullptr); + avl = gpr_avl_add(avl, box(625), box(1129), nullptr); avl = remove_int(avl, 675); avl = remove_int(avl, 323); - avl = gpr_avl_add(avl, box(329), box(1132), NULL); + avl = gpr_avl_add(avl, box(329), box(1132), nullptr); avl = remove_int(avl, 929); avl = remove_int(avl, 44); - avl = gpr_avl_add(avl, box(443), box(1135), NULL); - avl = gpr_avl_add(avl, box(653), box(1136), NULL); - avl = gpr_avl_add(avl, box(750), box(1137), NULL); - avl = gpr_avl_add(avl, box(252), box(1138), NULL); - avl = gpr_avl_add(avl, box(449), box(1139), NULL); + avl = gpr_avl_add(avl, box(443), box(1135), nullptr); + avl = gpr_avl_add(avl, box(653), box(1136), nullptr); + avl = gpr_avl_add(avl, box(750), box(1137), nullptr); + avl = gpr_avl_add(avl, box(252), box(1138), nullptr); + avl = gpr_avl_add(avl, box(449), box(1139), nullptr); avl = remove_int(avl, 1022); avl = remove_int(avl, 357); avl = remove_int(avl, 602); avl = remove_int(avl, 131); - avl = gpr_avl_add(avl, box(531), box(1144), NULL); + avl = gpr_avl_add(avl, box(531), box(1144), nullptr); avl = remove_int(avl, 806); - avl = gpr_avl_add(avl, box(455), box(1146), NULL); + avl = gpr_avl_add(avl, box(455), box(1146), nullptr); avl = remove_int(avl, 31); - avl = gpr_avl_add(avl, box(154), box(1148), NULL); - avl = gpr_avl_add(avl, box(189), box(1149), NULL); + avl = gpr_avl_add(avl, box(154), box(1148), nullptr); + avl = gpr_avl_add(avl, box(189), box(1149), nullptr); avl = remove_int(avl, 786); - avl = gpr_avl_add(avl, box(496), box(1151), NULL); - avl = gpr_avl_add(avl, box(81), box(1152), NULL); - avl = gpr_avl_add(avl, box(59), box(1153), NULL); + avl = gpr_avl_add(avl, box(496), box(1151), nullptr); + avl = gpr_avl_add(avl, box(81), box(1152), nullptr); + avl = gpr_avl_add(avl, box(59), box(1153), nullptr); avl = remove_int(avl, 424); avl = remove_int(avl, 668); - avl = gpr_avl_add(avl, box(723), box(1156), NULL); - avl = gpr_avl_add(avl, box(822), box(1157), NULL); - avl = gpr_avl_add(avl, box(354), box(1158), NULL); + avl = gpr_avl_add(avl, box(723), box(1156), nullptr); + avl = gpr_avl_add(avl, box(822), box(1157), nullptr); + avl = gpr_avl_add(avl, box(354), box(1158), nullptr); avl = remove_int(avl, 738); - avl = gpr_avl_add(avl, box(686), box(1160), NULL); - avl = gpr_avl_add(avl, box(43), box(1161), NULL); - avl = gpr_avl_add(avl, box(625), box(1162), NULL); - avl = gpr_avl_add(avl, box(902), box(1163), NULL); - avl = gpr_avl_add(avl, box(12), box(1164), NULL); - avl = gpr_avl_add(avl, box(977), box(1165), NULL); - avl = gpr_avl_add(avl, box(699), box(1166), NULL); - avl = gpr_avl_add(avl, box(189), box(1167), NULL); + avl = gpr_avl_add(avl, box(686), box(1160), nullptr); + avl = gpr_avl_add(avl, box(43), box(1161), nullptr); + avl = gpr_avl_add(avl, box(625), box(1162), nullptr); + avl = gpr_avl_add(avl, box(902), box(1163), nullptr); + avl = gpr_avl_add(avl, box(12), box(1164), nullptr); + avl = gpr_avl_add(avl, box(977), box(1165), nullptr); + avl = gpr_avl_add(avl, box(699), box(1166), nullptr); + avl = gpr_avl_add(avl, box(189), box(1167), nullptr); avl = remove_int(avl, 672); avl = remove_int(avl, 90); avl = remove_int(avl, 757); avl = remove_int(avl, 494); - avl = gpr_avl_add(avl, box(759), box(1172), NULL); + avl = gpr_avl_add(avl, box(759), box(1172), nullptr); avl = remove_int(avl, 758); avl = remove_int(avl, 222); - avl = gpr_avl_add(avl, box(975), box(1175), NULL); + avl = gpr_avl_add(avl, box(975), box(1175), nullptr); avl = remove_int(avl, 993); - avl = gpr_avl_add(avl, box(2), box(1177), NULL); - avl = gpr_avl_add(avl, box(70), box(1178), NULL); + avl = gpr_avl_add(avl, box(2), box(1177), nullptr); + avl = gpr_avl_add(avl, box(70), box(1178), nullptr); avl = remove_int(avl, 350); avl = remove_int(avl, 972); avl = remove_int(avl, 880); - avl = gpr_avl_add(avl, box(753), box(1182), NULL); + avl = gpr_avl_add(avl, box(753), box(1182), nullptr); avl = remove_int(avl, 404); - avl = gpr_avl_add(avl, box(294), box(1184), NULL); + avl = gpr_avl_add(avl, box(294), box(1184), nullptr); avl = remove_int(avl, 474); - avl = gpr_avl_add(avl, box(228), box(1186), NULL); - avl = gpr_avl_add(avl, box(484), box(1187), NULL); + avl = gpr_avl_add(avl, box(228), box(1186), nullptr); + avl = gpr_avl_add(avl, box(484), box(1187), nullptr); avl = remove_int(avl, 238); avl = remove_int(avl, 53); avl = remove_int(avl, 691); - avl = gpr_avl_add(avl, box(345), box(1191), NULL); + avl = gpr_avl_add(avl, box(345), box(1191), nullptr); avl = remove_int(avl, 0); - avl = gpr_avl_add(avl, box(230), box(1193), NULL); + avl = gpr_avl_add(avl, box(230), box(1193), nullptr); avl = remove_int(avl, 227); avl = remove_int(avl, 152); - avl = gpr_avl_add(avl, box(884), box(1196), NULL); + avl = gpr_avl_add(avl, box(884), box(1196), nullptr); avl = remove_int(avl, 823); avl = remove_int(avl, 53); - avl = gpr_avl_add(avl, box(1015), box(1199), NULL); - avl = gpr_avl_add(avl, box(697), box(1200), NULL); - avl = gpr_avl_add(avl, box(376), box(1201), NULL); + avl = gpr_avl_add(avl, box(1015), box(1199), nullptr); + avl = gpr_avl_add(avl, box(697), box(1200), nullptr); + avl = gpr_avl_add(avl, box(376), box(1201), nullptr); avl = remove_int(avl, 411); - avl = gpr_avl_add(avl, box(888), box(1203), NULL); + avl = gpr_avl_add(avl, box(888), box(1203), nullptr); avl = remove_int(avl, 55); - avl = gpr_avl_add(avl, box(85), box(1205), NULL); + avl = gpr_avl_add(avl, box(85), box(1205), nullptr); avl = remove_int(avl, 947); avl = remove_int(avl, 382); avl = remove_int(avl, 777); - avl = gpr_avl_add(avl, box(1017), box(1209), NULL); - avl = gpr_avl_add(avl, box(169), box(1210), NULL); - avl = gpr_avl_add(avl, box(156), box(1211), NULL); + avl = gpr_avl_add(avl, box(1017), box(1209), nullptr); + avl = gpr_avl_add(avl, box(169), box(1210), nullptr); + avl = gpr_avl_add(avl, box(156), box(1211), nullptr); avl = remove_int(avl, 153); avl = remove_int(avl, 642); avl = remove_int(avl, 158); - avl = gpr_avl_add(avl, box(554), box(1215), NULL); - avl = gpr_avl_add(avl, box(76), box(1216), NULL); - avl = gpr_avl_add(avl, box(756), box(1217), NULL); + avl = gpr_avl_add(avl, box(554), box(1215), nullptr); + avl = gpr_avl_add(avl, box(76), box(1216), nullptr); + avl = gpr_avl_add(avl, box(756), box(1217), nullptr); avl = remove_int(avl, 767); avl = remove_int(avl, 112); avl = remove_int(avl, 539); @@ -2364,37 +2364,37 @@ static void test_badcase3(void) { avl = remove_int(avl, 385); avl = remove_int(avl, 514); avl = remove_int(avl, 362); - avl = gpr_avl_add(avl, box(523), box(1226), NULL); - avl = gpr_avl_add(avl, box(712), box(1227), NULL); - avl = gpr_avl_add(avl, box(474), box(1228), NULL); - avl = gpr_avl_add(avl, box(882), box(1229), NULL); - avl = gpr_avl_add(avl, box(965), box(1230), NULL); + avl = gpr_avl_add(avl, box(523), box(1226), nullptr); + avl = gpr_avl_add(avl, box(712), box(1227), nullptr); + avl = gpr_avl_add(avl, box(474), box(1228), nullptr); + avl = gpr_avl_add(avl, box(882), box(1229), nullptr); + avl = gpr_avl_add(avl, box(965), box(1230), nullptr); avl = remove_int(avl, 464); - avl = gpr_avl_add(avl, box(319), box(1232), NULL); - avl = gpr_avl_add(avl, box(504), box(1233), NULL); + avl = gpr_avl_add(avl, box(319), box(1232), nullptr); + avl = gpr_avl_add(avl, box(504), box(1233), nullptr); avl = remove_int(avl, 818); - avl = gpr_avl_add(avl, box(884), box(1235), NULL); - avl = gpr_avl_add(avl, box(813), box(1236), NULL); - avl = gpr_avl_add(avl, box(795), box(1237), NULL); + avl = gpr_avl_add(avl, box(884), box(1235), nullptr); + avl = gpr_avl_add(avl, box(813), box(1236), nullptr); + avl = gpr_avl_add(avl, box(795), box(1237), nullptr); avl = remove_int(avl, 306); - avl = gpr_avl_add(avl, box(799), box(1239), NULL); + avl = gpr_avl_add(avl, box(799), box(1239), nullptr); avl = remove_int(avl, 534); - avl = gpr_avl_add(avl, box(480), box(1241), NULL); - avl = gpr_avl_add(avl, box(656), box(1242), NULL); - avl = gpr_avl_add(avl, box(709), box(1243), NULL); - avl = gpr_avl_add(avl, box(500), box(1244), NULL); + avl = gpr_avl_add(avl, box(480), box(1241), nullptr); + avl = gpr_avl_add(avl, box(656), box(1242), nullptr); + avl = gpr_avl_add(avl, box(709), box(1243), nullptr); + avl = gpr_avl_add(avl, box(500), box(1244), nullptr); avl = remove_int(avl, 740); - avl = gpr_avl_add(avl, box(980), box(1246), NULL); - avl = gpr_avl_add(avl, box(458), box(1247), NULL); + avl = gpr_avl_add(avl, box(980), box(1246), nullptr); + avl = gpr_avl_add(avl, box(458), box(1247), nullptr); avl = remove_int(avl, 377); avl = remove_int(avl, 338); - avl = gpr_avl_add(avl, box(554), box(1250), NULL); - avl = gpr_avl_add(avl, box(504), box(1251), NULL); - avl = gpr_avl_add(avl, box(603), box(1252), NULL); - avl = gpr_avl_add(avl, box(761), box(1253), NULL); + avl = gpr_avl_add(avl, box(554), box(1250), nullptr); + avl = gpr_avl_add(avl, box(504), box(1251), nullptr); + avl = gpr_avl_add(avl, box(603), box(1252), nullptr); + avl = gpr_avl_add(avl, box(761), box(1253), nullptr); avl = remove_int(avl, 431); - avl = gpr_avl_add(avl, box(707), box(1255), NULL); - avl = gpr_avl_add(avl, box(673), box(1256), NULL); + avl = gpr_avl_add(avl, box(707), box(1255), nullptr); + avl = gpr_avl_add(avl, box(673), box(1256), nullptr); avl = remove_int(avl, 998); avl = remove_int(avl, 332); avl = remove_int(avl, 413); @@ -2402,448 +2402,448 @@ static void test_badcase3(void) { avl = remove_int(avl, 249); avl = remove_int(avl, 309); avl = remove_int(avl, 459); - avl = gpr_avl_add(avl, box(645), box(1264), NULL); + avl = gpr_avl_add(avl, box(645), box(1264), nullptr); avl = remove_int(avl, 858); avl = remove_int(avl, 997); - avl = gpr_avl_add(avl, box(519), box(1267), NULL); + avl = gpr_avl_add(avl, box(519), box(1267), nullptr); avl = remove_int(avl, 614); avl = remove_int(avl, 462); avl = remove_int(avl, 792); - avl = gpr_avl_add(avl, box(987), box(1271), NULL); - avl = gpr_avl_add(avl, box(309), box(1272), NULL); + avl = gpr_avl_add(avl, box(987), box(1271), nullptr); + avl = gpr_avl_add(avl, box(309), box(1272), nullptr); avl = remove_int(avl, 747); - avl = gpr_avl_add(avl, box(621), box(1274), NULL); - avl = gpr_avl_add(avl, box(450), box(1275), NULL); + avl = gpr_avl_add(avl, box(621), box(1274), nullptr); + avl = gpr_avl_add(avl, box(450), box(1275), nullptr); avl = remove_int(avl, 265); avl = remove_int(avl, 8); avl = remove_int(avl, 383); - avl = gpr_avl_add(avl, box(238), box(1279), NULL); + avl = gpr_avl_add(avl, box(238), box(1279), nullptr); avl = remove_int(avl, 241); - avl = gpr_avl_add(avl, box(180), box(1281), NULL); - avl = gpr_avl_add(avl, box(411), box(1282), NULL); - avl = gpr_avl_add(avl, box(791), box(1283), NULL); - avl = gpr_avl_add(avl, box(955), box(1284), NULL); + avl = gpr_avl_add(avl, box(180), box(1281), nullptr); + avl = gpr_avl_add(avl, box(411), box(1282), nullptr); + avl = gpr_avl_add(avl, box(791), box(1283), nullptr); + avl = gpr_avl_add(avl, box(955), box(1284), nullptr); avl = remove_int(avl, 24); avl = remove_int(avl, 375); - avl = gpr_avl_add(avl, box(140), box(1287), NULL); + avl = gpr_avl_add(avl, box(140), box(1287), nullptr); avl = remove_int(avl, 949); - avl = gpr_avl_add(avl, box(301), box(1289), NULL); - avl = gpr_avl_add(avl, box(0), box(1290), NULL); + avl = gpr_avl_add(avl, box(301), box(1289), nullptr); + avl = gpr_avl_add(avl, box(0), box(1290), nullptr); avl = remove_int(avl, 371); avl = remove_int(avl, 427); avl = remove_int(avl, 841); avl = remove_int(avl, 847); - avl = gpr_avl_add(avl, box(814), box(1295), NULL); - avl = gpr_avl_add(avl, box(127), box(1296), NULL); - avl = gpr_avl_add(avl, box(279), box(1297), NULL); + avl = gpr_avl_add(avl, box(814), box(1295), nullptr); + avl = gpr_avl_add(avl, box(127), box(1296), nullptr); + avl = gpr_avl_add(avl, box(279), box(1297), nullptr); avl = remove_int(avl, 669); avl = remove_int(avl, 541); avl = remove_int(avl, 275); avl = remove_int(avl, 299); avl = remove_int(avl, 552); - avl = gpr_avl_add(avl, box(310), box(1303), NULL); - avl = gpr_avl_add(avl, box(304), box(1304), NULL); - avl = gpr_avl_add(avl, box(1), box(1305), NULL); - avl = gpr_avl_add(avl, box(339), box(1306), NULL); + avl = gpr_avl_add(avl, box(310), box(1303), nullptr); + avl = gpr_avl_add(avl, box(304), box(1304), nullptr); + avl = gpr_avl_add(avl, box(1), box(1305), nullptr); + avl = gpr_avl_add(avl, box(339), box(1306), nullptr); avl = remove_int(avl, 570); avl = remove_int(avl, 752); avl = remove_int(avl, 552); avl = remove_int(avl, 442); avl = remove_int(avl, 639); - avl = gpr_avl_add(avl, box(313), box(1312), NULL); + avl = gpr_avl_add(avl, box(313), box(1312), nullptr); avl = remove_int(avl, 85); - avl = gpr_avl_add(avl, box(964), box(1314), NULL); - avl = gpr_avl_add(avl, box(559), box(1315), NULL); + avl = gpr_avl_add(avl, box(964), box(1314), nullptr); + avl = gpr_avl_add(avl, box(559), box(1315), nullptr); avl = remove_int(avl, 167); - avl = gpr_avl_add(avl, box(866), box(1317), NULL); + avl = gpr_avl_add(avl, box(866), box(1317), nullptr); avl = remove_int(avl, 275); - avl = gpr_avl_add(avl, box(173), box(1319), NULL); - avl = gpr_avl_add(avl, box(765), box(1320), NULL); + avl = gpr_avl_add(avl, box(173), box(1319), nullptr); + avl = gpr_avl_add(avl, box(765), box(1320), nullptr); avl = remove_int(avl, 883); - avl = gpr_avl_add(avl, box(547), box(1322), NULL); - avl = gpr_avl_add(avl, box(847), box(1323), NULL); + avl = gpr_avl_add(avl, box(547), box(1322), nullptr); + avl = gpr_avl_add(avl, box(847), box(1323), nullptr); avl = remove_int(avl, 817); avl = remove_int(avl, 850); avl = remove_int(avl, 718); - avl = gpr_avl_add(avl, box(806), box(1327), NULL); - avl = gpr_avl_add(avl, box(360), box(1328), NULL); + avl = gpr_avl_add(avl, box(806), box(1327), nullptr); + avl = gpr_avl_add(avl, box(360), box(1328), nullptr); avl = remove_int(avl, 991); - avl = gpr_avl_add(avl, box(493), box(1330), NULL); + avl = gpr_avl_add(avl, box(493), box(1330), nullptr); avl = remove_int(avl, 516); - avl = gpr_avl_add(avl, box(361), box(1332), NULL); + avl = gpr_avl_add(avl, box(361), box(1332), nullptr); avl = remove_int(avl, 355); - avl = gpr_avl_add(avl, box(512), box(1334), NULL); - avl = gpr_avl_add(avl, box(191), box(1335), NULL); + avl = gpr_avl_add(avl, box(512), box(1334), nullptr); + avl = gpr_avl_add(avl, box(191), box(1335), nullptr); avl = remove_int(avl, 703); - avl = gpr_avl_add(avl, box(333), box(1337), NULL); + avl = gpr_avl_add(avl, box(333), box(1337), nullptr); avl = remove_int(avl, 481); - avl = gpr_avl_add(avl, box(501), box(1339), NULL); + avl = gpr_avl_add(avl, box(501), box(1339), nullptr); avl = remove_int(avl, 532); avl = remove_int(avl, 510); - avl = gpr_avl_add(avl, box(793), box(1342), NULL); - avl = gpr_avl_add(avl, box(234), box(1343), NULL); + avl = gpr_avl_add(avl, box(793), box(1342), nullptr); + avl = gpr_avl_add(avl, box(234), box(1343), nullptr); avl = remove_int(avl, 159); avl = remove_int(avl, 429); avl = remove_int(avl, 728); avl = remove_int(avl, 288); - avl = gpr_avl_add(avl, box(281), box(1348), NULL); - avl = gpr_avl_add(avl, box(702), box(1349), NULL); - avl = gpr_avl_add(avl, box(149), box(1350), NULL); + avl = gpr_avl_add(avl, box(281), box(1348), nullptr); + avl = gpr_avl_add(avl, box(702), box(1349), nullptr); + avl = gpr_avl_add(avl, box(149), box(1350), nullptr); avl = remove_int(avl, 22); avl = remove_int(avl, 944); avl = remove_int(avl, 55); avl = remove_int(avl, 512); avl = remove_int(avl, 676); avl = remove_int(avl, 884); - avl = gpr_avl_add(avl, box(246), box(1357), NULL); - avl = gpr_avl_add(avl, box(455), box(1358), NULL); + avl = gpr_avl_add(avl, box(246), box(1357), nullptr); + avl = gpr_avl_add(avl, box(455), box(1358), nullptr); avl = remove_int(avl, 782); avl = remove_int(avl, 682); - avl = gpr_avl_add(avl, box(243), box(1361), NULL); - avl = gpr_avl_add(avl, box(109), box(1362), NULL); - avl = gpr_avl_add(avl, box(452), box(1363), NULL); + avl = gpr_avl_add(avl, box(243), box(1361), nullptr); + avl = gpr_avl_add(avl, box(109), box(1362), nullptr); + avl = gpr_avl_add(avl, box(452), box(1363), nullptr); avl = remove_int(avl, 151); - avl = gpr_avl_add(avl, box(159), box(1365), NULL); + avl = gpr_avl_add(avl, box(159), box(1365), nullptr); avl = remove_int(avl, 1023); - avl = gpr_avl_add(avl, box(129), box(1367), NULL); - avl = gpr_avl_add(avl, box(537), box(1368), NULL); + avl = gpr_avl_add(avl, box(129), box(1367), nullptr); + avl = gpr_avl_add(avl, box(537), box(1368), nullptr); avl = remove_int(avl, 321); - avl = gpr_avl_add(avl, box(740), box(1370), NULL); + avl = gpr_avl_add(avl, box(740), box(1370), nullptr); avl = remove_int(avl, 45); avl = remove_int(avl, 136); - avl = gpr_avl_add(avl, box(229), box(1373), NULL); + avl = gpr_avl_add(avl, box(229), box(1373), nullptr); avl = remove_int(avl, 772); - avl = gpr_avl_add(avl, box(181), box(1375), NULL); + avl = gpr_avl_add(avl, box(181), box(1375), nullptr); avl = remove_int(avl, 175); - avl = gpr_avl_add(avl, box(817), box(1377), NULL); + avl = gpr_avl_add(avl, box(817), box(1377), nullptr); avl = remove_int(avl, 956); - avl = gpr_avl_add(avl, box(675), box(1379), NULL); - avl = gpr_avl_add(avl, box(375), box(1380), NULL); + avl = gpr_avl_add(avl, box(675), box(1379), nullptr); + avl = gpr_avl_add(avl, box(375), box(1380), nullptr); avl = remove_int(avl, 384); - avl = gpr_avl_add(avl, box(1016), box(1382), NULL); + avl = gpr_avl_add(avl, box(1016), box(1382), nullptr); avl = remove_int(avl, 295); avl = remove_int(avl, 697); avl = remove_int(avl, 554); avl = remove_int(avl, 590); avl = remove_int(avl, 1014); - avl = gpr_avl_add(avl, box(890), box(1388), NULL); - avl = gpr_avl_add(avl, box(293), box(1389), NULL); + avl = gpr_avl_add(avl, box(890), box(1388), nullptr); + avl = gpr_avl_add(avl, box(293), box(1389), nullptr); avl = remove_int(avl, 207); avl = remove_int(avl, 46); - avl = gpr_avl_add(avl, box(899), box(1392), NULL); - avl = gpr_avl_add(avl, box(666), box(1393), NULL); - avl = gpr_avl_add(avl, box(85), box(1394), NULL); - avl = gpr_avl_add(avl, box(914), box(1395), NULL); - avl = gpr_avl_add(avl, box(128), box(1396), NULL); - avl = gpr_avl_add(avl, box(835), box(1397), NULL); - avl = gpr_avl_add(avl, box(787), box(1398), NULL); - avl = gpr_avl_add(avl, box(649), box(1399), NULL); - avl = gpr_avl_add(avl, box(723), box(1400), NULL); + avl = gpr_avl_add(avl, box(899), box(1392), nullptr); + avl = gpr_avl_add(avl, box(666), box(1393), nullptr); + avl = gpr_avl_add(avl, box(85), box(1394), nullptr); + avl = gpr_avl_add(avl, box(914), box(1395), nullptr); + avl = gpr_avl_add(avl, box(128), box(1396), nullptr); + avl = gpr_avl_add(avl, box(835), box(1397), nullptr); + avl = gpr_avl_add(avl, box(787), box(1398), nullptr); + avl = gpr_avl_add(avl, box(649), box(1399), nullptr); + avl = gpr_avl_add(avl, box(723), box(1400), nullptr); avl = remove_int(avl, 874); - avl = gpr_avl_add(avl, box(778), box(1402), NULL); - avl = gpr_avl_add(avl, box(1015), box(1403), NULL); - avl = gpr_avl_add(avl, box(59), box(1404), NULL); - avl = gpr_avl_add(avl, box(259), box(1405), NULL); - avl = gpr_avl_add(avl, box(758), box(1406), NULL); + avl = gpr_avl_add(avl, box(778), box(1402), nullptr); + avl = gpr_avl_add(avl, box(1015), box(1403), nullptr); + avl = gpr_avl_add(avl, box(59), box(1404), nullptr); + avl = gpr_avl_add(avl, box(259), box(1405), nullptr); + avl = gpr_avl_add(avl, box(758), box(1406), nullptr); avl = remove_int(avl, 648); - avl = gpr_avl_add(avl, box(145), box(1408), NULL); - avl = gpr_avl_add(avl, box(440), box(1409), NULL); + avl = gpr_avl_add(avl, box(145), box(1408), nullptr); + avl = gpr_avl_add(avl, box(440), box(1409), nullptr); avl = remove_int(avl, 608); avl = remove_int(avl, 690); - avl = gpr_avl_add(avl, box(605), box(1412), NULL); + avl = gpr_avl_add(avl, box(605), box(1412), nullptr); avl = remove_int(avl, 856); avl = remove_int(avl, 608); - avl = gpr_avl_add(avl, box(829), box(1415), NULL); - avl = gpr_avl_add(avl, box(660), box(1416), NULL); + avl = gpr_avl_add(avl, box(829), box(1415), nullptr); + avl = gpr_avl_add(avl, box(660), box(1416), nullptr); avl = remove_int(avl, 596); - avl = gpr_avl_add(avl, box(519), box(1418), NULL); - avl = gpr_avl_add(avl, box(35), box(1419), NULL); - avl = gpr_avl_add(avl, box(871), box(1420), NULL); + avl = gpr_avl_add(avl, box(519), box(1418), nullptr); + avl = gpr_avl_add(avl, box(35), box(1419), nullptr); + avl = gpr_avl_add(avl, box(871), box(1420), nullptr); avl = remove_int(avl, 845); - avl = gpr_avl_add(avl, box(600), box(1422), NULL); - avl = gpr_avl_add(avl, box(215), box(1423), NULL); + avl = gpr_avl_add(avl, box(600), box(1422), nullptr); + avl = gpr_avl_add(avl, box(215), box(1423), nullptr); avl = remove_int(avl, 761); - avl = gpr_avl_add(avl, box(975), box(1425), NULL); + avl = gpr_avl_add(avl, box(975), box(1425), nullptr); avl = remove_int(avl, 987); - avl = gpr_avl_add(avl, box(58), box(1427), NULL); + avl = gpr_avl_add(avl, box(58), box(1427), nullptr); avl = remove_int(avl, 119); - avl = gpr_avl_add(avl, box(937), box(1429), NULL); - avl = gpr_avl_add(avl, box(372), box(1430), NULL); - avl = gpr_avl_add(avl, box(11), box(1431), NULL); - avl = gpr_avl_add(avl, box(398), box(1432), NULL); - avl = gpr_avl_add(avl, box(423), box(1433), NULL); + avl = gpr_avl_add(avl, box(937), box(1429), nullptr); + avl = gpr_avl_add(avl, box(372), box(1430), nullptr); + avl = gpr_avl_add(avl, box(11), box(1431), nullptr); + avl = gpr_avl_add(avl, box(398), box(1432), nullptr); + avl = gpr_avl_add(avl, box(423), box(1433), nullptr); avl = remove_int(avl, 171); - avl = gpr_avl_add(avl, box(473), box(1435), NULL); + avl = gpr_avl_add(avl, box(473), box(1435), nullptr); avl = remove_int(avl, 752); avl = remove_int(avl, 625); avl = remove_int(avl, 764); avl = remove_int(avl, 49); - avl = gpr_avl_add(avl, box(472), box(1440), NULL); + avl = gpr_avl_add(avl, box(472), box(1440), nullptr); avl = remove_int(avl, 847); avl = remove_int(avl, 642); avl = remove_int(avl, 1004); avl = remove_int(avl, 795); avl = remove_int(avl, 465); - avl = gpr_avl_add(avl, box(636), box(1446), NULL); + avl = gpr_avl_add(avl, box(636), box(1446), nullptr); avl = remove_int(avl, 152); - avl = gpr_avl_add(avl, box(61), box(1448), NULL); + avl = gpr_avl_add(avl, box(61), box(1448), nullptr); avl = remove_int(avl, 929); avl = remove_int(avl, 9); - avl = gpr_avl_add(avl, box(251), box(1451), NULL); - avl = gpr_avl_add(avl, box(672), box(1452), NULL); - avl = gpr_avl_add(avl, box(66), box(1453), NULL); + avl = gpr_avl_add(avl, box(251), box(1451), nullptr); + avl = gpr_avl_add(avl, box(672), box(1452), nullptr); + avl = gpr_avl_add(avl, box(66), box(1453), nullptr); avl = remove_int(avl, 693); avl = remove_int(avl, 914); avl = remove_int(avl, 116); avl = remove_int(avl, 577); - avl = gpr_avl_add(avl, box(618), box(1458), NULL); - avl = gpr_avl_add(avl, box(495), box(1459), NULL); + avl = gpr_avl_add(avl, box(618), box(1458), nullptr); + avl = gpr_avl_add(avl, box(495), box(1459), nullptr); avl = remove_int(avl, 450); - avl = gpr_avl_add(avl, box(533), box(1461), NULL); - avl = gpr_avl_add(avl, box(414), box(1462), NULL); + avl = gpr_avl_add(avl, box(533), box(1461), nullptr); + avl = gpr_avl_add(avl, box(414), box(1462), nullptr); avl = remove_int(avl, 74); avl = remove_int(avl, 236); - avl = gpr_avl_add(avl, box(707), box(1465), NULL); - avl = gpr_avl_add(avl, box(357), box(1466), NULL); - avl = gpr_avl_add(avl, box(1007), box(1467), NULL); - avl = gpr_avl_add(avl, box(811), box(1468), NULL); - avl = gpr_avl_add(avl, box(418), box(1469), NULL); - avl = gpr_avl_add(avl, box(164), box(1470), NULL); - avl = gpr_avl_add(avl, box(622), box(1471), NULL); + avl = gpr_avl_add(avl, box(707), box(1465), nullptr); + avl = gpr_avl_add(avl, box(357), box(1466), nullptr); + avl = gpr_avl_add(avl, box(1007), box(1467), nullptr); + avl = gpr_avl_add(avl, box(811), box(1468), nullptr); + avl = gpr_avl_add(avl, box(418), box(1469), nullptr); + avl = gpr_avl_add(avl, box(164), box(1470), nullptr); + avl = gpr_avl_add(avl, box(622), box(1471), nullptr); avl = remove_int(avl, 22); avl = remove_int(avl, 14); avl = remove_int(avl, 732); avl = remove_int(avl, 7); avl = remove_int(avl, 447); - avl = gpr_avl_add(avl, box(221), box(1477), NULL); - avl = gpr_avl_add(avl, box(202), box(1478), NULL); - avl = gpr_avl_add(avl, box(312), box(1479), NULL); + avl = gpr_avl_add(avl, box(221), box(1477), nullptr); + avl = gpr_avl_add(avl, box(202), box(1478), nullptr); + avl = gpr_avl_add(avl, box(312), box(1479), nullptr); avl = remove_int(avl, 274); - avl = gpr_avl_add(avl, box(684), box(1481), NULL); - avl = gpr_avl_add(avl, box(954), box(1482), NULL); - avl = gpr_avl_add(avl, box(637), box(1483), NULL); + avl = gpr_avl_add(avl, box(684), box(1481), nullptr); + avl = gpr_avl_add(avl, box(954), box(1482), nullptr); + avl = gpr_avl_add(avl, box(637), box(1483), nullptr); avl = remove_int(avl, 716); - avl = gpr_avl_add(avl, box(198), box(1485), NULL); + avl = gpr_avl_add(avl, box(198), box(1485), nullptr); avl = remove_int(avl, 340); avl = remove_int(avl, 137); avl = remove_int(avl, 995); avl = remove_int(avl, 1004); - avl = gpr_avl_add(avl, box(661), box(1490), NULL); - avl = gpr_avl_add(avl, box(862), box(1491), NULL); + avl = gpr_avl_add(avl, box(661), box(1490), nullptr); + avl = gpr_avl_add(avl, box(862), box(1491), nullptr); avl = remove_int(avl, 527); - avl = gpr_avl_add(avl, box(945), box(1493), NULL); + avl = gpr_avl_add(avl, box(945), box(1493), nullptr); avl = remove_int(avl, 355); avl = remove_int(avl, 144); - avl = gpr_avl_add(avl, box(229), box(1496), NULL); - avl = gpr_avl_add(avl, box(237), box(1497), NULL); + avl = gpr_avl_add(avl, box(229), box(1496), nullptr); + avl = gpr_avl_add(avl, box(237), box(1497), nullptr); avl = remove_int(avl, 471); avl = remove_int(avl, 901); - avl = gpr_avl_add(avl, box(905), box(1500), NULL); + avl = gpr_avl_add(avl, box(905), box(1500), nullptr); avl = remove_int(avl, 19); avl = remove_int(avl, 896); avl = remove_int(avl, 585); avl = remove_int(avl, 308); - avl = gpr_avl_add(avl, box(547), box(1505), NULL); - avl = gpr_avl_add(avl, box(552), box(1506), NULL); - avl = gpr_avl_add(avl, box(30), box(1507), NULL); - avl = gpr_avl_add(avl, box(445), box(1508), NULL); + avl = gpr_avl_add(avl, box(547), box(1505), nullptr); + avl = gpr_avl_add(avl, box(552), box(1506), nullptr); + avl = gpr_avl_add(avl, box(30), box(1507), nullptr); + avl = gpr_avl_add(avl, box(445), box(1508), nullptr); avl = remove_int(avl, 785); avl = remove_int(avl, 185); - avl = gpr_avl_add(avl, box(405), box(1511), NULL); - avl = gpr_avl_add(avl, box(733), box(1512), NULL); - avl = gpr_avl_add(avl, box(573), box(1513), NULL); - avl = gpr_avl_add(avl, box(492), box(1514), NULL); - avl = gpr_avl_add(avl, box(343), box(1515), NULL); - avl = gpr_avl_add(avl, box(527), box(1516), NULL); - avl = gpr_avl_add(avl, box(596), box(1517), NULL); - avl = gpr_avl_add(avl, box(519), box(1518), NULL); + avl = gpr_avl_add(avl, box(405), box(1511), nullptr); + avl = gpr_avl_add(avl, box(733), box(1512), nullptr); + avl = gpr_avl_add(avl, box(573), box(1513), nullptr); + avl = gpr_avl_add(avl, box(492), box(1514), nullptr); + avl = gpr_avl_add(avl, box(343), box(1515), nullptr); + avl = gpr_avl_add(avl, box(527), box(1516), nullptr); + avl = gpr_avl_add(avl, box(596), box(1517), nullptr); + avl = gpr_avl_add(avl, box(519), box(1518), nullptr); avl = remove_int(avl, 243); avl = remove_int(avl, 722); - avl = gpr_avl_add(avl, box(772), box(1521), NULL); + avl = gpr_avl_add(avl, box(772), box(1521), nullptr); avl = remove_int(avl, 152); avl = remove_int(avl, 305); - avl = gpr_avl_add(avl, box(754), box(1524), NULL); - avl = gpr_avl_add(avl, box(373), box(1525), NULL); + avl = gpr_avl_add(avl, box(754), box(1524), nullptr); + avl = gpr_avl_add(avl, box(373), box(1525), nullptr); avl = remove_int(avl, 995); - avl = gpr_avl_add(avl, box(329), box(1527), NULL); + avl = gpr_avl_add(avl, box(329), box(1527), nullptr); avl = remove_int(avl, 397); - avl = gpr_avl_add(avl, box(884), box(1529), NULL); + avl = gpr_avl_add(avl, box(884), box(1529), nullptr); avl = remove_int(avl, 329); avl = remove_int(avl, 240); - avl = gpr_avl_add(avl, box(566), box(1532), NULL); - avl = gpr_avl_add(avl, box(232), box(1533), NULL); + avl = gpr_avl_add(avl, box(566), box(1532), nullptr); + avl = gpr_avl_add(avl, box(232), box(1533), nullptr); avl = remove_int(avl, 993); - avl = gpr_avl_add(avl, box(888), box(1535), NULL); + avl = gpr_avl_add(avl, box(888), box(1535), nullptr); avl = remove_int(avl, 242); - avl = gpr_avl_add(avl, box(941), box(1537), NULL); + avl = gpr_avl_add(avl, box(941), box(1537), nullptr); avl = remove_int(avl, 415); - avl = gpr_avl_add(avl, box(992), box(1539), NULL); + avl = gpr_avl_add(avl, box(992), box(1539), nullptr); avl = remove_int(avl, 289); - avl = gpr_avl_add(avl, box(60), box(1541), NULL); - avl = gpr_avl_add(avl, box(97), box(1542), NULL); + avl = gpr_avl_add(avl, box(60), box(1541), nullptr); + avl = gpr_avl_add(avl, box(97), box(1542), nullptr); avl = remove_int(avl, 965); avl = remove_int(avl, 267); avl = remove_int(avl, 360); - avl = gpr_avl_add(avl, box(5), box(1546), NULL); + avl = gpr_avl_add(avl, box(5), box(1546), nullptr); avl = remove_int(avl, 429); - avl = gpr_avl_add(avl, box(412), box(1548), NULL); + avl = gpr_avl_add(avl, box(412), box(1548), nullptr); avl = remove_int(avl, 632); avl = remove_int(avl, 113); - avl = gpr_avl_add(avl, box(48), box(1551), NULL); - avl = gpr_avl_add(avl, box(108), box(1552), NULL); - avl = gpr_avl_add(avl, box(750), box(1553), NULL); + avl = gpr_avl_add(avl, box(48), box(1551), nullptr); + avl = gpr_avl_add(avl, box(108), box(1552), nullptr); + avl = gpr_avl_add(avl, box(750), box(1553), nullptr); avl = remove_int(avl, 188); - avl = gpr_avl_add(avl, box(668), box(1555), NULL); + avl = gpr_avl_add(avl, box(668), box(1555), nullptr); avl = remove_int(avl, 37); avl = remove_int(avl, 737); - avl = gpr_avl_add(avl, box(93), box(1558), NULL); - avl = gpr_avl_add(avl, box(628), box(1559), NULL); - avl = gpr_avl_add(avl, box(480), box(1560), NULL); + avl = gpr_avl_add(avl, box(93), box(1558), nullptr); + avl = gpr_avl_add(avl, box(628), box(1559), nullptr); + avl = gpr_avl_add(avl, box(480), box(1560), nullptr); avl = remove_int(avl, 958); avl = remove_int(avl, 565); avl = remove_int(avl, 32); avl = remove_int(avl, 1); avl = remove_int(avl, 335); - avl = gpr_avl_add(avl, box(136), box(1566), NULL); - avl = gpr_avl_add(avl, box(469), box(1567), NULL); + avl = gpr_avl_add(avl, box(136), box(1566), nullptr); + avl = gpr_avl_add(avl, box(469), box(1567), nullptr); avl = remove_int(avl, 349); - avl = gpr_avl_add(avl, box(768), box(1569), NULL); - avl = gpr_avl_add(avl, box(915), box(1570), NULL); + avl = gpr_avl_add(avl, box(768), box(1569), nullptr); + avl = gpr_avl_add(avl, box(915), box(1570), nullptr); avl = remove_int(avl, 1014); - avl = gpr_avl_add(avl, box(117), box(1572), NULL); + avl = gpr_avl_add(avl, box(117), box(1572), nullptr); avl = remove_int(avl, 62); - avl = gpr_avl_add(avl, box(382), box(1574), NULL); + avl = gpr_avl_add(avl, box(382), box(1574), nullptr); avl = remove_int(avl, 571); - avl = gpr_avl_add(avl, box(655), box(1576), NULL); - avl = gpr_avl_add(avl, box(323), box(1577), NULL); + avl = gpr_avl_add(avl, box(655), box(1576), nullptr); + avl = gpr_avl_add(avl, box(323), box(1577), nullptr); avl = remove_int(avl, 869); avl = remove_int(avl, 151); - avl = gpr_avl_add(avl, box(1019), box(1580), NULL); - avl = gpr_avl_add(avl, box(984), box(1581), NULL); - avl = gpr_avl_add(avl, box(870), box(1582), NULL); - avl = gpr_avl_add(avl, box(376), box(1583), NULL); + avl = gpr_avl_add(avl, box(1019), box(1580), nullptr); + avl = gpr_avl_add(avl, box(984), box(1581), nullptr); + avl = gpr_avl_add(avl, box(870), box(1582), nullptr); + avl = gpr_avl_add(avl, box(376), box(1583), nullptr); avl = remove_int(avl, 625); - avl = gpr_avl_add(avl, box(733), box(1585), NULL); + avl = gpr_avl_add(avl, box(733), box(1585), nullptr); avl = remove_int(avl, 532); avl = remove_int(avl, 444); - avl = gpr_avl_add(avl, box(428), box(1588), NULL); - avl = gpr_avl_add(avl, box(860), box(1589), NULL); - avl = gpr_avl_add(avl, box(173), box(1590), NULL); + avl = gpr_avl_add(avl, box(428), box(1588), nullptr); + avl = gpr_avl_add(avl, box(860), box(1589), nullptr); + avl = gpr_avl_add(avl, box(173), box(1590), nullptr); avl = remove_int(avl, 649); avl = remove_int(avl, 913); avl = remove_int(avl, 1); avl = remove_int(avl, 304); - avl = gpr_avl_add(avl, box(604), box(1595), NULL); - avl = gpr_avl_add(avl, box(639), box(1596), NULL); + avl = gpr_avl_add(avl, box(604), box(1595), nullptr); + avl = gpr_avl_add(avl, box(639), box(1596), nullptr); avl = remove_int(avl, 431); - avl = gpr_avl_add(avl, box(993), box(1598), NULL); + avl = gpr_avl_add(avl, box(993), box(1598), nullptr); avl = remove_int(avl, 681); avl = remove_int(avl, 927); - avl = gpr_avl_add(avl, box(87), box(1601), NULL); - avl = gpr_avl_add(avl, box(91), box(1602), NULL); + avl = gpr_avl_add(avl, box(87), box(1601), nullptr); + avl = gpr_avl_add(avl, box(91), box(1602), nullptr); avl = remove_int(avl, 61); avl = remove_int(avl, 14); avl = remove_int(avl, 305); avl = remove_int(avl, 304); avl = remove_int(avl, 1016); - avl = gpr_avl_add(avl, box(903), box(1608), NULL); - avl = gpr_avl_add(avl, box(951), box(1609), NULL); - avl = gpr_avl_add(avl, box(146), box(1610), NULL); - avl = gpr_avl_add(avl, box(482), box(1611), NULL); - avl = gpr_avl_add(avl, box(71), box(1612), NULL); + avl = gpr_avl_add(avl, box(903), box(1608), nullptr); + avl = gpr_avl_add(avl, box(951), box(1609), nullptr); + avl = gpr_avl_add(avl, box(146), box(1610), nullptr); + avl = gpr_avl_add(avl, box(482), box(1611), nullptr); + avl = gpr_avl_add(avl, box(71), box(1612), nullptr); avl = remove_int(avl, 246); avl = remove_int(avl, 696); - avl = gpr_avl_add(avl, box(636), box(1615), NULL); - avl = gpr_avl_add(avl, box(295), box(1616), NULL); + avl = gpr_avl_add(avl, box(636), box(1615), nullptr); + avl = gpr_avl_add(avl, box(295), box(1616), nullptr); avl = remove_int(avl, 11); avl = remove_int(avl, 231); - avl = gpr_avl_add(avl, box(905), box(1619), NULL); - avl = gpr_avl_add(avl, box(993), box(1620), NULL); - avl = gpr_avl_add(avl, box(433), box(1621), NULL); - avl = gpr_avl_add(avl, box(117), box(1622), NULL); - avl = gpr_avl_add(avl, box(467), box(1623), NULL); + avl = gpr_avl_add(avl, box(905), box(1619), nullptr); + avl = gpr_avl_add(avl, box(993), box(1620), nullptr); + avl = gpr_avl_add(avl, box(433), box(1621), nullptr); + avl = gpr_avl_add(avl, box(117), box(1622), nullptr); + avl = gpr_avl_add(avl, box(467), box(1623), nullptr); avl = remove_int(avl, 419); - avl = gpr_avl_add(avl, box(179), box(1625), NULL); + avl = gpr_avl_add(avl, box(179), box(1625), nullptr); avl = remove_int(avl, 926); avl = remove_int(avl, 326); - avl = gpr_avl_add(avl, box(551), box(1628), NULL); + avl = gpr_avl_add(avl, box(551), box(1628), nullptr); avl = remove_int(avl, 14); avl = remove_int(avl, 476); avl = remove_int(avl, 823); - avl = gpr_avl_add(avl, box(350), box(1632), NULL); - avl = gpr_avl_add(avl, box(133), box(1633), NULL); + avl = gpr_avl_add(avl, box(350), box(1632), nullptr); + avl = gpr_avl_add(avl, box(133), box(1633), nullptr); avl = remove_int(avl, 906); - avl = gpr_avl_add(avl, box(827), box(1635), NULL); - avl = gpr_avl_add(avl, box(201), box(1636), NULL); + avl = gpr_avl_add(avl, box(827), box(1635), nullptr); + avl = gpr_avl_add(avl, box(201), box(1636), nullptr); avl = remove_int(avl, 124); avl = remove_int(avl, 662); - avl = gpr_avl_add(avl, box(314), box(1639), NULL); - avl = gpr_avl_add(avl, box(986), box(1640), NULL); - avl = gpr_avl_add(avl, box(622), box(1641), NULL); + avl = gpr_avl_add(avl, box(314), box(1639), nullptr); + avl = gpr_avl_add(avl, box(986), box(1640), nullptr); + avl = gpr_avl_add(avl, box(622), box(1641), nullptr); avl = remove_int(avl, 130); - avl = gpr_avl_add(avl, box(861), box(1643), NULL); + avl = gpr_avl_add(avl, box(861), box(1643), nullptr); avl = remove_int(avl, 497); avl = remove_int(avl, 905); - avl = gpr_avl_add(avl, box(502), box(1646), NULL); + avl = gpr_avl_add(avl, box(502), box(1646), nullptr); avl = remove_int(avl, 721); - avl = gpr_avl_add(avl, box(514), box(1648), NULL); - avl = gpr_avl_add(avl, box(410), box(1649), NULL); + avl = gpr_avl_add(avl, box(514), box(1648), nullptr); + avl = gpr_avl_add(avl, box(410), box(1649), nullptr); avl = remove_int(avl, 869); avl = remove_int(avl, 247); - avl = gpr_avl_add(avl, box(450), box(1652), NULL); + avl = gpr_avl_add(avl, box(450), box(1652), nullptr); avl = remove_int(avl, 364); - avl = gpr_avl_add(avl, box(963), box(1654), NULL); - avl = gpr_avl_add(avl, box(146), box(1655), NULL); + avl = gpr_avl_add(avl, box(963), box(1654), nullptr); + avl = gpr_avl_add(avl, box(146), box(1655), nullptr); avl = remove_int(avl, 147); avl = remove_int(avl, 789); - avl = gpr_avl_add(avl, box(693), box(1658), NULL); - avl = gpr_avl_add(avl, box(959), box(1659), NULL); + avl = gpr_avl_add(avl, box(693), box(1658), nullptr); + avl = gpr_avl_add(avl, box(959), box(1659), nullptr); avl = remove_int(avl, 478); - avl = gpr_avl_add(avl, box(116), box(1661), NULL); - avl = gpr_avl_add(avl, box(520), box(1662), NULL); - avl = gpr_avl_add(avl, box(809), box(1663), NULL); - avl = gpr_avl_add(avl, box(667), box(1664), NULL); - avl = gpr_avl_add(avl, box(406), box(1665), NULL); + avl = gpr_avl_add(avl, box(116), box(1661), nullptr); + avl = gpr_avl_add(avl, box(520), box(1662), nullptr); + avl = gpr_avl_add(avl, box(809), box(1663), nullptr); + avl = gpr_avl_add(avl, box(667), box(1664), nullptr); + avl = gpr_avl_add(avl, box(406), box(1665), nullptr); avl = remove_int(avl, 409); - avl = gpr_avl_add(avl, box(558), box(1667), NULL); - avl = gpr_avl_add(avl, box(0), box(1668), NULL); - avl = gpr_avl_add(avl, box(948), box(1669), NULL); - avl = gpr_avl_add(avl, box(576), box(1670), NULL); + avl = gpr_avl_add(avl, box(558), box(1667), nullptr); + avl = gpr_avl_add(avl, box(0), box(1668), nullptr); + avl = gpr_avl_add(avl, box(948), box(1669), nullptr); + avl = gpr_avl_add(avl, box(576), box(1670), nullptr); avl = remove_int(avl, 864); avl = remove_int(avl, 840); avl = remove_int(avl, 1001); - avl = gpr_avl_add(avl, box(232), box(1674), NULL); + avl = gpr_avl_add(avl, box(232), box(1674), nullptr); avl = remove_int(avl, 676); avl = remove_int(avl, 752); avl = remove_int(avl, 667); avl = remove_int(avl, 605); - avl = gpr_avl_add(avl, box(258), box(1679), NULL); - avl = gpr_avl_add(avl, box(648), box(1680), NULL); - avl = gpr_avl_add(avl, box(761), box(1681), NULL); + avl = gpr_avl_add(avl, box(258), box(1679), nullptr); + avl = gpr_avl_add(avl, box(648), box(1680), nullptr); + avl = gpr_avl_add(avl, box(761), box(1681), nullptr); avl = remove_int(avl, 293); avl = remove_int(avl, 893); - avl = gpr_avl_add(avl, box(194), box(1684), NULL); + avl = gpr_avl_add(avl, box(194), box(1684), nullptr); avl = remove_int(avl, 233); - avl = gpr_avl_add(avl, box(888), box(1686), NULL); + avl = gpr_avl_add(avl, box(888), box(1686), nullptr); avl = remove_int(avl, 470); avl = remove_int(avl, 703); avl = remove_int(avl, 190); avl = remove_int(avl, 359); - avl = gpr_avl_add(avl, box(621), box(1691), NULL); + avl = gpr_avl_add(avl, box(621), box(1691), nullptr); avl = remove_int(avl, 634); avl = remove_int(avl, 335); - avl = gpr_avl_add(avl, box(718), box(1694), NULL); - avl = gpr_avl_add(avl, box(463), box(1695), NULL); - avl = gpr_avl_add(avl, box(233), box(1696), NULL); + avl = gpr_avl_add(avl, box(718), box(1694), nullptr); + avl = gpr_avl_add(avl, box(463), box(1695), nullptr); + avl = gpr_avl_add(avl, box(233), box(1696), nullptr); avl = remove_int(avl, 376); avl = remove_int(avl, 496); avl = remove_int(avl, 819); avl = remove_int(avl, 38); avl = remove_int(avl, 436); avl = remove_int(avl, 102); - avl = gpr_avl_add(avl, box(607), box(1703), NULL); + avl = gpr_avl_add(avl, box(607), box(1703), nullptr); avl = remove_int(avl, 329); - avl = gpr_avl_add(avl, box(716), box(1705), NULL); + avl = gpr_avl_add(avl, box(716), box(1705), nullptr); avl = remove_int(avl, 639); avl = remove_int(avl, 775); avl = remove_int(avl, 578); @@ -2851,402 +2851,402 @@ static void test_badcase3(void) { avl = remove_int(avl, 679); avl = remove_int(avl, 615); avl = remove_int(avl, 104); - avl = gpr_avl_add(avl, box(414), box(1713), NULL); - avl = gpr_avl_add(avl, box(212), box(1714), NULL); - avl = gpr_avl_add(avl, box(266), box(1715), NULL); - avl = gpr_avl_add(avl, box(238), box(1716), NULL); + avl = gpr_avl_add(avl, box(414), box(1713), nullptr); + avl = gpr_avl_add(avl, box(212), box(1714), nullptr); + avl = gpr_avl_add(avl, box(266), box(1715), nullptr); + avl = gpr_avl_add(avl, box(238), box(1716), nullptr); avl = remove_int(avl, 153); - avl = gpr_avl_add(avl, box(585), box(1718), NULL); + avl = gpr_avl_add(avl, box(585), box(1718), nullptr); avl = remove_int(avl, 121); - avl = gpr_avl_add(avl, box(534), box(1720), NULL); + avl = gpr_avl_add(avl, box(534), box(1720), nullptr); avl = remove_int(avl, 579); - avl = gpr_avl_add(avl, box(127), box(1722), NULL); - avl = gpr_avl_add(avl, box(399), box(1723), NULL); + avl = gpr_avl_add(avl, box(127), box(1722), nullptr); + avl = gpr_avl_add(avl, box(399), box(1723), nullptr); avl = remove_int(avl, 417); - avl = gpr_avl_add(avl, box(978), box(1725), NULL); - avl = gpr_avl_add(avl, box(768), box(1726), NULL); + avl = gpr_avl_add(avl, box(978), box(1725), nullptr); + avl = gpr_avl_add(avl, box(768), box(1726), nullptr); avl = remove_int(avl, 985); - avl = gpr_avl_add(avl, box(536), box(1728), NULL); - avl = gpr_avl_add(avl, box(449), box(1729), NULL); - avl = gpr_avl_add(avl, box(586), box(1730), NULL); + avl = gpr_avl_add(avl, box(536), box(1728), nullptr); + avl = gpr_avl_add(avl, box(449), box(1729), nullptr); + avl = gpr_avl_add(avl, box(586), box(1730), nullptr); avl = remove_int(avl, 998); avl = remove_int(avl, 394); avl = remove_int(avl, 141); - avl = gpr_avl_add(avl, box(889), box(1734), NULL); - avl = gpr_avl_add(avl, box(871), box(1735), NULL); - avl = gpr_avl_add(avl, box(76), box(1736), NULL); - avl = gpr_avl_add(avl, box(549), box(1737), NULL); - avl = gpr_avl_add(avl, box(757), box(1738), NULL); + avl = gpr_avl_add(avl, box(889), box(1734), nullptr); + avl = gpr_avl_add(avl, box(871), box(1735), nullptr); + avl = gpr_avl_add(avl, box(76), box(1736), nullptr); + avl = gpr_avl_add(avl, box(549), box(1737), nullptr); + avl = gpr_avl_add(avl, box(757), box(1738), nullptr); avl = remove_int(avl, 908); - avl = gpr_avl_add(avl, box(789), box(1740), NULL); + avl = gpr_avl_add(avl, box(789), box(1740), nullptr); avl = remove_int(avl, 224); - avl = gpr_avl_add(avl, box(407), box(1742), NULL); - avl = gpr_avl_add(avl, box(381), box(1743), NULL); - avl = gpr_avl_add(avl, box(561), box(1744), NULL); - avl = gpr_avl_add(avl, box(667), box(1745), NULL); - avl = gpr_avl_add(avl, box(522), box(1746), NULL); - avl = gpr_avl_add(avl, box(948), box(1747), NULL); + avl = gpr_avl_add(avl, box(407), box(1742), nullptr); + avl = gpr_avl_add(avl, box(381), box(1743), nullptr); + avl = gpr_avl_add(avl, box(561), box(1744), nullptr); + avl = gpr_avl_add(avl, box(667), box(1745), nullptr); + avl = gpr_avl_add(avl, box(522), box(1746), nullptr); + avl = gpr_avl_add(avl, box(948), box(1747), nullptr); avl = remove_int(avl, 770); - avl = gpr_avl_add(avl, box(872), box(1749), NULL); - avl = gpr_avl_add(avl, box(327), box(1750), NULL); + avl = gpr_avl_add(avl, box(872), box(1749), nullptr); + avl = gpr_avl_add(avl, box(327), box(1750), nullptr); avl = remove_int(avl, 10); - avl = gpr_avl_add(avl, box(122), box(1752), NULL); + avl = gpr_avl_add(avl, box(122), box(1752), nullptr); avl = remove_int(avl, 606); - avl = gpr_avl_add(avl, box(485), box(1754), NULL); + avl = gpr_avl_add(avl, box(485), box(1754), nullptr); avl = remove_int(avl, 6); - avl = gpr_avl_add(avl, box(329), box(1756), NULL); - avl = gpr_avl_add(avl, box(783), box(1757), NULL); + avl = gpr_avl_add(avl, box(329), box(1756), nullptr); + avl = gpr_avl_add(avl, box(783), box(1757), nullptr); avl = remove_int(avl, 416); - avl = gpr_avl_add(avl, box(656), box(1759), NULL); - avl = gpr_avl_add(avl, box(971), box(1760), NULL); - avl = gpr_avl_add(avl, box(77), box(1761), NULL); - avl = gpr_avl_add(avl, box(942), box(1762), NULL); + avl = gpr_avl_add(avl, box(656), box(1759), nullptr); + avl = gpr_avl_add(avl, box(971), box(1760), nullptr); + avl = gpr_avl_add(avl, box(77), box(1761), nullptr); + avl = gpr_avl_add(avl, box(942), box(1762), nullptr); avl = remove_int(avl, 361); - avl = gpr_avl_add(avl, box(66), box(1764), NULL); - avl = gpr_avl_add(avl, box(299), box(1765), NULL); - avl = gpr_avl_add(avl, box(929), box(1766), NULL); - avl = gpr_avl_add(avl, box(797), box(1767), NULL); + avl = gpr_avl_add(avl, box(66), box(1764), nullptr); + avl = gpr_avl_add(avl, box(299), box(1765), nullptr); + avl = gpr_avl_add(avl, box(929), box(1766), nullptr); + avl = gpr_avl_add(avl, box(797), box(1767), nullptr); avl = remove_int(avl, 869); avl = remove_int(avl, 907); - avl = gpr_avl_add(avl, box(870), box(1770), NULL); + avl = gpr_avl_add(avl, box(870), box(1770), nullptr); avl = remove_int(avl, 580); avl = remove_int(avl, 120); - avl = gpr_avl_add(avl, box(913), box(1773), NULL); + avl = gpr_avl_add(avl, box(913), box(1773), nullptr); avl = remove_int(avl, 480); - avl = gpr_avl_add(avl, box(489), box(1775), NULL); + avl = gpr_avl_add(avl, box(489), box(1775), nullptr); avl = remove_int(avl, 845); - avl = gpr_avl_add(avl, box(896), box(1777), NULL); + avl = gpr_avl_add(avl, box(896), box(1777), nullptr); avl = remove_int(avl, 567); avl = remove_int(avl, 427); - avl = gpr_avl_add(avl, box(443), box(1780), NULL); - avl = gpr_avl_add(avl, box(3), box(1781), NULL); + avl = gpr_avl_add(avl, box(443), box(1780), nullptr); + avl = gpr_avl_add(avl, box(3), box(1781), nullptr); avl = remove_int(avl, 12); - avl = gpr_avl_add(avl, box(376), box(1783), NULL); - avl = gpr_avl_add(avl, box(155), box(1784), NULL); - avl = gpr_avl_add(avl, box(188), box(1785), NULL); - avl = gpr_avl_add(avl, box(149), box(1786), NULL); - avl = gpr_avl_add(avl, box(178), box(1787), NULL); + avl = gpr_avl_add(avl, box(376), box(1783), nullptr); + avl = gpr_avl_add(avl, box(155), box(1784), nullptr); + avl = gpr_avl_add(avl, box(188), box(1785), nullptr); + avl = gpr_avl_add(avl, box(149), box(1786), nullptr); + avl = gpr_avl_add(avl, box(178), box(1787), nullptr); avl = remove_int(avl, 84); - avl = gpr_avl_add(avl, box(805), box(1789), NULL); - avl = gpr_avl_add(avl, box(612), box(1790), NULL); + avl = gpr_avl_add(avl, box(805), box(1789), nullptr); + avl = gpr_avl_add(avl, box(612), box(1790), nullptr); avl = remove_int(avl, 991); - avl = gpr_avl_add(avl, box(837), box(1792), NULL); + avl = gpr_avl_add(avl, box(837), box(1792), nullptr); avl = remove_int(avl, 173); avl = remove_int(avl, 72); - avl = gpr_avl_add(avl, box(1014), box(1795), NULL); + avl = gpr_avl_add(avl, box(1014), box(1795), nullptr); avl = remove_int(avl, 303); - avl = gpr_avl_add(avl, box(865), box(1797), NULL); - avl = gpr_avl_add(avl, box(793), box(1798), NULL); + avl = gpr_avl_add(avl, box(865), box(1797), nullptr); + avl = gpr_avl_add(avl, box(793), box(1798), nullptr); avl = remove_int(avl, 173); avl = remove_int(avl, 477); - avl = gpr_avl_add(avl, box(950), box(1801), NULL); - avl = gpr_avl_add(avl, box(105), box(1802), NULL); - avl = gpr_avl_add(avl, box(895), box(1803), NULL); - avl = gpr_avl_add(avl, box(171), box(1804), NULL); - avl = gpr_avl_add(avl, box(753), box(1805), NULL); - avl = gpr_avl_add(avl, box(946), box(1806), NULL); + avl = gpr_avl_add(avl, box(950), box(1801), nullptr); + avl = gpr_avl_add(avl, box(105), box(1802), nullptr); + avl = gpr_avl_add(avl, box(895), box(1803), nullptr); + avl = gpr_avl_add(avl, box(171), box(1804), nullptr); + avl = gpr_avl_add(avl, box(753), box(1805), nullptr); + avl = gpr_avl_add(avl, box(946), box(1806), nullptr); avl = remove_int(avl, 194); avl = remove_int(avl, 559); avl = remove_int(avl, 116); - avl = gpr_avl_add(avl, box(968), box(1810), NULL); + avl = gpr_avl_add(avl, box(968), box(1810), nullptr); avl = remove_int(avl, 124); avl = remove_int(avl, 99); - avl = gpr_avl_add(avl, box(563), box(1813), NULL); + avl = gpr_avl_add(avl, box(563), box(1813), nullptr); avl = remove_int(avl, 182); - avl = gpr_avl_add(avl, box(816), box(1815), NULL); + avl = gpr_avl_add(avl, box(816), box(1815), nullptr); avl = remove_int(avl, 73); avl = remove_int(avl, 261); - avl = gpr_avl_add(avl, box(847), box(1818), NULL); - avl = gpr_avl_add(avl, box(368), box(1819), NULL); - avl = gpr_avl_add(avl, box(808), box(1820), NULL); - avl = gpr_avl_add(avl, box(779), box(1821), NULL); + avl = gpr_avl_add(avl, box(847), box(1818), nullptr); + avl = gpr_avl_add(avl, box(368), box(1819), nullptr); + avl = gpr_avl_add(avl, box(808), box(1820), nullptr); + avl = gpr_avl_add(avl, box(779), box(1821), nullptr); avl = remove_int(avl, 818); - avl = gpr_avl_add(avl, box(466), box(1823), NULL); + avl = gpr_avl_add(avl, box(466), box(1823), nullptr); avl = remove_int(avl, 316); - avl = gpr_avl_add(avl, box(986), box(1825), NULL); - avl = gpr_avl_add(avl, box(688), box(1826), NULL); - avl = gpr_avl_add(avl, box(509), box(1827), NULL); - avl = gpr_avl_add(avl, box(51), box(1828), NULL); + avl = gpr_avl_add(avl, box(986), box(1825), nullptr); + avl = gpr_avl_add(avl, box(688), box(1826), nullptr); + avl = gpr_avl_add(avl, box(509), box(1827), nullptr); + avl = gpr_avl_add(avl, box(51), box(1828), nullptr); avl = remove_int(avl, 655); avl = remove_int(avl, 785); avl = remove_int(avl, 893); - avl = gpr_avl_add(avl, box(167), box(1832), NULL); + avl = gpr_avl_add(avl, box(167), box(1832), nullptr); avl = remove_int(avl, 13); avl = remove_int(avl, 263); - avl = gpr_avl_add(avl, box(1009), box(1835), NULL); + avl = gpr_avl_add(avl, box(1009), box(1835), nullptr); avl = remove_int(avl, 480); avl = remove_int(avl, 778); avl = remove_int(avl, 713); avl = remove_int(avl, 628); - avl = gpr_avl_add(avl, box(803), box(1840), NULL); + avl = gpr_avl_add(avl, box(803), box(1840), nullptr); avl = remove_int(avl, 267); - avl = gpr_avl_add(avl, box(676), box(1842), NULL); - avl = gpr_avl_add(avl, box(231), box(1843), NULL); - avl = gpr_avl_add(avl, box(824), box(1844), NULL); + avl = gpr_avl_add(avl, box(676), box(1842), nullptr); + avl = gpr_avl_add(avl, box(231), box(1843), nullptr); + avl = gpr_avl_add(avl, box(824), box(1844), nullptr); avl = remove_int(avl, 961); - avl = gpr_avl_add(avl, box(311), box(1846), NULL); - avl = gpr_avl_add(avl, box(420), box(1847), NULL); - avl = gpr_avl_add(avl, box(960), box(1848), NULL); - avl = gpr_avl_add(avl, box(468), box(1849), NULL); - avl = gpr_avl_add(avl, box(815), box(1850), NULL); + avl = gpr_avl_add(avl, box(311), box(1846), nullptr); + avl = gpr_avl_add(avl, box(420), box(1847), nullptr); + avl = gpr_avl_add(avl, box(960), box(1848), nullptr); + avl = gpr_avl_add(avl, box(468), box(1849), nullptr); + avl = gpr_avl_add(avl, box(815), box(1850), nullptr); avl = remove_int(avl, 247); avl = remove_int(avl, 194); - avl = gpr_avl_add(avl, box(546), box(1853), NULL); + avl = gpr_avl_add(avl, box(546), box(1853), nullptr); avl = remove_int(avl, 222); avl = remove_int(avl, 914); avl = remove_int(avl, 741); - avl = gpr_avl_add(avl, box(470), box(1857), NULL); - avl = gpr_avl_add(avl, box(933), box(1858), NULL); - avl = gpr_avl_add(avl, box(97), box(1859), NULL); + avl = gpr_avl_add(avl, box(470), box(1857), nullptr); + avl = gpr_avl_add(avl, box(933), box(1858), nullptr); + avl = gpr_avl_add(avl, box(97), box(1859), nullptr); avl = remove_int(avl, 564); avl = remove_int(avl, 295); - avl = gpr_avl_add(avl, box(864), box(1862), NULL); + avl = gpr_avl_add(avl, box(864), box(1862), nullptr); avl = remove_int(avl, 329); - avl = gpr_avl_add(avl, box(124), box(1864), NULL); - avl = gpr_avl_add(avl, box(1000), box(1865), NULL); - avl = gpr_avl_add(avl, box(228), box(1866), NULL); - avl = gpr_avl_add(avl, box(187), box(1867), NULL); + avl = gpr_avl_add(avl, box(124), box(1864), nullptr); + avl = gpr_avl_add(avl, box(1000), box(1865), nullptr); + avl = gpr_avl_add(avl, box(228), box(1866), nullptr); + avl = gpr_avl_add(avl, box(187), box(1867), nullptr); avl = remove_int(avl, 224); avl = remove_int(avl, 306); avl = remove_int(avl, 884); - avl = gpr_avl_add(avl, box(449), box(1871), NULL); - avl = gpr_avl_add(avl, box(353), box(1872), NULL); - avl = gpr_avl_add(avl, box(994), box(1873), NULL); - avl = gpr_avl_add(avl, box(596), box(1874), NULL); - avl = gpr_avl_add(avl, box(996), box(1875), NULL); - avl = gpr_avl_add(avl, box(101), box(1876), NULL); - avl = gpr_avl_add(avl, box(1012), box(1877), NULL); - avl = gpr_avl_add(avl, box(982), box(1878), NULL); - avl = gpr_avl_add(avl, box(742), box(1879), NULL); + avl = gpr_avl_add(avl, box(449), box(1871), nullptr); + avl = gpr_avl_add(avl, box(353), box(1872), nullptr); + avl = gpr_avl_add(avl, box(994), box(1873), nullptr); + avl = gpr_avl_add(avl, box(596), box(1874), nullptr); + avl = gpr_avl_add(avl, box(996), box(1875), nullptr); + avl = gpr_avl_add(avl, box(101), box(1876), nullptr); + avl = gpr_avl_add(avl, box(1012), box(1877), nullptr); + avl = gpr_avl_add(avl, box(982), box(1878), nullptr); + avl = gpr_avl_add(avl, box(742), box(1879), nullptr); avl = remove_int(avl, 92); avl = remove_int(avl, 1022); - avl = gpr_avl_add(avl, box(941), box(1882), NULL); + avl = gpr_avl_add(avl, box(941), box(1882), nullptr); avl = remove_int(avl, 742); avl = remove_int(avl, 919); - avl = gpr_avl_add(avl, box(588), box(1885), NULL); + avl = gpr_avl_add(avl, box(588), box(1885), nullptr); avl = remove_int(avl, 221); - avl = gpr_avl_add(avl, box(356), box(1887), NULL); - avl = gpr_avl_add(avl, box(932), box(1888), NULL); + avl = gpr_avl_add(avl, box(356), box(1887), nullptr); + avl = gpr_avl_add(avl, box(932), box(1888), nullptr); avl = remove_int(avl, 837); - avl = gpr_avl_add(avl, box(394), box(1890), NULL); - avl = gpr_avl_add(avl, box(642), box(1891), NULL); - avl = gpr_avl_add(avl, box(52), box(1892), NULL); - avl = gpr_avl_add(avl, box(437), box(1893), NULL); - avl = gpr_avl_add(avl, box(948), box(1894), NULL); - avl = gpr_avl_add(avl, box(93), box(1895), NULL); + avl = gpr_avl_add(avl, box(394), box(1890), nullptr); + avl = gpr_avl_add(avl, box(642), box(1891), nullptr); + avl = gpr_avl_add(avl, box(52), box(1892), nullptr); + avl = gpr_avl_add(avl, box(437), box(1893), nullptr); + avl = gpr_avl_add(avl, box(948), box(1894), nullptr); + avl = gpr_avl_add(avl, box(93), box(1895), nullptr); avl = remove_int(avl, 873); avl = remove_int(avl, 336); avl = remove_int(avl, 277); avl = remove_int(avl, 932); - avl = gpr_avl_add(avl, box(80), box(1900), NULL); - avl = gpr_avl_add(avl, box(952), box(1901), NULL); - avl = gpr_avl_add(avl, box(510), box(1902), NULL); + avl = gpr_avl_add(avl, box(80), box(1900), nullptr); + avl = gpr_avl_add(avl, box(952), box(1901), nullptr); + avl = gpr_avl_add(avl, box(510), box(1902), nullptr); avl = remove_int(avl, 876); avl = remove_int(avl, 612); - avl = gpr_avl_add(avl, box(923), box(1905), NULL); - avl = gpr_avl_add(avl, box(475), box(1906), NULL); + avl = gpr_avl_add(avl, box(923), box(1905), nullptr); + avl = gpr_avl_add(avl, box(475), box(1906), nullptr); avl = remove_int(avl, 478); avl = remove_int(avl, 148); - avl = gpr_avl_add(avl, box(538), box(1909), NULL); + avl = gpr_avl_add(avl, box(538), box(1909), nullptr); avl = remove_int(avl, 47); - avl = gpr_avl_add(avl, box(89), box(1911), NULL); + avl = gpr_avl_add(avl, box(89), box(1911), nullptr); avl = remove_int(avl, 723); - avl = gpr_avl_add(avl, box(687), box(1913), NULL); - avl = gpr_avl_add(avl, box(480), box(1914), NULL); - avl = gpr_avl_add(avl, box(149), box(1915), NULL); + avl = gpr_avl_add(avl, box(687), box(1913), nullptr); + avl = gpr_avl_add(avl, box(480), box(1914), nullptr); + avl = gpr_avl_add(avl, box(149), box(1915), nullptr); avl = remove_int(avl, 68); avl = remove_int(avl, 862); avl = remove_int(avl, 363); - avl = gpr_avl_add(avl, box(996), box(1919), NULL); + avl = gpr_avl_add(avl, box(996), box(1919), nullptr); avl = remove_int(avl, 380); - avl = gpr_avl_add(avl, box(957), box(1921), NULL); + avl = gpr_avl_add(avl, box(957), box(1921), nullptr); avl = remove_int(avl, 413); - avl = gpr_avl_add(avl, box(360), box(1923), NULL); - avl = gpr_avl_add(avl, box(304), box(1924), NULL); - avl = gpr_avl_add(avl, box(634), box(1925), NULL); - avl = gpr_avl_add(avl, box(506), box(1926), NULL); + avl = gpr_avl_add(avl, box(360), box(1923), nullptr); + avl = gpr_avl_add(avl, box(304), box(1924), nullptr); + avl = gpr_avl_add(avl, box(634), box(1925), nullptr); + avl = gpr_avl_add(avl, box(506), box(1926), nullptr); avl = remove_int(avl, 248); - avl = gpr_avl_add(avl, box(124), box(1928), NULL); - avl = gpr_avl_add(avl, box(181), box(1929), NULL); + avl = gpr_avl_add(avl, box(124), box(1928), nullptr); + avl = gpr_avl_add(avl, box(181), box(1929), nullptr); avl = remove_int(avl, 507); - avl = gpr_avl_add(avl, box(141), box(1931), NULL); + avl = gpr_avl_add(avl, box(141), box(1931), nullptr); avl = remove_int(avl, 409); avl = remove_int(avl, 129); avl = remove_int(avl, 694); avl = remove_int(avl, 723); - avl = gpr_avl_add(avl, box(998), box(1936), NULL); - avl = gpr_avl_add(avl, box(906), box(1937), NULL); - avl = gpr_avl_add(avl, box(44), box(1938), NULL); + avl = gpr_avl_add(avl, box(998), box(1936), nullptr); + avl = gpr_avl_add(avl, box(906), box(1937), nullptr); + avl = gpr_avl_add(avl, box(44), box(1938), nullptr); avl = remove_int(avl, 949); avl = remove_int(avl, 117); - avl = gpr_avl_add(avl, box(700), box(1941), NULL); - avl = gpr_avl_add(avl, box(258), box(1942), NULL); + avl = gpr_avl_add(avl, box(700), box(1941), nullptr); + avl = gpr_avl_add(avl, box(258), box(1942), nullptr); avl = remove_int(avl, 828); - avl = gpr_avl_add(avl, box(860), box(1944), NULL); - avl = gpr_avl_add(avl, box(987), box(1945), NULL); - avl = gpr_avl_add(avl, box(316), box(1946), NULL); - avl = gpr_avl_add(avl, box(919), box(1947), NULL); + avl = gpr_avl_add(avl, box(860), box(1944), nullptr); + avl = gpr_avl_add(avl, box(987), box(1945), nullptr); + avl = gpr_avl_add(avl, box(316), box(1946), nullptr); + avl = gpr_avl_add(avl, box(919), box(1947), nullptr); avl = remove_int(avl, 84); - avl = gpr_avl_add(avl, box(473), box(1949), NULL); + avl = gpr_avl_add(avl, box(473), box(1949), nullptr); avl = remove_int(avl, 127); avl = remove_int(avl, 829); avl = remove_int(avl, 829); - avl = gpr_avl_add(avl, box(488), box(1953), NULL); - avl = gpr_avl_add(avl, box(954), box(1954), NULL); + avl = gpr_avl_add(avl, box(488), box(1953), nullptr); + avl = gpr_avl_add(avl, box(954), box(1954), nullptr); avl = remove_int(avl, 198); avl = remove_int(avl, 972); avl = remove_int(avl, 670); - avl = gpr_avl_add(avl, box(822), box(1958), NULL); + avl = gpr_avl_add(avl, box(822), box(1958), nullptr); avl = remove_int(avl, 589); avl = remove_int(avl, 459); - avl = gpr_avl_add(avl, box(1003), box(1961), NULL); - avl = gpr_avl_add(avl, box(657), box(1962), NULL); - avl = gpr_avl_add(avl, box(477), box(1963), NULL); - avl = gpr_avl_add(avl, box(923), box(1964), NULL); + avl = gpr_avl_add(avl, box(1003), box(1961), nullptr); + avl = gpr_avl_add(avl, box(657), box(1962), nullptr); + avl = gpr_avl_add(avl, box(477), box(1963), nullptr); + avl = gpr_avl_add(avl, box(923), box(1964), nullptr); avl = remove_int(avl, 496); avl = remove_int(avl, 99); - avl = gpr_avl_add(avl, box(127), box(1967), NULL); - avl = gpr_avl_add(avl, box(1013), box(1968), NULL); - avl = gpr_avl_add(avl, box(778), box(1969), NULL); + avl = gpr_avl_add(avl, box(127), box(1967), nullptr); + avl = gpr_avl_add(avl, box(1013), box(1968), nullptr); + avl = gpr_avl_add(avl, box(778), box(1969), nullptr); avl = remove_int(avl, 5); avl = remove_int(avl, 990); avl = remove_int(avl, 850); avl = remove_int(avl, 160); avl = remove_int(avl, 86); - avl = gpr_avl_add(avl, box(283), box(1975), NULL); + avl = gpr_avl_add(avl, box(283), box(1975), nullptr); avl = remove_int(avl, 278); avl = remove_int(avl, 297); avl = remove_int(avl, 137); avl = remove_int(avl, 653); - avl = gpr_avl_add(avl, box(702), box(1980), NULL); + avl = gpr_avl_add(avl, box(702), box(1980), nullptr); avl = remove_int(avl, 63); avl = remove_int(avl, 427); avl = remove_int(avl, 706); avl = remove_int(avl, 806); - avl = gpr_avl_add(avl, box(335), box(1985), NULL); - avl = gpr_avl_add(avl, box(412), box(1986), NULL); + avl = gpr_avl_add(avl, box(335), box(1985), nullptr); + avl = gpr_avl_add(avl, box(412), box(1986), nullptr); avl = remove_int(avl, 766); avl = remove_int(avl, 937); avl = remove_int(avl, 886); avl = remove_int(avl, 652); - avl = gpr_avl_add(avl, box(545), box(1991), NULL); - avl = gpr_avl_add(avl, box(408), box(1992), NULL); - avl = gpr_avl_add(avl, box(841), box(1993), NULL); + avl = gpr_avl_add(avl, box(545), box(1991), nullptr); + avl = gpr_avl_add(avl, box(408), box(1992), nullptr); + avl = gpr_avl_add(avl, box(841), box(1993), nullptr); avl = remove_int(avl, 593); - avl = gpr_avl_add(avl, box(582), box(1995), NULL); - avl = gpr_avl_add(avl, box(597), box(1996), NULL); + avl = gpr_avl_add(avl, box(582), box(1995), nullptr); + avl = gpr_avl_add(avl, box(597), box(1996), nullptr); avl = remove_int(avl, 49); avl = remove_int(avl, 835); - avl = gpr_avl_add(avl, box(417), box(1999), NULL); - avl = gpr_avl_add(avl, box(191), box(2000), NULL); + avl = gpr_avl_add(avl, box(417), box(1999), nullptr); + avl = gpr_avl_add(avl, box(191), box(2000), nullptr); avl = remove_int(avl, 406); - avl = gpr_avl_add(avl, box(30), box(2002), NULL); + avl = gpr_avl_add(avl, box(30), box(2002), nullptr); avl = remove_int(avl, 841); avl = remove_int(avl, 50); - avl = gpr_avl_add(avl, box(967), box(2005), NULL); - avl = gpr_avl_add(avl, box(849), box(2006), NULL); + avl = gpr_avl_add(avl, box(967), box(2005), nullptr); + avl = gpr_avl_add(avl, box(849), box(2006), nullptr); avl = remove_int(avl, 608); - avl = gpr_avl_add(avl, box(306), box(2008), NULL); + avl = gpr_avl_add(avl, box(306), box(2008), nullptr); avl = remove_int(avl, 779); - avl = gpr_avl_add(avl, box(897), box(2010), NULL); - avl = gpr_avl_add(avl, box(147), box(2011), NULL); + avl = gpr_avl_add(avl, box(897), box(2010), nullptr); + avl = gpr_avl_add(avl, box(147), box(2011), nullptr); avl = remove_int(avl, 982); - avl = gpr_avl_add(avl, box(470), box(2013), NULL); + avl = gpr_avl_add(avl, box(470), box(2013), nullptr); avl = remove_int(avl, 951); - avl = gpr_avl_add(avl, box(388), box(2015), NULL); + avl = gpr_avl_add(avl, box(388), box(2015), nullptr); avl = remove_int(avl, 616); avl = remove_int(avl, 721); avl = remove_int(avl, 942); avl = remove_int(avl, 589); - avl = gpr_avl_add(avl, box(218), box(2020), NULL); + avl = gpr_avl_add(avl, box(218), box(2020), nullptr); avl = remove_int(avl, 671); - avl = gpr_avl_add(avl, box(1020), box(2022), NULL); + avl = gpr_avl_add(avl, box(1020), box(2022), nullptr); avl = remove_int(avl, 277); - avl = gpr_avl_add(avl, box(681), box(2024), NULL); - avl = gpr_avl_add(avl, box(179), box(2025), NULL); - avl = gpr_avl_add(avl, box(370), box(2026), NULL); - avl = gpr_avl_add(avl, box(0), box(2027), NULL); + avl = gpr_avl_add(avl, box(681), box(2024), nullptr); + avl = gpr_avl_add(avl, box(179), box(2025), nullptr); + avl = gpr_avl_add(avl, box(370), box(2026), nullptr); + avl = gpr_avl_add(avl, box(0), box(2027), nullptr); avl = remove_int(avl, 523); - avl = gpr_avl_add(avl, box(99), box(2029), NULL); - avl = gpr_avl_add(avl, box(334), box(2030), NULL); - avl = gpr_avl_add(avl, box(569), box(2031), NULL); - avl = gpr_avl_add(avl, box(257), box(2032), NULL); + avl = gpr_avl_add(avl, box(99), box(2029), nullptr); + avl = gpr_avl_add(avl, box(334), box(2030), nullptr); + avl = gpr_avl_add(avl, box(569), box(2031), nullptr); + avl = gpr_avl_add(avl, box(257), box(2032), nullptr); avl = remove_int(avl, 572); - avl = gpr_avl_add(avl, box(805), box(2034), NULL); - avl = gpr_avl_add(avl, box(143), box(2035), NULL); - avl = gpr_avl_add(avl, box(670), box(2036), NULL); + avl = gpr_avl_add(avl, box(805), box(2034), nullptr); + avl = gpr_avl_add(avl, box(143), box(2035), nullptr); + avl = gpr_avl_add(avl, box(670), box(2036), nullptr); avl = remove_int(avl, 42); - avl = gpr_avl_add(avl, box(46), box(2038), NULL); + avl = gpr_avl_add(avl, box(46), box(2038), nullptr); avl = remove_int(avl, 970); - avl = gpr_avl_add(avl, box(353), box(2040), NULL); + avl = gpr_avl_add(avl, box(353), box(2040), nullptr); avl = remove_int(avl, 258); - avl = gpr_avl_add(avl, box(451), box(2042), NULL); - avl = gpr_avl_add(avl, box(28), box(2043), NULL); - avl = gpr_avl_add(avl, box(729), box(2044), NULL); - avl = gpr_avl_add(avl, box(401), box(2045), NULL); - avl = gpr_avl_add(avl, box(614), box(2046), NULL); + avl = gpr_avl_add(avl, box(451), box(2042), nullptr); + avl = gpr_avl_add(avl, box(28), box(2043), nullptr); + avl = gpr_avl_add(avl, box(729), box(2044), nullptr); + avl = gpr_avl_add(avl, box(401), box(2045), nullptr); + avl = gpr_avl_add(avl, box(614), box(2046), nullptr); avl = remove_int(avl, 990); avl = remove_int(avl, 212); avl = remove_int(avl, 22); avl = remove_int(avl, 677); - avl = gpr_avl_add(avl, box(1016), box(2051), NULL); - avl = gpr_avl_add(avl, box(980), box(2052), NULL); - avl = gpr_avl_add(avl, box(990), box(2053), NULL); - avl = gpr_avl_add(avl, box(355), box(2054), NULL); + avl = gpr_avl_add(avl, box(1016), box(2051), nullptr); + avl = gpr_avl_add(avl, box(980), box(2052), nullptr); + avl = gpr_avl_add(avl, box(990), box(2053), nullptr); + avl = gpr_avl_add(avl, box(355), box(2054), nullptr); avl = remove_int(avl, 730); avl = remove_int(avl, 37); - avl = gpr_avl_add(avl, box(407), box(2057), NULL); - avl = gpr_avl_add(avl, box(222), box(2058), NULL); - avl = gpr_avl_add(avl, box(439), box(2059), NULL); - avl = gpr_avl_add(avl, box(563), box(2060), NULL); + avl = gpr_avl_add(avl, box(407), box(2057), nullptr); + avl = gpr_avl_add(avl, box(222), box(2058), nullptr); + avl = gpr_avl_add(avl, box(439), box(2059), nullptr); + avl = gpr_avl_add(avl, box(563), box(2060), nullptr); avl = remove_int(avl, 992); avl = remove_int(avl, 786); - avl = gpr_avl_add(avl, box(1), box(2063), NULL); - avl = gpr_avl_add(avl, box(473), box(2064), NULL); - avl = gpr_avl_add(avl, box(992), box(2065), NULL); + avl = gpr_avl_add(avl, box(1), box(2063), nullptr); + avl = gpr_avl_add(avl, box(473), box(2064), nullptr); + avl = gpr_avl_add(avl, box(992), box(2065), nullptr); avl = remove_int(avl, 190); avl = remove_int(avl, 450); avl = remove_int(avl, 1020); avl = remove_int(avl, 149); - avl = gpr_avl_add(avl, box(329), box(2070), NULL); - avl = gpr_avl_add(avl, box(35), box(2071), NULL); + avl = gpr_avl_add(avl, box(329), box(2070), nullptr); + avl = gpr_avl_add(avl, box(35), box(2071), nullptr); avl = remove_int(avl, 843); - avl = gpr_avl_add(avl, box(855), box(2073), NULL); + avl = gpr_avl_add(avl, box(855), box(2073), nullptr); avl = remove_int(avl, 878); - avl = gpr_avl_add(avl, box(993), box(2075), NULL); - avl = gpr_avl_add(avl, box(87), box(2076), NULL); - avl = gpr_avl_add(avl, box(572), box(2077), NULL); + avl = gpr_avl_add(avl, box(993), box(2075), nullptr); + avl = gpr_avl_add(avl, box(87), box(2076), nullptr); + avl = gpr_avl_add(avl, box(572), box(2077), nullptr); avl = remove_int(avl, 896); - avl = gpr_avl_add(avl, box(849), box(2079), NULL); + avl = gpr_avl_add(avl, box(849), box(2079), nullptr); avl = remove_int(avl, 597); - avl = gpr_avl_add(avl, box(472), box(2081), NULL); + avl = gpr_avl_add(avl, box(472), box(2081), nullptr); avl = remove_int(avl, 778); avl = remove_int(avl, 934); avl = remove_int(avl, 314); - avl = gpr_avl_add(avl, box(101), box(2085), NULL); + avl = gpr_avl_add(avl, box(101), box(2085), nullptr); avl = remove_int(avl, 938); avl = remove_int(avl, 1010); - avl = gpr_avl_add(avl, box(579), box(2088), NULL); + avl = gpr_avl_add(avl, box(579), box(2088), nullptr); avl = remove_int(avl, 798); avl = remove_int(avl, 88); - avl = gpr_avl_add(avl, box(851), box(2091), NULL); + avl = gpr_avl_add(avl, box(851), box(2091), nullptr); avl = remove_int(avl, 705); - avl = gpr_avl_add(avl, box(26), box(2093), NULL); + avl = gpr_avl_add(avl, box(26), box(2093), nullptr); avl = remove_int(avl, 973); - avl = gpr_avl_add(avl, box(923), box(2095), NULL); + avl = gpr_avl_add(avl, box(923), box(2095), nullptr); avl = remove_int(avl, 668); - avl = gpr_avl_add(avl, box(310), box(2097), NULL); - avl = gpr_avl_add(avl, box(269), box(2098), NULL); + avl = gpr_avl_add(avl, box(310), box(2097), nullptr); + avl = gpr_avl_add(avl, box(269), box(2098), nullptr); avl = remove_int(avl, 173); - avl = gpr_avl_add(avl, box(279), box(2100), NULL); + avl = gpr_avl_add(avl, box(279), box(2100), nullptr); avl = remove_int(avl, 203); - avl = gpr_avl_add(avl, box(411), box(2102), NULL); + avl = gpr_avl_add(avl, box(411), box(2102), nullptr); avl = remove_int(avl, 950); - avl = gpr_avl_add(avl, box(6), box(2104), NULL); + avl = gpr_avl_add(avl, box(6), box(2104), nullptr); avl = remove_int(avl, 400); avl = remove_int(avl, 468); avl = remove_int(avl, 271); - avl = gpr_avl_add(avl, box(627), box(2108), NULL); + avl = gpr_avl_add(avl, box(627), box(2108), nullptr); avl = remove_int(avl, 727); avl = remove_int(avl, 148); avl = remove_int(avl, 98); @@ -3255,259 +3255,259 @@ static void test_badcase3(void) { avl = remove_int(avl, 628); avl = remove_int(avl, 826); avl = remove_int(avl, 664); - avl = gpr_avl_add(avl, box(76), box(2117), NULL); + avl = gpr_avl_add(avl, box(76), box(2117), nullptr); avl = remove_int(avl, 194); avl = remove_int(avl, 18); - avl = gpr_avl_add(avl, box(727), box(2120), NULL); + avl = gpr_avl_add(avl, box(727), box(2120), nullptr); avl = remove_int(avl, 295); - avl = gpr_avl_add(avl, box(645), box(2122), NULL); + avl = gpr_avl_add(avl, box(645), box(2122), nullptr); avl = remove_int(avl, 321); avl = remove_int(avl, 863); - avl = gpr_avl_add(avl, box(824), box(2125), NULL); - avl = gpr_avl_add(avl, box(651), box(2126), NULL); - avl = gpr_avl_add(avl, box(804), box(2127), NULL); + avl = gpr_avl_add(avl, box(824), box(2125), nullptr); + avl = gpr_avl_add(avl, box(651), box(2126), nullptr); + avl = gpr_avl_add(avl, box(804), box(2127), nullptr); avl = remove_int(avl, 307); - avl = gpr_avl_add(avl, box(867), box(2129), NULL); + avl = gpr_avl_add(avl, box(867), box(2129), nullptr); avl = remove_int(avl, 384); - avl = gpr_avl_add(avl, box(819), box(2131), NULL); + avl = gpr_avl_add(avl, box(819), box(2131), nullptr); avl = remove_int(avl, 674); - avl = gpr_avl_add(avl, box(76), box(2133), NULL); + avl = gpr_avl_add(avl, box(76), box(2133), nullptr); avl = remove_int(avl, 898); - avl = gpr_avl_add(avl, box(45), box(2135), NULL); - avl = gpr_avl_add(avl, box(512), box(2136), NULL); + avl = gpr_avl_add(avl, box(45), box(2135), nullptr); + avl = gpr_avl_add(avl, box(512), box(2136), nullptr); avl = remove_int(avl, 773); avl = remove_int(avl, 907); avl = remove_int(avl, 382); avl = remove_int(avl, 95); avl = remove_int(avl, 734); avl = remove_int(avl, 81); - avl = gpr_avl_add(avl, box(348), box(2143), NULL); + avl = gpr_avl_add(avl, box(348), box(2143), nullptr); avl = remove_int(avl, 509); avl = remove_int(avl, 301); - avl = gpr_avl_add(avl, box(861), box(2146), NULL); - avl = gpr_avl_add(avl, box(918), box(2147), NULL); + avl = gpr_avl_add(avl, box(861), box(2146), nullptr); + avl = gpr_avl_add(avl, box(918), box(2147), nullptr); avl = remove_int(avl, 992); - avl = gpr_avl_add(avl, box(356), box(2149), NULL); + avl = gpr_avl_add(avl, box(356), box(2149), nullptr); avl = remove_int(avl, 64); avl = remove_int(avl, 444); avl = remove_int(avl, 741); - avl = gpr_avl_add(avl, box(710), box(2153), NULL); - avl = gpr_avl_add(avl, box(264), box(2154), NULL); + avl = gpr_avl_add(avl, box(710), box(2153), nullptr); + avl = gpr_avl_add(avl, box(264), box(2154), nullptr); avl = remove_int(avl, 347); avl = remove_int(avl, 250); - avl = gpr_avl_add(avl, box(82), box(2157), NULL); - avl = gpr_avl_add(avl, box(571), box(2158), NULL); + avl = gpr_avl_add(avl, box(82), box(2157), nullptr); + avl = gpr_avl_add(avl, box(571), box(2158), nullptr); avl = remove_int(avl, 721); avl = remove_int(avl, 622); - avl = gpr_avl_add(avl, box(950), box(2161), NULL); - avl = gpr_avl_add(avl, box(94), box(2162), NULL); + avl = gpr_avl_add(avl, box(950), box(2161), nullptr); + avl = gpr_avl_add(avl, box(94), box(2162), nullptr); avl = remove_int(avl, 970); - avl = gpr_avl_add(avl, box(815), box(2164), NULL); + avl = gpr_avl_add(avl, box(815), box(2164), nullptr); avl = remove_int(avl, 930); avl = remove_int(avl, 703); - avl = gpr_avl_add(avl, box(432), box(2167), NULL); + avl = gpr_avl_add(avl, box(432), box(2167), nullptr); avl = remove_int(avl, 544); - avl = gpr_avl_add(avl, box(21), box(2169), NULL); - avl = gpr_avl_add(avl, box(186), box(2170), NULL); + avl = gpr_avl_add(avl, box(21), box(2169), nullptr); + avl = gpr_avl_add(avl, box(186), box(2170), nullptr); avl = remove_int(avl, 143); - avl = gpr_avl_add(avl, box(425), box(2172), NULL); + avl = gpr_avl_add(avl, box(425), box(2172), nullptr); avl = remove_int(avl, 769); - avl = gpr_avl_add(avl, box(656), box(2174), NULL); + avl = gpr_avl_add(avl, box(656), box(2174), nullptr); avl = remove_int(avl, 29); - avl = gpr_avl_add(avl, box(464), box(2176), NULL); + avl = gpr_avl_add(avl, box(464), box(2176), nullptr); avl = remove_int(avl, 713); - avl = gpr_avl_add(avl, box(800), box(2178), NULL); + avl = gpr_avl_add(avl, box(800), box(2178), nullptr); avl = remove_int(avl, 621); - avl = gpr_avl_add(avl, box(962), box(2180), NULL); + avl = gpr_avl_add(avl, box(962), box(2180), nullptr); avl = remove_int(avl, 448); - avl = gpr_avl_add(avl, box(878), box(2182), NULL); + avl = gpr_avl_add(avl, box(878), box(2182), nullptr); avl = remove_int(avl, 39); avl = remove_int(avl, 999); - avl = gpr_avl_add(avl, box(182), box(2185), NULL); - avl = gpr_avl_add(avl, box(429), box(2186), NULL); - avl = gpr_avl_add(avl, box(598), box(2187), NULL); + avl = gpr_avl_add(avl, box(182), box(2185), nullptr); + avl = gpr_avl_add(avl, box(429), box(2186), nullptr); + avl = gpr_avl_add(avl, box(598), box(2187), nullptr); avl = remove_int(avl, 551); - avl = gpr_avl_add(avl, box(827), box(2189), NULL); - avl = gpr_avl_add(avl, box(809), box(2190), NULL); + avl = gpr_avl_add(avl, box(827), box(2189), nullptr); + avl = gpr_avl_add(avl, box(809), box(2190), nullptr); avl = remove_int(avl, 438); avl = remove_int(avl, 811); - avl = gpr_avl_add(avl, box(808), box(2193), NULL); - avl = gpr_avl_add(avl, box(788), box(2194), NULL); + avl = gpr_avl_add(avl, box(808), box(2193), nullptr); + avl = gpr_avl_add(avl, box(788), box(2194), nullptr); avl = remove_int(avl, 156); - avl = gpr_avl_add(avl, box(933), box(2196), NULL); - avl = gpr_avl_add(avl, box(344), box(2197), NULL); + avl = gpr_avl_add(avl, box(933), box(2196), nullptr); + avl = gpr_avl_add(avl, box(344), box(2197), nullptr); avl = remove_int(avl, 460); - avl = gpr_avl_add(avl, box(161), box(2199), NULL); - avl = gpr_avl_add(avl, box(444), box(2200), NULL); + avl = gpr_avl_add(avl, box(161), box(2199), nullptr); + avl = gpr_avl_add(avl, box(444), box(2200), nullptr); avl = remove_int(avl, 597); avl = remove_int(avl, 668); - avl = gpr_avl_add(avl, box(703), box(2203), NULL); + avl = gpr_avl_add(avl, box(703), box(2203), nullptr); avl = remove_int(avl, 515); - avl = gpr_avl_add(avl, box(380), box(2205), NULL); - avl = gpr_avl_add(avl, box(338), box(2206), NULL); + avl = gpr_avl_add(avl, box(380), box(2205), nullptr); + avl = gpr_avl_add(avl, box(338), box(2206), nullptr); avl = remove_int(avl, 550); avl = remove_int(avl, 946); avl = remove_int(avl, 714); avl = remove_int(avl, 739); - avl = gpr_avl_add(avl, box(413), box(2211), NULL); + avl = gpr_avl_add(avl, box(413), box(2211), nullptr); avl = remove_int(avl, 450); - avl = gpr_avl_add(avl, box(411), box(2213), NULL); - avl = gpr_avl_add(avl, box(117), box(2214), NULL); - avl = gpr_avl_add(avl, box(322), box(2215), NULL); - avl = gpr_avl_add(avl, box(915), box(2216), NULL); - avl = gpr_avl_add(avl, box(410), box(2217), NULL); - avl = gpr_avl_add(avl, box(66), box(2218), NULL); + avl = gpr_avl_add(avl, box(411), box(2213), nullptr); + avl = gpr_avl_add(avl, box(117), box(2214), nullptr); + avl = gpr_avl_add(avl, box(322), box(2215), nullptr); + avl = gpr_avl_add(avl, box(915), box(2216), nullptr); + avl = gpr_avl_add(avl, box(410), box(2217), nullptr); + avl = gpr_avl_add(avl, box(66), box(2218), nullptr); avl = remove_int(avl, 756); avl = remove_int(avl, 596); - avl = gpr_avl_add(avl, box(882), box(2221), NULL); - avl = gpr_avl_add(avl, box(930), box(2222), NULL); - avl = gpr_avl_add(avl, box(36), box(2223), NULL); + avl = gpr_avl_add(avl, box(882), box(2221), nullptr); + avl = gpr_avl_add(avl, box(930), box(2222), nullptr); + avl = gpr_avl_add(avl, box(36), box(2223), nullptr); avl = remove_int(avl, 742); - avl = gpr_avl_add(avl, box(539), box(2225), NULL); - avl = gpr_avl_add(avl, box(596), box(2226), NULL); + avl = gpr_avl_add(avl, box(539), box(2225), nullptr); + avl = gpr_avl_add(avl, box(596), box(2226), nullptr); avl = remove_int(avl, 82); avl = remove_int(avl, 686); avl = remove_int(avl, 933); avl = remove_int(avl, 42); avl = remove_int(avl, 340); - avl = gpr_avl_add(avl, box(126), box(2232), NULL); - avl = gpr_avl_add(avl, box(493), box(2233), NULL); - avl = gpr_avl_add(avl, box(839), box(2234), NULL); + avl = gpr_avl_add(avl, box(126), box(2232), nullptr); + avl = gpr_avl_add(avl, box(493), box(2233), nullptr); + avl = gpr_avl_add(avl, box(839), box(2234), nullptr); avl = remove_int(avl, 774); - avl = gpr_avl_add(avl, box(337), box(2236), NULL); + avl = gpr_avl_add(avl, box(337), box(2236), nullptr); avl = remove_int(avl, 322); - avl = gpr_avl_add(avl, box(16), box(2238), NULL); + avl = gpr_avl_add(avl, box(16), box(2238), nullptr); avl = remove_int(avl, 73); avl = remove_int(avl, 85); avl = remove_int(avl, 191); avl = remove_int(avl, 541); - avl = gpr_avl_add(avl, box(704), box(2243), NULL); + avl = gpr_avl_add(avl, box(704), box(2243), nullptr); avl = remove_int(avl, 767); avl = remove_int(avl, 1006); avl = remove_int(avl, 844); avl = remove_int(avl, 742); - avl = gpr_avl_add(avl, box(48), box(2248), NULL); - avl = gpr_avl_add(avl, box(138), box(2249), NULL); - avl = gpr_avl_add(avl, box(437), box(2250), NULL); - avl = gpr_avl_add(avl, box(275), box(2251), NULL); + avl = gpr_avl_add(avl, box(48), box(2248), nullptr); + avl = gpr_avl_add(avl, box(138), box(2249), nullptr); + avl = gpr_avl_add(avl, box(437), box(2250), nullptr); + avl = gpr_avl_add(avl, box(275), box(2251), nullptr); avl = remove_int(avl, 520); - avl = gpr_avl_add(avl, box(1019), box(2253), NULL); + avl = gpr_avl_add(avl, box(1019), box(2253), nullptr); avl = remove_int(avl, 955); - avl = gpr_avl_add(avl, box(270), box(2255), NULL); + avl = gpr_avl_add(avl, box(270), box(2255), nullptr); avl = remove_int(avl, 680); avl = remove_int(avl, 698); - avl = gpr_avl_add(avl, box(735), box(2258), NULL); - avl = gpr_avl_add(avl, box(400), box(2259), NULL); + avl = gpr_avl_add(avl, box(735), box(2258), nullptr); + avl = gpr_avl_add(avl, box(400), box(2259), nullptr); avl = remove_int(avl, 991); - avl = gpr_avl_add(avl, box(263), box(2261), NULL); + avl = gpr_avl_add(avl, box(263), box(2261), nullptr); avl = remove_int(avl, 704); - avl = gpr_avl_add(avl, box(757), box(2263), NULL); + avl = gpr_avl_add(avl, box(757), box(2263), nullptr); avl = remove_int(avl, 194); avl = remove_int(avl, 616); avl = remove_int(avl, 784); - avl = gpr_avl_add(avl, box(382), box(2267), NULL); - avl = gpr_avl_add(avl, box(464), box(2268), NULL); - avl = gpr_avl_add(avl, box(817), box(2269), NULL); + avl = gpr_avl_add(avl, box(382), box(2267), nullptr); + avl = gpr_avl_add(avl, box(464), box(2268), nullptr); + avl = gpr_avl_add(avl, box(817), box(2269), nullptr); avl = remove_int(avl, 445); - avl = gpr_avl_add(avl, box(412), box(2271), NULL); + avl = gpr_avl_add(avl, box(412), box(2271), nullptr); avl = remove_int(avl, 525); - avl = gpr_avl_add(avl, box(299), box(2273), NULL); - avl = gpr_avl_add(avl, box(464), box(2274), NULL); - avl = gpr_avl_add(avl, box(715), box(2275), NULL); + avl = gpr_avl_add(avl, box(299), box(2273), nullptr); + avl = gpr_avl_add(avl, box(464), box(2274), nullptr); + avl = gpr_avl_add(avl, box(715), box(2275), nullptr); avl = remove_int(avl, 58); avl = remove_int(avl, 218); - avl = gpr_avl_add(avl, box(961), box(2278), NULL); - avl = gpr_avl_add(avl, box(491), box(2279), NULL); + avl = gpr_avl_add(avl, box(961), box(2278), nullptr); + avl = gpr_avl_add(avl, box(491), box(2279), nullptr); avl = remove_int(avl, 846); - avl = gpr_avl_add(avl, box(762), box(2281), NULL); + avl = gpr_avl_add(avl, box(762), box(2281), nullptr); avl = remove_int(avl, 974); avl = remove_int(avl, 887); - avl = gpr_avl_add(avl, box(498), box(2284), NULL); + avl = gpr_avl_add(avl, box(498), box(2284), nullptr); avl = remove_int(avl, 810); avl = remove_int(avl, 743); avl = remove_int(avl, 22); avl = remove_int(avl, 284); - avl = gpr_avl_add(avl, box(482), box(2289), NULL); - avl = gpr_avl_add(avl, box(1021), box(2290), NULL); + avl = gpr_avl_add(avl, box(482), box(2289), nullptr); + avl = gpr_avl_add(avl, box(1021), box(2290), nullptr); avl = remove_int(avl, 155); avl = remove_int(avl, 128); - avl = gpr_avl_add(avl, box(819), box(2293), NULL); - avl = gpr_avl_add(avl, box(324), box(2294), NULL); + avl = gpr_avl_add(avl, box(819), box(2293), nullptr); + avl = gpr_avl_add(avl, box(324), box(2294), nullptr); avl = remove_int(avl, 196); avl = remove_int(avl, 370); avl = remove_int(avl, 753); avl = remove_int(avl, 56); avl = remove_int(avl, 735); - avl = gpr_avl_add(avl, box(272), box(2300), NULL); - avl = gpr_avl_add(avl, box(474), box(2301), NULL); - avl = gpr_avl_add(avl, box(719), box(2302), NULL); - avl = gpr_avl_add(avl, box(236), box(2303), NULL); + avl = gpr_avl_add(avl, box(272), box(2300), nullptr); + avl = gpr_avl_add(avl, box(474), box(2301), nullptr); + avl = gpr_avl_add(avl, box(719), box(2302), nullptr); + avl = gpr_avl_add(avl, box(236), box(2303), nullptr); avl = remove_int(avl, 818); - avl = gpr_avl_add(avl, box(727), box(2305), NULL); + avl = gpr_avl_add(avl, box(727), box(2305), nullptr); avl = remove_int(avl, 892); avl = remove_int(avl, 871); avl = remove_int(avl, 231); - avl = gpr_avl_add(avl, box(62), box(2309), NULL); - avl = gpr_avl_add(avl, box(953), box(2310), NULL); + avl = gpr_avl_add(avl, box(62), box(2309), nullptr); + avl = gpr_avl_add(avl, box(953), box(2310), nullptr); avl = remove_int(avl, 701); - avl = gpr_avl_add(avl, box(193), box(2312), NULL); + avl = gpr_avl_add(avl, box(193), box(2312), nullptr); avl = remove_int(avl, 619); avl = remove_int(avl, 22); avl = remove_int(avl, 804); avl = remove_int(avl, 851); - avl = gpr_avl_add(avl, box(286), box(2317), NULL); - avl = gpr_avl_add(avl, box(751), box(2318), NULL); + avl = gpr_avl_add(avl, box(286), box(2317), nullptr); + avl = gpr_avl_add(avl, box(751), box(2318), nullptr); avl = remove_int(avl, 525); - avl = gpr_avl_add(avl, box(217), box(2320), NULL); + avl = gpr_avl_add(avl, box(217), box(2320), nullptr); avl = remove_int(avl, 336); - avl = gpr_avl_add(avl, box(86), box(2322), NULL); - avl = gpr_avl_add(avl, box(81), box(2323), NULL); - avl = gpr_avl_add(avl, box(850), box(2324), NULL); + avl = gpr_avl_add(avl, box(86), box(2322), nullptr); + avl = gpr_avl_add(avl, box(81), box(2323), nullptr); + avl = gpr_avl_add(avl, box(850), box(2324), nullptr); avl = remove_int(avl, 872); - avl = gpr_avl_add(avl, box(402), box(2326), NULL); - avl = gpr_avl_add(avl, box(54), box(2327), NULL); - avl = gpr_avl_add(avl, box(980), box(2328), NULL); - avl = gpr_avl_add(avl, box(845), box(2329), NULL); + avl = gpr_avl_add(avl, box(402), box(2326), nullptr); + avl = gpr_avl_add(avl, box(54), box(2327), nullptr); + avl = gpr_avl_add(avl, box(980), box(2328), nullptr); + avl = gpr_avl_add(avl, box(845), box(2329), nullptr); avl = remove_int(avl, 1004); avl = remove_int(avl, 273); avl = remove_int(avl, 879); - avl = gpr_avl_add(avl, box(354), box(2333), NULL); - avl = gpr_avl_add(avl, box(58), box(2334), NULL); - avl = gpr_avl_add(avl, box(127), box(2335), NULL); + avl = gpr_avl_add(avl, box(354), box(2333), nullptr); + avl = gpr_avl_add(avl, box(58), box(2334), nullptr); + avl = gpr_avl_add(avl, box(127), box(2335), nullptr); avl = remove_int(avl, 84); - avl = gpr_avl_add(avl, box(360), box(2337), NULL); + avl = gpr_avl_add(avl, box(360), box(2337), nullptr); avl = remove_int(avl, 648); avl = remove_int(avl, 488); avl = remove_int(avl, 585); avl = remove_int(avl, 230); - avl = gpr_avl_add(avl, box(887), box(2342), NULL); + avl = gpr_avl_add(avl, box(887), box(2342), nullptr); avl = remove_int(avl, 558); avl = remove_int(avl, 958); - avl = gpr_avl_add(avl, box(822), box(2345), NULL); + avl = gpr_avl_add(avl, box(822), box(2345), nullptr); avl = remove_int(avl, 1004); avl = remove_int(avl, 747); - avl = gpr_avl_add(avl, box(631), box(2348), NULL); - avl = gpr_avl_add(avl, box(442), box(2349), NULL); + avl = gpr_avl_add(avl, box(631), box(2348), nullptr); + avl = gpr_avl_add(avl, box(442), box(2349), nullptr); avl = remove_int(avl, 957); avl = remove_int(avl, 964); - avl = gpr_avl_add(avl, box(10), box(2352), NULL); + avl = gpr_avl_add(avl, box(10), box(2352), nullptr); avl = remove_int(avl, 189); - avl = gpr_avl_add(avl, box(742), box(2354), NULL); + avl = gpr_avl_add(avl, box(742), box(2354), nullptr); avl = remove_int(avl, 108); - avl = gpr_avl_add(avl, box(1014), box(2356), NULL); + avl = gpr_avl_add(avl, box(1014), box(2356), nullptr); avl = remove_int(avl, 266); avl = remove_int(avl, 623); avl = remove_int(avl, 697); - avl = gpr_avl_add(avl, box(180), box(2360), NULL); + avl = gpr_avl_add(avl, box(180), box(2360), nullptr); avl = remove_int(avl, 472); - avl = gpr_avl_add(avl, box(567), box(2362), NULL); + avl = gpr_avl_add(avl, box(567), box(2362), nullptr); avl = remove_int(avl, 1020); avl = remove_int(avl, 273); - avl = gpr_avl_add(avl, box(864), box(2365), NULL); - avl = gpr_avl_add(avl, box(1009), box(2366), NULL); + avl = gpr_avl_add(avl, box(864), box(2365), nullptr); + avl = gpr_avl_add(avl, box(1009), box(2366), nullptr); avl = remove_int(avl, 224); avl = remove_int(avl, 81); - avl = gpr_avl_add(avl, box(653), box(2369), NULL); + avl = gpr_avl_add(avl, box(653), box(2369), nullptr); avl = remove_int(avl, 67); avl = remove_int(avl, 102); avl = remove_int(avl, 76); @@ -3515,51 +3515,51 @@ static void test_badcase3(void) { avl = remove_int(avl, 169); avl = remove_int(avl, 232); avl = remove_int(avl, 79); - avl = gpr_avl_add(avl, box(509), box(2377), NULL); + avl = gpr_avl_add(avl, box(509), box(2377), nullptr); avl = remove_int(avl, 900); avl = remove_int(avl, 822); avl = remove_int(avl, 945); avl = remove_int(avl, 356); - avl = gpr_avl_add(avl, box(443), box(2382), NULL); - avl = gpr_avl_add(avl, box(925), box(2383), NULL); + avl = gpr_avl_add(avl, box(443), box(2382), nullptr); + avl = gpr_avl_add(avl, box(925), box(2383), nullptr); avl = remove_int(avl, 994); avl = remove_int(avl, 324); - avl = gpr_avl_add(avl, box(291), box(2386), NULL); + avl = gpr_avl_add(avl, box(291), box(2386), nullptr); avl = remove_int(avl, 94); avl = remove_int(avl, 795); avl = remove_int(avl, 42); - avl = gpr_avl_add(avl, box(613), box(2390), NULL); + avl = gpr_avl_add(avl, box(613), box(2390), nullptr); avl = remove_int(avl, 289); - avl = gpr_avl_add(avl, box(980), box(2392), NULL); + avl = gpr_avl_add(avl, box(980), box(2392), nullptr); avl = remove_int(avl, 316); - avl = gpr_avl_add(avl, box(281), box(2394), NULL); - avl = gpr_avl_add(avl, box(1006), box(2395), NULL); + avl = gpr_avl_add(avl, box(281), box(2394), nullptr); + avl = gpr_avl_add(avl, box(1006), box(2395), nullptr); avl = remove_int(avl, 776); - avl = gpr_avl_add(avl, box(108), box(2397), NULL); - avl = gpr_avl_add(avl, box(918), box(2398), NULL); + avl = gpr_avl_add(avl, box(108), box(2397), nullptr); + avl = gpr_avl_add(avl, box(918), box(2398), nullptr); avl = remove_int(avl, 721); avl = remove_int(avl, 563); - avl = gpr_avl_add(avl, box(925), box(2401), NULL); + avl = gpr_avl_add(avl, box(925), box(2401), nullptr); avl = remove_int(avl, 448); avl = remove_int(avl, 198); avl = remove_int(avl, 1); - avl = gpr_avl_add(avl, box(160), box(2405), NULL); + avl = gpr_avl_add(avl, box(160), box(2405), nullptr); avl = remove_int(avl, 515); - avl = gpr_avl_add(avl, box(284), box(2407), NULL); - avl = gpr_avl_add(avl, box(225), box(2408), NULL); + avl = gpr_avl_add(avl, box(284), box(2407), nullptr); + avl = gpr_avl_add(avl, box(225), box(2408), nullptr); avl = remove_int(avl, 304); - avl = gpr_avl_add(avl, box(714), box(2410), NULL); - avl = gpr_avl_add(avl, box(708), box(2411), NULL); - avl = gpr_avl_add(avl, box(624), box(2412), NULL); + avl = gpr_avl_add(avl, box(714), box(2410), nullptr); + avl = gpr_avl_add(avl, box(708), box(2411), nullptr); + avl = gpr_avl_add(avl, box(624), box(2412), nullptr); avl = remove_int(avl, 662); avl = remove_int(avl, 825); avl = remove_int(avl, 383); avl = remove_int(avl, 381); - avl = gpr_avl_add(avl, box(194), box(2417), NULL); + avl = gpr_avl_add(avl, box(194), box(2417), nullptr); avl = remove_int(avl, 280); avl = remove_int(avl, 25); avl = remove_int(avl, 633); - avl = gpr_avl_add(avl, box(897), box(2421), NULL); + avl = gpr_avl_add(avl, box(897), box(2421), nullptr); avl = remove_int(avl, 636); avl = remove_int(avl, 596); avl = remove_int(avl, 757); @@ -3569,33 +3569,33 @@ static void test_badcase3(void) { avl = remove_int(avl, 843); avl = remove_int(avl, 280); avl = remove_int(avl, 911); - avl = gpr_avl_add(avl, box(1008), box(2431), NULL); + avl = gpr_avl_add(avl, box(1008), box(2431), nullptr); avl = remove_int(avl, 948); avl = remove_int(avl, 74); avl = remove_int(avl, 571); - avl = gpr_avl_add(avl, box(486), box(2435), NULL); - avl = gpr_avl_add(avl, box(285), box(2436), NULL); + avl = gpr_avl_add(avl, box(486), box(2435), nullptr); + avl = gpr_avl_add(avl, box(285), box(2436), nullptr); avl = remove_int(avl, 304); avl = remove_int(avl, 516); - avl = gpr_avl_add(avl, box(758), box(2439), NULL); - avl = gpr_avl_add(avl, box(776), box(2440), NULL); + avl = gpr_avl_add(avl, box(758), box(2439), nullptr); + avl = gpr_avl_add(avl, box(776), box(2440), nullptr); avl = remove_int(avl, 696); - avl = gpr_avl_add(avl, box(104), box(2442), NULL); - avl = gpr_avl_add(avl, box(700), box(2443), NULL); - avl = gpr_avl_add(avl, box(114), box(2444), NULL); - avl = gpr_avl_add(avl, box(567), box(2445), NULL); + avl = gpr_avl_add(avl, box(104), box(2442), nullptr); + avl = gpr_avl_add(avl, box(700), box(2443), nullptr); + avl = gpr_avl_add(avl, box(114), box(2444), nullptr); + avl = gpr_avl_add(avl, box(567), box(2445), nullptr); avl = remove_int(avl, 620); - avl = gpr_avl_add(avl, box(270), box(2447), NULL); + avl = gpr_avl_add(avl, box(270), box(2447), nullptr); avl = remove_int(avl, 730); - avl = gpr_avl_add(avl, box(749), box(2449), NULL); - avl = gpr_avl_add(avl, box(443), box(2450), NULL); + avl = gpr_avl_add(avl, box(749), box(2449), nullptr); + avl = gpr_avl_add(avl, box(443), box(2450), nullptr); avl = remove_int(avl, 457); - avl = gpr_avl_add(avl, box(571), box(2452), NULL); - avl = gpr_avl_add(avl, box(626), box(2453), NULL); + avl = gpr_avl_add(avl, box(571), box(2452), nullptr); + avl = gpr_avl_add(avl, box(626), box(2453), nullptr); avl = remove_int(avl, 638); avl = remove_int(avl, 313); - gpr_avl_unref(avl, NULL); + gpr_avl_unref(avl, nullptr); } static void test_stress(int amount_of_stress) { @@ -3604,11 +3604,11 @@ static void test_stress(int amount_of_stress) { int deletions = 0; gpr_avl avl; - unsigned seed = (unsigned)time(NULL); + unsigned seed = (unsigned)time(nullptr); gpr_log(GPR_DEBUG, "test_stress amount=%d seed=%u", amount_of_stress, seed); - srand((unsigned)time(NULL)); + srand((unsigned)time(nullptr)); avl = gpr_avl_create(&int_int_vtable); memset(added, 0, sizeof(added)); @@ -3620,7 +3620,7 @@ static void test_stress(int amount_of_stress) { added[idx] = i; printf("avl = gpr_avl_add(avl, box(%d), box(%d), NULL); /* d=%d */\n", idx, i, deletions); - avl = gpr_avl_add(avl, box(idx), box(i), NULL); + avl = gpr_avl_add(avl, box(idx), box(i), nullptr); } else { deletions += (added[idx] != 0); added[idx] = 0; @@ -3636,7 +3636,7 @@ static void test_stress(int amount_of_stress) { } } - gpr_avl_unref(avl, NULL); + gpr_avl_unref(avl, nullptr); } int main(int argc, char* argv[]) { diff --git a/test/core/support/cmdline_test.cc b/test/core/support/cmdline_test.cc index 5afaa2a60a3ed..172efda8a084b 100644 --- a/test/core/support/cmdline_test.cc +++ b/test/core/support/cmdline_test.cc @@ -35,8 +35,8 @@ static void test_simple_int(void) { LOG_TEST(); - cl = gpr_cmdline_create(NULL); - gpr_cmdline_add_int(cl, "foo", NULL, &x); + cl = gpr_cmdline_create(nullptr); + gpr_cmdline_add_int(cl, "foo", nullptr, &x); GPR_ASSERT(x == 1); gpr_cmdline_parse(cl, GPR_ARRAY_SIZE(args), args); GPR_ASSERT(x == 3); @@ -50,8 +50,8 @@ static void test_eq_int(void) { LOG_TEST(); - cl = gpr_cmdline_create(NULL); - gpr_cmdline_add_int(cl, "foo", NULL, &x); + cl = gpr_cmdline_create(nullptr); + gpr_cmdline_add_int(cl, "foo", nullptr, &x); GPR_ASSERT(x == 1); gpr_cmdline_parse(cl, GPR_ARRAY_SIZE(args), args); GPR_ASSERT(x == 3); @@ -66,8 +66,8 @@ static void test_2dash_int(void) { LOG_TEST(); - cl = gpr_cmdline_create(NULL); - gpr_cmdline_add_int(cl, "foo", NULL, &x); + cl = gpr_cmdline_create(nullptr); + gpr_cmdline_add_int(cl, "foo", nullptr, &x); GPR_ASSERT(x == 1); gpr_cmdline_parse(cl, GPR_ARRAY_SIZE(args), args); GPR_ASSERT(x == 3); @@ -81,8 +81,8 @@ static void test_2dash_eq_int(void) { LOG_TEST(); - cl = gpr_cmdline_create(NULL); - gpr_cmdline_add_int(cl, "foo", NULL, &x); + cl = gpr_cmdline_create(nullptr); + gpr_cmdline_add_int(cl, "foo", nullptr, &x); GPR_ASSERT(x == 1); gpr_cmdline_parse(cl, GPR_ARRAY_SIZE(args), args); GPR_ASSERT(x == 3); @@ -90,62 +90,62 @@ static void test_2dash_eq_int(void) { } static void test_simple_string(void) { - const char* x = NULL; + const char* x = nullptr; gpr_cmdline* cl; char* args[] = {(char*)__FILE__, const_cast("-foo"), const_cast("3")}; LOG_TEST(); - cl = gpr_cmdline_create(NULL); - gpr_cmdline_add_string(cl, "foo", NULL, &x); - GPR_ASSERT(x == NULL); + cl = gpr_cmdline_create(nullptr); + gpr_cmdline_add_string(cl, "foo", nullptr, &x); + GPR_ASSERT(x == nullptr); gpr_cmdline_parse(cl, GPR_ARRAY_SIZE(args), args); GPR_ASSERT(0 == strcmp(x, "3")); gpr_cmdline_destroy(cl); } static void test_eq_string(void) { - const char* x = NULL; + const char* x = nullptr; gpr_cmdline* cl; char* args[] = {(char*)__FILE__, const_cast("-foo=3")}; LOG_TEST(); - cl = gpr_cmdline_create(NULL); - gpr_cmdline_add_string(cl, "foo", NULL, &x); - GPR_ASSERT(x == NULL); + cl = gpr_cmdline_create(nullptr); + gpr_cmdline_add_string(cl, "foo", nullptr, &x); + GPR_ASSERT(x == nullptr); gpr_cmdline_parse(cl, GPR_ARRAY_SIZE(args), args); GPR_ASSERT(0 == strcmp(x, "3")); gpr_cmdline_destroy(cl); } static void test_2dash_string(void) { - const char* x = NULL; + const char* x = nullptr; gpr_cmdline* cl; char* args[] = {(char*)__FILE__, const_cast("--foo"), const_cast("3")}; LOG_TEST(); - cl = gpr_cmdline_create(NULL); - gpr_cmdline_add_string(cl, "foo", NULL, &x); - GPR_ASSERT(x == NULL); + cl = gpr_cmdline_create(nullptr); + gpr_cmdline_add_string(cl, "foo", nullptr, &x); + GPR_ASSERT(x == nullptr); gpr_cmdline_parse(cl, GPR_ARRAY_SIZE(args), args); GPR_ASSERT(0 == strcmp(x, "3")); gpr_cmdline_destroy(cl); } static void test_2dash_eq_string(void) { - const char* x = NULL; + const char* x = nullptr; gpr_cmdline* cl; char* args[] = {(char*)__FILE__, const_cast("--foo=3")}; LOG_TEST(); - cl = gpr_cmdline_create(NULL); - gpr_cmdline_add_string(cl, "foo", NULL, &x); - GPR_ASSERT(x == NULL); + cl = gpr_cmdline_create(nullptr); + gpr_cmdline_add_string(cl, "foo", nullptr, &x); + GPR_ASSERT(x == nullptr); gpr_cmdline_parse(cl, GPR_ARRAY_SIZE(args), args); GPR_ASSERT(0 == strcmp(x, "3")); gpr_cmdline_destroy(cl); @@ -158,8 +158,8 @@ static void test_flag_on(void) { LOG_TEST(); - cl = gpr_cmdline_create(NULL); - gpr_cmdline_add_flag(cl, "foo", NULL, &x); + cl = gpr_cmdline_create(nullptr); + gpr_cmdline_add_flag(cl, "foo", nullptr, &x); GPR_ASSERT(x == 2); gpr_cmdline_parse(cl, GPR_ARRAY_SIZE(args), args); GPR_ASSERT(x == 1); @@ -173,8 +173,8 @@ static void test_flag_no(void) { LOG_TEST(); - cl = gpr_cmdline_create(NULL); - gpr_cmdline_add_flag(cl, "foo", NULL, &x); + cl = gpr_cmdline_create(nullptr); + gpr_cmdline_add_flag(cl, "foo", nullptr, &x); GPR_ASSERT(x == 2); gpr_cmdline_parse(cl, GPR_ARRAY_SIZE(args), args); GPR_ASSERT(x == 0); @@ -188,8 +188,8 @@ static void test_flag_val_1(void) { LOG_TEST(); - cl = gpr_cmdline_create(NULL); - gpr_cmdline_add_flag(cl, "foo", NULL, &x); + cl = gpr_cmdline_create(nullptr); + gpr_cmdline_add_flag(cl, "foo", nullptr, &x); GPR_ASSERT(x == 2); gpr_cmdline_parse(cl, GPR_ARRAY_SIZE(args), args); GPR_ASSERT(x == 1); @@ -203,8 +203,8 @@ static void test_flag_val_0(void) { LOG_TEST(); - cl = gpr_cmdline_create(NULL); - gpr_cmdline_add_flag(cl, "foo", NULL, &x); + cl = gpr_cmdline_create(nullptr); + gpr_cmdline_add_flag(cl, "foo", nullptr, &x); GPR_ASSERT(x == 2); gpr_cmdline_parse(cl, GPR_ARRAY_SIZE(args), args); GPR_ASSERT(x == 0); @@ -218,8 +218,8 @@ static void test_flag_val_true(void) { LOG_TEST(); - cl = gpr_cmdline_create(NULL); - gpr_cmdline_add_flag(cl, "foo", NULL, &x); + cl = gpr_cmdline_create(nullptr); + gpr_cmdline_add_flag(cl, "foo", nullptr, &x); GPR_ASSERT(x == 2); gpr_cmdline_parse(cl, GPR_ARRAY_SIZE(args), args); GPR_ASSERT(x == 1); @@ -233,8 +233,8 @@ static void test_flag_val_false(void) { LOG_TEST(); - cl = gpr_cmdline_create(NULL); - gpr_cmdline_add_flag(cl, "foo", NULL, &x); + cl = gpr_cmdline_create(nullptr); + gpr_cmdline_add_flag(cl, "foo", nullptr, &x); GPR_ASSERT(x == 2); gpr_cmdline_parse(cl, GPR_ARRAY_SIZE(args), args); GPR_ASSERT(x == 0); @@ -242,7 +242,7 @@ static void test_flag_val_false(void) { } static void test_many(void) { - const char* str = NULL; + const char* str = nullptr; int x = 0; int flag = 2; gpr_cmdline* cl; @@ -253,10 +253,10 @@ static void test_many(void) { LOG_TEST(); - cl = gpr_cmdline_create(NULL); - gpr_cmdline_add_string(cl, "str", NULL, &str); - gpr_cmdline_add_int(cl, "x", NULL, &x); - gpr_cmdline_add_flag(cl, "flag", NULL, &flag); + cl = gpr_cmdline_create(nullptr); + gpr_cmdline_add_string(cl, "str", nullptr, &str); + gpr_cmdline_add_int(cl, "x", nullptr, &x); + gpr_cmdline_add_flag(cl, "flag", nullptr, &flag); gpr_cmdline_parse(cl, GPR_ARRAY_SIZE(args), args); GPR_ASSERT(x == 4); GPR_ASSERT(0 == strcmp(str, "hello")); @@ -266,7 +266,7 @@ static void test_many(void) { static void extra_arg_cb(void* user_data, const char* arg) { int* count = static_cast(user_data); - GPR_ASSERT(arg != NULL); + GPR_ASSERT(arg != nullptr); GPR_ASSERT(strlen(arg) == 1); GPR_ASSERT(arg[0] == 'a' + *count); ++*count; @@ -280,7 +280,7 @@ static void test_extra(void) { LOG_TEST(); - cl = gpr_cmdline_create(NULL); + cl = gpr_cmdline_create(nullptr); gpr_cmdline_on_extra_arg(cl, "file", "filenames to process", extra_arg_cb, &count); gpr_cmdline_parse(cl, GPR_ARRAY_SIZE(args), args); @@ -297,7 +297,7 @@ static void test_extra_dashdash(void) { LOG_TEST(); - cl = gpr_cmdline_create(NULL); + cl = gpr_cmdline_create(nullptr); gpr_cmdline_on_extra_arg(cl, "file", "filenames to process", extra_arg_cb, &count); gpr_cmdline_parse(cl, GPR_ARRAY_SIZE(args), args); @@ -309,18 +309,18 @@ static void test_usage(void) { gpr_cmdline* cl; char* usage; - const char* str = NULL; + const char* str = nullptr; int x = 0; int flag = 2; LOG_TEST(); - cl = gpr_cmdline_create(NULL); - gpr_cmdline_add_string(cl, "str", NULL, &str); - gpr_cmdline_add_int(cl, "x", NULL, &x); - gpr_cmdline_add_flag(cl, "flag", NULL, &flag); + cl = gpr_cmdline_create(nullptr); + gpr_cmdline_add_string(cl, "str", nullptr, &str); + gpr_cmdline_add_int(cl, "x", nullptr, &x); + gpr_cmdline_add_flag(cl, "flag", nullptr, &flag); gpr_cmdline_on_extra_arg(cl, "file", "filenames to process", extra_arg_cb, - NULL); + nullptr); usage = gpr_cmdline_usage_string(cl, "test"); GPR_ASSERT(0 == strcmp(usage, @@ -340,7 +340,7 @@ static void test_usage(void) { static void test_help(void) { gpr_cmdline* cl; - const char* str = NULL; + const char* str = nullptr; int x = 0; int flag = 2; @@ -348,13 +348,13 @@ static void test_help(void) { LOG_TEST(); - cl = gpr_cmdline_create(NULL); + cl = gpr_cmdline_create(nullptr); gpr_cmdline_set_survive_failure(cl); - gpr_cmdline_add_string(cl, "str", NULL, &str); - gpr_cmdline_add_int(cl, "x", NULL, &x); - gpr_cmdline_add_flag(cl, "flag", NULL, &flag); + gpr_cmdline_add_string(cl, "str", nullptr, &str); + gpr_cmdline_add_int(cl, "x", nullptr, &x); + gpr_cmdline_add_flag(cl, "flag", nullptr, &flag); gpr_cmdline_on_extra_arg(cl, "file", "filenames to process", extra_arg_cb, - NULL); + nullptr); GPR_ASSERT(0 == gpr_cmdline_parse(cl, GPR_ARRAY_SIZE(help), help)); @@ -364,7 +364,7 @@ static void test_help(void) { static void test_badargs1(void) { gpr_cmdline* cl; - const char* str = NULL; + const char* str = nullptr; int x = 0; int flag = 2; @@ -372,13 +372,13 @@ static void test_badargs1(void) { LOG_TEST(); - cl = gpr_cmdline_create(NULL); + cl = gpr_cmdline_create(nullptr); gpr_cmdline_set_survive_failure(cl); - gpr_cmdline_add_string(cl, "str", NULL, &str); - gpr_cmdline_add_int(cl, "x", NULL, &x); - gpr_cmdline_add_flag(cl, "flag", NULL, &flag); + gpr_cmdline_add_string(cl, "str", nullptr, &str); + gpr_cmdline_add_int(cl, "x", nullptr, &x); + gpr_cmdline_add_flag(cl, "flag", nullptr, &flag); gpr_cmdline_on_extra_arg(cl, "file", "filenames to process", extra_arg_cb, - NULL); + nullptr); GPR_ASSERT(0 == gpr_cmdline_parse(cl, GPR_ARRAY_SIZE(bad_arg_name), bad_arg_name)); @@ -389,7 +389,7 @@ static void test_badargs1(void) { static void test_badargs2(void) { gpr_cmdline* cl; - const char* str = NULL; + const char* str = nullptr; int x = 0; int flag = 2; @@ -398,13 +398,13 @@ static void test_badargs2(void) { LOG_TEST(); - cl = gpr_cmdline_create(NULL); + cl = gpr_cmdline_create(nullptr); gpr_cmdline_set_survive_failure(cl); - gpr_cmdline_add_string(cl, "str", NULL, &str); - gpr_cmdline_add_int(cl, "x", NULL, &x); - gpr_cmdline_add_flag(cl, "flag", NULL, &flag); + gpr_cmdline_add_string(cl, "str", nullptr, &str); + gpr_cmdline_add_int(cl, "x", nullptr, &x); + gpr_cmdline_add_flag(cl, "flag", nullptr, &flag); gpr_cmdline_on_extra_arg(cl, "file", "filenames to process", extra_arg_cb, - NULL); + nullptr); GPR_ASSERT( 0 == gpr_cmdline_parse(cl, GPR_ARRAY_SIZE(bad_int_value), bad_int_value)); @@ -415,7 +415,7 @@ static void test_badargs2(void) { static void test_badargs3(void) { gpr_cmdline* cl; - const char* str = NULL; + const char* str = nullptr; int x = 0; int flag = 2; @@ -423,13 +423,13 @@ static void test_badargs3(void) { LOG_TEST(); - cl = gpr_cmdline_create(NULL); + cl = gpr_cmdline_create(nullptr); gpr_cmdline_set_survive_failure(cl); - gpr_cmdline_add_string(cl, "str", NULL, &str); - gpr_cmdline_add_int(cl, "x", NULL, &x); - gpr_cmdline_add_flag(cl, "flag", NULL, &flag); + gpr_cmdline_add_string(cl, "str", nullptr, &str); + gpr_cmdline_add_int(cl, "x", nullptr, &x); + gpr_cmdline_add_flag(cl, "flag", nullptr, &flag); gpr_cmdline_on_extra_arg(cl, "file", "filenames to process", extra_arg_cb, - NULL); + nullptr); GPR_ASSERT(0 == gpr_cmdline_parse(cl, GPR_ARRAY_SIZE(bad_bool_value), bad_bool_value)); @@ -440,7 +440,7 @@ static void test_badargs3(void) { static void test_badargs4(void) { gpr_cmdline* cl; - const char* str = NULL; + const char* str = nullptr; int x = 0; int flag = 2; @@ -448,13 +448,13 @@ static void test_badargs4(void) { LOG_TEST(); - cl = gpr_cmdline_create(NULL); + cl = gpr_cmdline_create(nullptr); gpr_cmdline_set_survive_failure(cl); - gpr_cmdline_add_string(cl, "str", NULL, &str); - gpr_cmdline_add_int(cl, "x", NULL, &x); - gpr_cmdline_add_flag(cl, "flag", NULL, &flag); + gpr_cmdline_add_string(cl, "str", nullptr, &str); + gpr_cmdline_add_int(cl, "x", nullptr, &x); + gpr_cmdline_add_flag(cl, "flag", nullptr, &flag); gpr_cmdline_on_extra_arg(cl, "file", "filenames to process", extra_arg_cb, - NULL); + nullptr); GPR_ASSERT(0 == gpr_cmdline_parse(cl, GPR_ARRAY_SIZE(bad_bool_value), bad_bool_value)); diff --git a/test/core/support/cpu_test.cc b/test/core/support/cpu_test.cc index c69ce55a730ad..1783ec3c60aa9 100644 --- a/test/core/support/cpu_test.cc +++ b/test/core/support/cpu_test.cc @@ -110,7 +110,7 @@ static void cpu_test(void) { gpr_cv_init(&ct.done_cv); ct.is_done = 0; for (i = 0; i < ct.ncores * 3; i++) { - GPR_ASSERT(gpr_thd_new(&thd, &worker_thread, &ct, NULL)); + GPR_ASSERT(gpr_thd_new(&thd, &worker_thread, &ct, nullptr)); } gpr_mu_lock(&ct.mu); while (!ct.is_done) { diff --git a/test/core/support/env_test.cc b/test/core/support/env_test.cc index 54009536b484d..b12c04d06fbe2 100644 --- a/test/core/support/env_test.cc +++ b/test/core/support/env_test.cc @@ -37,7 +37,7 @@ static void test_setenv_getenv(void) { gpr_setenv(name, value); retrieved_value = gpr_getenv(name); - GPR_ASSERT(retrieved_value != NULL); + GPR_ASSERT(retrieved_value != nullptr); GPR_ASSERT(strcmp(value, retrieved_value) == 0); gpr_free(retrieved_value); } diff --git a/test/core/support/log_test.cc b/test/core/support/log_test.cc index 9602bbb09079f..7dba35c13ee6a 100644 --- a/test/core/support/log_test.cc +++ b/test/core/support/log_test.cc @@ -63,7 +63,7 @@ int main(int argc, char** argv) { gpr_set_log_function(test_callback); gpr_log_message(GPR_INFO, "hello 1 2 3"); gpr_log(GPR_INFO, "hello %d %d %d", 1, 2, 3); - gpr_set_log_function(NULL); + gpr_set_log_function(nullptr); /* gpr_log_verbosity_init() will be effective only once, and only before * gpr_set_log_verbosity() is called */ diff --git a/test/core/support/mpscq_test.cc b/test/core/support/mpscq_test.cc index d5b7bf21c1b40..50ff8174f6969 100644 --- a/test/core/support/mpscq_test.cc +++ b/test/core/support/mpscq_test.cc @@ -45,7 +45,7 @@ static void test_serial(void) { gpr_mpscq q; gpr_mpscq_init(&q); for (size_t i = 0; i < 10000000; i++) { - gpr_mpscq_push(&q, &new_node(i, NULL)->node); + gpr_mpscq_push(&q, &new_node(i, nullptr)->node); } for (size_t i = 0; i < 10000000; i++) { test_node* n = (test_node*)gpr_mpscq_pop(&q); @@ -92,7 +92,7 @@ static void test_mt(void) { gpr_event_set(&start, (void*)1); while (num_done != GPR_ARRAY_SIZE(thds)) { gpr_mpscq_node* n; - while ((n = gpr_mpscq_pop(&q)) == NULL) { + while ((n = gpr_mpscq_pop(&q)) == nullptr) { spins++; } test_node* tn = (test_node*)n; @@ -129,7 +129,7 @@ static void pull_thread(void* arg) { return; } gpr_mpscq_node* n; - while ((n = gpr_mpscq_pop(pa->q)) == NULL) { + while ((n = gpr_mpscq_pop(pa->q)) == nullptr) { pa->spins++; } test_node* tn = (test_node*)n; diff --git a/test/core/support/string_test.cc b/test/core/support/string_test.cc index 4bae158a15772..fd7f7cde59e6a 100644 --- a/test/core/support/string_test.cc +++ b/test/core/support/string_test.cc @@ -41,7 +41,7 @@ static void test_strdup(void) { GPR_ASSERT(0 == strcmp(src1, dst1)); gpr_free(dst1); - GPR_ASSERT(NULL == gpr_strdup(NULL)); + GPR_ASSERT(nullptr == gpr_strdup(nullptr)); } static void expect_dump(const char* buf, size_t len, uint32_t flags, @@ -271,9 +271,9 @@ static void test_stricmp(void) { static void test_memrchr(void) { LOG_TEST_NAME("test_memrchr"); - GPR_ASSERT(NULL == gpr_memrchr(NULL, 'a', 0)); - GPR_ASSERT(NULL == gpr_memrchr("", 'a', 0)); - GPR_ASSERT(NULL == gpr_memrchr("hello", 'b', 5)); + GPR_ASSERT(nullptr == gpr_memrchr(nullptr, 'a', 0)); + GPR_ASSERT(nullptr == gpr_memrchr("", 'a', 0)); + GPR_ASSERT(nullptr == gpr_memrchr("hello", 'b', 5)); GPR_ASSERT(0 == strcmp((const char*)gpr_memrchr("hello", 'h', 5), "hello")); GPR_ASSERT(0 == strcmp((const char*)gpr_memrchr("hello", 'o', 5), "o")); GPR_ASSERT(0 == strcmp((const char*)gpr_memrchr("hello", 'l', 5), "lo")); @@ -289,7 +289,7 @@ static void test_is_true(void) { GPR_ASSERT(true == gpr_is_true("yes")); GPR_ASSERT(true == gpr_is_true("YES")); GPR_ASSERT(true == gpr_is_true("1")); - GPR_ASSERT(false == gpr_is_true(NULL)); + GPR_ASSERT(false == gpr_is_true(nullptr)); GPR_ASSERT(false == gpr_is_true("")); GPR_ASSERT(false == gpr_is_true("0")); } diff --git a/test/core/support/sync_test.cc b/test/core/support/sync_test.cc index 416e94d06de2a..86e78ce0b5157 100644 --- a/test/core/support/sync_test.cc +++ b/test/core/support/sync_test.cc @@ -189,7 +189,7 @@ static void test_create_threads(struct test* m, void (*body)(void* arg)) { gpr_thd_id id; int i; for (i = 0; i != m->threads; i++) { - GPR_ASSERT(gpr_thd_new(&id, body, m, NULL)); + GPR_ASSERT(gpr_thd_new(&id, body, m, nullptr)); } } @@ -242,9 +242,9 @@ static void test(const char* name, void (*body)(void* m), iterations <<= 1; fprintf(stderr, " %ld", (long)iterations); m = test_new(10, iterations, incr_step); - if (extra != NULL) { + if (extra != nullptr) { gpr_thd_id id; - GPR_ASSERT(gpr_thd_new(&id, extra, m, NULL)); + GPR_ASSERT(gpr_thd_new(&id, extra, m, nullptr)); m->done++; /* one more thread to wait for */ } test_create_threads(m, body); @@ -333,7 +333,7 @@ static void inc_with_1ms_delay_event(void* v /*=m*/) { gpr_timespec deadline; deadline = gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), gpr_time_from_micros(1000, GPR_TIMESPAN)); - GPR_ASSERT(gpr_event_wait(&m->event, deadline) == NULL); + GPR_ASSERT(gpr_event_wait(&m->event, deadline) == nullptr); gpr_mu_lock(&m->mu); m->counter++; gpr_mu_unlock(&m->mu); @@ -438,16 +438,16 @@ static void refcheck(void* v /*=m*/) { int main(int argc, char* argv[]) { grpc_test_init(argc, argv); - test("mutex", &inc, NULL, 1, 1); - test("mutex try", &inctry, NULL, 1, 1); - test("cv", &inc_by_turns, NULL, 1, 1); - test("timedcv", &inc_with_1ms_delay, NULL, 1, 1); + test("mutex", &inc, nullptr, 1, 1); + test("mutex try", &inctry, nullptr, 1, 1); + test("cv", &inc_by_turns, nullptr, 1, 1); + test("timedcv", &inc_with_1ms_delay, nullptr, 1, 1); test("queue", &many_producers, &consumer, 10, 1); - test("stats_counter", &statsinc, NULL, 1, 1); + test("stats_counter", &statsinc, nullptr, 1, 1); test("refcount by 1", &refinc, &refcheck, 1, 1); test("refcount by 3", &refinc, &refcheck, 1, 3); /* incr_step of 3 is an arbitrary choice. Any number > 1 is okay here */ - test("timedevent", &inc_with_1ms_delay_event, NULL, 1, 1); + test("timedevent", &inc_with_1ms_delay_event, nullptr, 1, 1); return 0; } diff --git a/test/core/support/thd_test.cc b/test/core/support/thd_test.cc index f70a3b4fe2425..34befd80d18da 100644 --- a/test/core/support/thd_test.cc +++ b/test/core/support/thd_test.cc @@ -74,7 +74,7 @@ static void test(void) { t.n = NUM_THREADS; t.is_done = 0; for (i = 0; i < NUM_THREADS; i++) { - GPR_ASSERT(gpr_thd_new(&thd, &thd_body, &t, NULL)); + GPR_ASSERT(gpr_thd_new(&thd, &thd_body, &t, nullptr)); } gpr_mu_lock(&t.mu); while (!t.is_done) { @@ -84,7 +84,7 @@ static void test(void) { GPR_ASSERT(t.n == 0); gpr_thd_options_set_joinable(&options); for (i = 0; i < NUM_THREADS; i++) { - GPR_ASSERT(gpr_thd_new(&thds[i], &thd_body_joinable, NULL, &options)); + GPR_ASSERT(gpr_thd_new(&thds[i], &thd_body_joinable, nullptr, &options)); } for (i = 0; i < NUM_THREADS; i++) { gpr_thd_join(thds[i]); diff --git a/test/core/support/tls_test.cc b/test/core/support/tls_test.cc index b1b4737432d25..0f64d2ee7c883 100644 --- a/test/core/support/tls_test.cc +++ b/test/core/support/tls_test.cc @@ -56,7 +56,7 @@ int main(int argc, char* argv[]) { gpr_thd_options_set_joinable(&opt); for (i = 0; i < NUM_THREADS; i++) { - gpr_thd_new(&threads[i], thd_body, NULL, &opt); + gpr_thd_new(&threads[i], thd_body, nullptr, &opt); } for (i = 0; i < NUM_THREADS; i++) { gpr_thd_join(threads[i]); diff --git a/test/core/surface/alarm_test.cc b/test/core/surface/alarm_test.cc index 88b0b31478e3a..6865d2add9c10 100644 --- a/test/core/surface/alarm_test.cc +++ b/test/core/surface/alarm_test.cc @@ -34,7 +34,7 @@ static void* create_test_tag(void) { static void shutdown_and_destroy(grpc_completion_queue* cc) { grpc_event ev; grpc_completion_queue_shutdown(cc); - ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), NULL); + ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), nullptr); GPR_ASSERT(ev.type == GRPC_QUEUE_SHUTDOWN); grpc_completion_queue_destroy(cc); } @@ -43,54 +43,54 @@ static void test_alarm(void) { grpc_completion_queue* cc; LOG_TEST("test_alarm"); - cc = grpc_completion_queue_create_for_next(NULL); + cc = grpc_completion_queue_create_for_next(nullptr); { /* regular expiry */ grpc_event ev; void* tag = create_test_tag(); - grpc_alarm* alarm = grpc_alarm_create(NULL); - grpc_alarm_set(alarm, cc, grpc_timeout_seconds_to_deadline(1), tag, NULL); + grpc_alarm* alarm = grpc_alarm_create(nullptr); + grpc_alarm_set(alarm, cc, grpc_timeout_seconds_to_deadline(1), tag, nullptr); ev = grpc_completion_queue_next(cc, grpc_timeout_seconds_to_deadline(2), - NULL); + nullptr); GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); GPR_ASSERT(ev.tag == tag); GPR_ASSERT(ev.success); - grpc_alarm_destroy(alarm, NULL); + grpc_alarm_destroy(alarm, nullptr); } { /* cancellation */ grpc_event ev; void* tag = create_test_tag(); - grpc_alarm* alarm = grpc_alarm_create(NULL); - grpc_alarm_set(alarm, cc, grpc_timeout_seconds_to_deadline(2), tag, NULL); + grpc_alarm* alarm = grpc_alarm_create(nullptr); + grpc_alarm_set(alarm, cc, grpc_timeout_seconds_to_deadline(2), tag, nullptr); - grpc_alarm_cancel(alarm, NULL); + grpc_alarm_cancel(alarm, nullptr); ev = grpc_completion_queue_next(cc, grpc_timeout_seconds_to_deadline(1), - NULL); + nullptr); GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); GPR_ASSERT(ev.tag == tag); GPR_ASSERT(ev.success == 0); - grpc_alarm_destroy(alarm, NULL); + grpc_alarm_destroy(alarm, nullptr); } { /* alarm_destroy before cq_next */ grpc_event ev; void* tag = create_test_tag(); - grpc_alarm* alarm = grpc_alarm_create(NULL); - grpc_alarm_set(alarm, cc, grpc_timeout_seconds_to_deadline(2), tag, NULL); + grpc_alarm* alarm = grpc_alarm_create(nullptr); + grpc_alarm_set(alarm, cc, grpc_timeout_seconds_to_deadline(2), tag, nullptr); - grpc_alarm_destroy(alarm, NULL); + grpc_alarm_destroy(alarm, nullptr); ev = grpc_completion_queue_next(cc, grpc_timeout_seconds_to_deadline(1), - NULL); + nullptr); GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); GPR_ASSERT(ev.tag == tag); GPR_ASSERT(ev.success == 0); } { /* alarm_destroy before set */ - grpc_alarm* alarm = grpc_alarm_create(NULL); - grpc_alarm_destroy(alarm, NULL); + grpc_alarm* alarm = grpc_alarm_create(nullptr); + grpc_alarm_destroy(alarm, nullptr); } shutdown_and_destroy(cc); diff --git a/test/core/surface/channel_create_test.cc b/test/core/surface/channel_create_test.cc index 4627c5743810e..f358b0fc8d40d 100644 --- a/test/core/surface/channel_create_test.cc +++ b/test/core/surface/channel_create_test.cc @@ -32,8 +32,8 @@ void test_unknown_scheme_target(void) { grpc_resolver_registry_shutdown(); grpc_resolver_registry_init(); - chan = grpc_insecure_channel_create("blah://blah", NULL, NULL); - GPR_ASSERT(chan != NULL); + chan = grpc_insecure_channel_create("blah://blah", nullptr, nullptr); + GPR_ASSERT(chan != nullptr); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_channel_element* elem = diff --git a/test/core/surface/completion_queue_test.cc b/test/core/surface/completion_queue_test.cc index 277ffde553982..e70fe5fec1be5 100644 --- a/test/core/surface/completion_queue_test.cc +++ b/test/core/surface/completion_queue_test.cc @@ -40,12 +40,12 @@ static void shutdown_and_destroy(grpc_completion_queue* cc) { switch (grpc_get_cq_completion_type(cc)) { case GRPC_CQ_NEXT: { ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), - NULL); + nullptr); break; } case GRPC_CQ_PLUCK: { ev = grpc_completion_queue_pluck(cc, create_test_tag(), - gpr_inf_past(GPR_CLOCK_REALTIME), NULL); + gpr_inf_past(GPR_CLOCK_REALTIME), nullptr); break; } default: { @@ -72,7 +72,7 @@ static void test_no_op(void) { attr.cq_completion_type = completion_types[i]; attr.cq_polling_type = polling_types[j]; shutdown_and_destroy(grpc_completion_queue_create( - grpc_completion_queue_factory_lookup(&attr), &attr, NULL)); + grpc_completion_queue_factory_lookup(&attr), &attr, nullptr)); } } } @@ -92,8 +92,8 @@ static void test_pollset_conversion(void) { attr.cq_completion_type = completion_types[i]; attr.cq_polling_type = polling_types[j]; cq = grpc_completion_queue_create( - grpc_completion_queue_factory_lookup(&attr), &attr, NULL); - GPR_ASSERT(grpc_cq_pollset(cq) != NULL); + grpc_completion_queue_factory_lookup(&attr), &attr, nullptr); + GPR_ASSERT(grpc_cq_pollset(cq) != nullptr); shutdown_and_destroy(cq); } } @@ -113,8 +113,8 @@ static void test_wait_empty(void) { for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) { attr.cq_polling_type = polling_types[i]; cc = grpc_completion_queue_create( - grpc_completion_queue_factory_lookup(&attr), &attr, NULL); - event = grpc_completion_queue_next(cc, gpr_now(GPR_CLOCK_REALTIME), NULL); + grpc_completion_queue_factory_lookup(&attr), &attr, nullptr); + event = grpc_completion_queue_next(cc, gpr_now(GPR_CLOCK_REALTIME), nullptr); GPR_ASSERT(event.type == GRPC_QUEUE_TIMEOUT); shutdown_and_destroy(cc); } @@ -142,13 +142,13 @@ static void test_cq_end_op(void) { exec_ctx = init_exec_ctx; // Reset exec_ctx attr.cq_polling_type = polling_types[i]; cc = grpc_completion_queue_create( - grpc_completion_queue_factory_lookup(&attr), &attr, NULL); + grpc_completion_queue_factory_lookup(&attr), &attr, nullptr); GPR_ASSERT(grpc_cq_begin_op(cc, tag)); grpc_cq_end_op(&exec_ctx, cc, tag, GRPC_ERROR_NONE, - do_nothing_end_completion, NULL, &completion); + do_nothing_end_completion, nullptr, &completion); - ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), NULL); + ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), nullptr); GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); GPR_ASSERT(ev.tag == tag); GPR_ASSERT(ev.success); @@ -179,14 +179,14 @@ static void test_cq_tls_cache_full(void) { exec_ctx = init_exec_ctx; // Reset exec_ctx attr.cq_polling_type = polling_types[i]; cc = grpc_completion_queue_create( - grpc_completion_queue_factory_lookup(&attr), &attr, NULL); + grpc_completion_queue_factory_lookup(&attr), &attr, nullptr); grpc_completion_queue_thread_local_cache_init(cc); GPR_ASSERT(grpc_cq_begin_op(cc, tag)); grpc_cq_end_op(&exec_ctx, cc, tag, GRPC_ERROR_NONE, - do_nothing_end_completion, NULL, &completion); + do_nothing_end_completion, nullptr, &completion); - ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), NULL); + ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), nullptr); GPR_ASSERT(ev.type == GRPC_QUEUE_TIMEOUT); GPR_ASSERT( @@ -194,7 +194,7 @@ static void test_cq_tls_cache_full(void) { GPR_ASSERT(res_tag == tag); GPR_ASSERT(ok); - ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), NULL); + ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), nullptr); GPR_ASSERT(ev.type == GRPC_QUEUE_TIMEOUT); shutdown_and_destroy(cc); @@ -220,7 +220,7 @@ static void test_cq_tls_cache_empty(void) { exec_ctx = init_exec_ctx; // Reset exec_ctx attr.cq_polling_type = polling_types[i]; cc = grpc_completion_queue_create( - grpc_completion_queue_factory_lookup(&attr), &attr, NULL); + grpc_completion_queue_factory_lookup(&attr), &attr, nullptr); GPR_ASSERT( grpc_completion_queue_thread_local_cache_flush(cc, &res_tag, &ok) == 0); @@ -245,10 +245,10 @@ static void test_shutdown_then_next_polling(void) { for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) { attr.cq_polling_type = polling_types[i]; cc = grpc_completion_queue_create( - grpc_completion_queue_factory_lookup(&attr), &attr, NULL); + grpc_completion_queue_factory_lookup(&attr), &attr, nullptr); grpc_completion_queue_shutdown(cc); event = - grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), NULL); + grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), nullptr); GPR_ASSERT(event.type == GRPC_QUEUE_SHUTDOWN); grpc_completion_queue_destroy(cc); } @@ -267,11 +267,11 @@ static void test_shutdown_then_next_with_timeout(void) { for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) { attr.cq_polling_type = polling_types[i]; cc = grpc_completion_queue_create( - grpc_completion_queue_factory_lookup(&attr), &attr, NULL); + grpc_completion_queue_factory_lookup(&attr), &attr, nullptr); grpc_completion_queue_shutdown(cc); event = grpc_completion_queue_next(cc, gpr_inf_future(GPR_CLOCK_REALTIME), - NULL); + nullptr); GPR_ASSERT(event.type == GRPC_QUEUE_SHUTDOWN); grpc_completion_queue_destroy(cc); } @@ -304,29 +304,29 @@ static void test_pluck(void) { exec_ctx = init_exec_ctx; // reset exec_ctx attr.cq_polling_type = polling_types[pidx]; cc = grpc_completion_queue_create( - grpc_completion_queue_factory_lookup(&attr), &attr, NULL); + grpc_completion_queue_factory_lookup(&attr), &attr, nullptr); for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) { GPR_ASSERT(grpc_cq_begin_op(cc, tags[i])); grpc_cq_end_op(&exec_ctx, cc, tags[i], GRPC_ERROR_NONE, - do_nothing_end_completion, NULL, &completions[i]); + do_nothing_end_completion, nullptr, &completions[i]); } for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) { ev = grpc_completion_queue_pluck(cc, tags[i], - gpr_inf_past(GPR_CLOCK_REALTIME), NULL); + gpr_inf_past(GPR_CLOCK_REALTIME), nullptr); GPR_ASSERT(ev.tag == tags[i]); } for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) { GPR_ASSERT(grpc_cq_begin_op(cc, tags[i])); grpc_cq_end_op(&exec_ctx, cc, tags[i], GRPC_ERROR_NONE, - do_nothing_end_completion, NULL, &completions[i]); + do_nothing_end_completion, nullptr, &completions[i]); } for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) { ev = grpc_completion_queue_pluck(cc, tags[GPR_ARRAY_SIZE(tags) - i - 1], - gpr_inf_past(GPR_CLOCK_REALTIME), NULL); + gpr_inf_past(GPR_CLOCK_REALTIME), nullptr); GPR_ASSERT(ev.tag == tags[GPR_ARRAY_SIZE(tags) - i - 1]); } @@ -349,10 +349,10 @@ static void test_pluck_after_shutdown(void) { for (size_t i = 0; i < GPR_ARRAY_SIZE(polling_types); i++) { attr.cq_polling_type = polling_types[i]; cc = grpc_completion_queue_create( - grpc_completion_queue_factory_lookup(&attr), &attr, NULL); + grpc_completion_queue_factory_lookup(&attr), &attr, nullptr); grpc_completion_queue_shutdown(cc); - ev = grpc_completion_queue_pluck(cc, NULL, - gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + ev = grpc_completion_queue_pluck(cc, nullptr, + gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); GPR_ASSERT(ev.type == GRPC_QUEUE_SHUTDOWN); grpc_completion_queue_destroy(cc); } diff --git a/test/core/surface/completion_queue_threading_test.cc b/test/core/surface/completion_queue_threading_test.cc index 043c5c161708e..457f96e95c626 100644 --- a/test/core/surface/completion_queue_threading_test.cc +++ b/test/core/surface/completion_queue_threading_test.cc @@ -41,12 +41,12 @@ static void shutdown_and_destroy(grpc_completion_queue* cc) { switch (grpc_get_cq_completion_type(cc)) { case GRPC_CQ_NEXT: { ev = grpc_completion_queue_next(cc, gpr_inf_past(GPR_CLOCK_REALTIME), - NULL); + nullptr); break; } case GRPC_CQ_PLUCK: { ev = grpc_completion_queue_pluck(cc, create_test_tag(), - gpr_inf_past(GPR_CLOCK_REALTIME), NULL); + gpr_inf_past(GPR_CLOCK_REALTIME), nullptr); break; } default: { @@ -70,7 +70,7 @@ struct thread_state { static void pluck_one(void* arg) { struct thread_state* state = static_cast(arg); grpc_completion_queue_pluck(state->cc, state->tag, - gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); } static void test_too_many_plucks(void) { @@ -86,7 +86,7 @@ static void test_too_many_plucks(void) { LOG_TEST("test_too_many_plucks"); - cc = grpc_completion_queue_create_for_pluck(NULL); + cc = grpc_completion_queue_create_for_pluck(nullptr); gpr_thd_options_set_joinable(&thread_options); for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) { @@ -103,13 +103,13 @@ static void test_too_many_plucks(void) { gpr_sleep_until(grpc_timeout_milliseconds_to_deadline(1000)); ev = grpc_completion_queue_pluck(cc, create_test_tag(), - gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); GPR_ASSERT(ev.type == GRPC_QUEUE_TIMEOUT); for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) { GPR_ASSERT(grpc_cq_begin_op(cc, tags[i])); grpc_cq_end_op(&exec_ctx, cc, tags[i], GRPC_ERROR_NONE, - do_nothing_end_completion, NULL, &completions[i]); + do_nothing_end_completion, nullptr, &completions[i]); } for (i = 0; i < GPR_ARRAY_SIZE(tags); i++) { @@ -163,7 +163,7 @@ static void producer_thread(void* arg) { gpr_log(GPR_INFO, "producer %d phase 2", opt->id); for (i = 0; i < TEST_THREAD_EVENTS; i++) { grpc_cq_end_op(&exec_ctx, opt->cc, (void*)(intptr_t)1, GRPC_ERROR_NONE, - free_completion, NULL, + free_completion, nullptr, static_cast( gpr_malloc(sizeof(grpc_cq_completion)))); opt->events_triggered++; @@ -192,7 +192,7 @@ static void consumer_thread(void* arg) { gpr_log(GPR_INFO, "consumer %d phase 2", opt->id); for (;;) { ev = grpc_completion_queue_next(opt->cc, - gpr_inf_future(GPR_CLOCK_MONOTONIC), NULL); + gpr_inf_future(GPR_CLOCK_MONOTONIC), nullptr); switch (ev.type) { case GRPC_OP_COMPLETE: GPR_ASSERT(ev.success); @@ -214,7 +214,7 @@ static void test_threading(size_t producers, size_t consumers) { gpr_malloc((producers + consumers) * sizeof(test_thread_options))); gpr_event phase1 = GPR_EVENT_INIT; gpr_event phase2 = GPR_EVENT_INIT; - grpc_completion_queue* cc = grpc_completion_queue_create_for_next(NULL); + grpc_completion_queue* cc = grpc_completion_queue_create_for_next(nullptr); size_t i; size_t total_consumed = 0; static int optid = 101; @@ -235,7 +235,7 @@ static void test_threading(size_t producers, size_t consumers) { options[i].id = optid++; GPR_ASSERT(gpr_thd_new(&id, i < producers ? producer_thread : consumer_thread, - options + i, NULL)); + options + i, nullptr)); gpr_event_wait(&options[i].on_started, ten_seconds_time()); } diff --git a/test/core/surface/concurrent_connectivity_test.cc b/test/core/surface/concurrent_connectivity_test.cc index 6f6a71e6f5759..d1f5bf10720af 100644 --- a/test/core/surface/concurrent_connectivity_test.cc +++ b/test/core/surface/concurrent_connectivity_test.cc @@ -59,18 +59,18 @@ static int detag(void* p) { return (int)(uintptr_t)p; } void create_loop_destroy(void* addr) { for (int i = 0; i < NUM_OUTER_LOOPS; ++i) { - grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL); - grpc_channel* chan = grpc_insecure_channel_create((char*)addr, NULL, NULL); + grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr); + grpc_channel* chan = grpc_insecure_channel_create((char*)addr, nullptr, nullptr); for (int j = 0; j < NUM_INNER_LOOPS; ++j) { gpr_timespec later_time = grpc_timeout_milliseconds_to_deadline(DELAY_MILLIS); grpc_connectivity_state state = grpc_channel_check_connectivity_state(chan, 1); - grpc_channel_watch_connectivity_state(chan, state, later_time, cq, NULL); + grpc_channel_watch_connectivity_state(chan, state, later_time, cq, nullptr); gpr_timespec poll_time = grpc_timeout_milliseconds_to_deadline(POLL_MILLIS); - GPR_ASSERT(grpc_completion_queue_next(cq, poll_time, NULL).type == + GPR_ASSERT(grpc_completion_queue_next(cq, poll_time, nullptr).type == GRPC_OP_COMPLETE); /* check that the watcher from "watch state" was free'd */ GPR_ASSERT(grpc_channel_num_external_connectivity_watchers(chan) == 0); @@ -94,7 +94,7 @@ void server_thread(void* vargs) { struct server_thread_args* args = (struct server_thread_args*)vargs; grpc_event ev; gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); - ev = grpc_completion_queue_next(args->cq, deadline, NULL); + ev = grpc_completion_queue_next(args->cq, deadline, nullptr); GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); GPR_ASSERT(detag(ev.tag) == 0xd1e); } @@ -109,7 +109,7 @@ static void on_connect(grpc_exec_ctx* exec_ctx, void* vargs, grpc_endpoint* tcp, grpc_endpoint_destroy(exec_ctx, tcp); 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); } @@ -121,7 +121,7 @@ void bad_server_thread(void* vargs) { struct sockaddr_storage* addr = (struct sockaddr_storage*)resolved_addr.addr; int port; grpc_tcp_server* s; - grpc_error* error = grpc_tcp_server_create(&exec_ctx, NULL, NULL, &s); + grpc_error* error = grpc_tcp_server_create(&exec_ctx, nullptr, nullptr, &s); GPR_ASSERT(error == GRPC_ERROR_NONE); memset(&resolved_addr, 0, sizeof(resolved_addr)); addr->ss_family = AF_INET; @@ -137,7 +137,7 @@ void bad_server_thread(void* vargs) { while (gpr_atm_acq_load(&args->stop) == 0) { grpc_millis deadline = grpc_exec_ctx_now(&exec_ctx) + 100; - grpc_pollset_worker* worker = NULL; + grpc_pollset_worker* worker = nullptr; if (!GRPC_LOG_IF_ERROR( "pollset_work", grpc_pollset_work(&exec_ctx, args->pollset, &worker, deadline))) { @@ -189,10 +189,10 @@ int run_concurrent_connectivity_test() { gpr_log(GPR_DEBUG, "Wave 2"); int port = grpc_pick_unused_port_or_die(); gpr_asprintf(&args.addr, "localhost:%d", port); - args.server = grpc_server_create(NULL, NULL); + args.server = grpc_server_create(nullptr, nullptr); grpc_server_add_insecure_http2_port(args.server, args.addr); - args.cq = grpc_completion_queue_create_for_next(NULL); - grpc_server_register_completion_queue(args.server, args.cq, NULL); + args.cq = grpc_completion_queue_create_for_next(nullptr); + grpc_server_register_completion_queue(args.server, args.cq, nullptr); grpc_server_start(args.server); gpr_thd_new(&server, server_thread, &args, &options); @@ -238,8 +238,8 @@ int run_concurrent_connectivity_test() { void watches_with_short_timeouts(void* addr) { for (int i = 0; i < NUM_OUTER_LOOPS_SHORT_TIMEOUTS; ++i) { - grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL); - grpc_channel* chan = grpc_insecure_channel_create((char*)addr, NULL, NULL); + grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr); + grpc_channel* chan = grpc_insecure_channel_create((char*)addr, nullptr, nullptr); for (int j = 0; j < NUM_INNER_LOOPS_SHORT_TIMEOUTS; ++j) { gpr_timespec later_time = @@ -247,10 +247,10 @@ void watches_with_short_timeouts(void* addr) { grpc_connectivity_state state = grpc_channel_check_connectivity_state(chan, 0); GPR_ASSERT(state == GRPC_CHANNEL_IDLE); - grpc_channel_watch_connectivity_state(chan, state, later_time, cq, NULL); + grpc_channel_watch_connectivity_state(chan, state, later_time, cq, nullptr); gpr_timespec poll_time = grpc_timeout_milliseconds_to_deadline(POLL_MILLIS_SHORT_TIMEOUTS); - grpc_event ev = grpc_completion_queue_next(cq, poll_time, NULL); + grpc_event ev = grpc_completion_queue_next(cq, poll_time, nullptr); GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); GPR_ASSERT(ev.success == false); /* check that the watcher from "watch state" was free'd */ diff --git a/test/core/surface/invalid_channel_args_test.cc b/test/core/surface/invalid_channel_args_test.cc index 6a58a32e3c439..7c5f1f0352ff4 100644 --- a/test/core/surface/invalid_channel_args_test.cc +++ b/test/core/surface/invalid_channel_args_test.cc @@ -24,7 +24,7 @@ #include #include "test/core/util/test_config.h" -static char* g_last_log_error_message = NULL; +static char* g_last_log_error_message = nullptr; static const char* g_file_name = "channel.cc"; static int ends_with(const char* src, const char* suffix) { @@ -44,13 +44,13 @@ static void log_error_sink(gpr_log_func_args* args) { } static void verify_last_error(const char* message) { - if (message == NULL) { - GPR_ASSERT(g_last_log_error_message == NULL); + if (message == nullptr) { + GPR_ASSERT(g_last_log_error_message == nullptr); return; } GPR_ASSERT(strcmp(message, g_last_log_error_message) == 0); gpr_free(g_last_log_error_message); - g_last_log_error_message = NULL; + g_last_log_error_message = nullptr; } static char* compose_error_string(const char* key, const char* message) { @@ -61,13 +61,13 @@ static char* compose_error_string(const char* key, const char* message) { static void one_test(grpc_channel_args* args, char* expected_error_message) { grpc_channel* chan = - grpc_insecure_channel_create("nonexistant:54321", args, NULL); + grpc_insecure_channel_create("nonexistant:54321", args, nullptr); verify_last_error(expected_error_message); gpr_free(expected_error_message); grpc_channel_destroy(chan); } -static void test_no_error_message(void) { one_test(NULL, NULL); } +static void test_no_error_message(void) { one_test(nullptr, nullptr); } static void test_default_authority_type(void) { grpc_arg client_arg; diff --git a/test/core/surface/lame_client_test.cc b/test/core/surface/lame_client_test.cc index c374adc08db29..71ec0cb6d65c2 100644 --- a/test/core/surface/lame_client_test.cc +++ b/test/core/surface/lame_client_test.cc @@ -50,14 +50,14 @@ void test_transport_op(grpc_channel* channel) { GRPC_CLOSURE_INIT(&transport_op_cb, verify_connectivity, &state, grpc_schedule_on_exec_ctx); - op = grpc_make_transport_op(NULL); + op = grpc_make_transport_op(nullptr); op->on_connectivity_state_change = &transport_op_cb; op->connectivity_state = &state; elem = grpc_channel_stack_element(grpc_channel_get_channel_stack(channel), 0); elem->filter->start_transport_op(&exec_ctx, elem, op); grpc_exec_ctx_finish(&exec_ctx); - GRPC_CLOSURE_INIT(&transport_op_cb, do_nothing, NULL, + GRPC_CLOSURE_INIT(&transport_op_cb, do_nothing, nullptr, grpc_schedule_on_exec_ctx); op = grpc_make_transport_op(&transport_op_cb); elem->filter->start_transport_op(&exec_ctx, elem, op); @@ -93,12 +93,12 @@ int main(int argc, char** argv) { GPR_ASSERT(GRPC_CHANNEL_SHUTDOWN == grpc_channel_check_connectivity_state(chan, 0)); - cq = grpc_completion_queue_create_for_next(NULL); + cq = grpc_completion_queue_create_for_next(nullptr); grpc_slice host = grpc_slice_from_static_string("anywhere"); - call = grpc_channel_create_call(chan, NULL, GRPC_PROPAGATE_DEFAULTS, cq, + call = grpc_channel_create_call(chan, nullptr, GRPC_PROPAGATE_DEFAULTS, cq, grpc_slice_from_static_string("/Foo"), &host, - grpc_timeout_seconds_to_deadline(100), NULL); + grpc_timeout_seconds_to_deadline(100), nullptr); GPR_ASSERT(call); cqv = cq_verifier_create(cq); @@ -107,14 +107,14 @@ int main(int argc, char** argv) { 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(call, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(call, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); /* the call should immediately fail */ @@ -128,9 +128,9 @@ int main(int argc, char** argv) { op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(call, ops, (size_t)(op - ops), tag(2), NULL); + error = grpc_call_start_batch(call, ops, (size_t)(op - ops), tag(2), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); /* the call should immediately fail */ diff --git a/test/core/surface/num_external_connectivity_watchers_test.cc b/test/core/surface/num_external_connectivity_watchers_test.cc index 89dc364fb8eef..b08e28c0fc9de 100644 --- a/test/core/surface/num_external_connectivity_watchers_test.cc +++ b/test/core/surface/num_external_connectivity_watchers_test.cc @@ -51,7 +51,7 @@ static void channel_idle_start_watch(grpc_channel* channel, static void channel_idle_poll_for_timeout(grpc_channel* channel, grpc_completion_queue* cq) { grpc_event ev = - grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); /* expect watch_connectivity_state to end with a timeout */ GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); @@ -73,7 +73,7 @@ static void run_timeouts_test(const test_fixture* fixture) { gpr_join_host_port(&addr, "localhost", grpc_pick_unused_port_or_die()); grpc_channel* channel = fixture->create_channel(addr); - grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL); + grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr); /* start 1 watcher and then let it time out */ channel_idle_start_watch(channel, cq); @@ -106,7 +106,7 @@ static void run_timeouts_test(const test_fixture* fixture) { grpc_channel_destroy(channel); grpc_completion_queue_shutdown(cq); GPR_ASSERT( - grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL) + grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr) .type == GRPC_QUEUE_SHUTDOWN); grpc_completion_queue_destroy(cq); @@ -127,7 +127,7 @@ static void run_channel_shutdown_before_timeout_test( gpr_join_host_port(&addr, "localhost", grpc_pick_unused_port_or_die()); grpc_channel* channel = fixture->create_channel(addr); - grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL); + grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr); /* start 1 watcher and then shut down the channel before the timer goes off */ GPR_ASSERT(grpc_channel_num_external_connectivity_watchers(channel) == 0); @@ -142,14 +142,14 @@ static void run_channel_shutdown_before_timeout_test( grpc_channel_destroy(channel); grpc_event ev = - grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); /* expect success with a state transition to CHANNEL_SHUTDOWN */ GPR_ASSERT(ev.success == true); grpc_completion_queue_shutdown(cq); GPR_ASSERT( - grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL) + grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr) .type == GRPC_QUEUE_SHUTDOWN); grpc_completion_queue_destroy(cq); @@ -158,7 +158,7 @@ static void run_channel_shutdown_before_timeout_test( } static grpc_channel* insecure_test_create_channel(const char* addr) { - return grpc_insecure_channel_create(addr, NULL, NULL); + return grpc_insecure_channel_create(addr, nullptr, nullptr); } static const test_fixture insecure_test = { @@ -168,15 +168,15 @@ static const test_fixture insecure_test = { static grpc_channel* secure_test_create_channel(const char* addr) { grpc_channel_credentials* ssl_creds = - grpc_ssl_credentials_create(test_root_cert, NULL, NULL); + grpc_ssl_credentials_create(test_root_cert, nullptr, nullptr); grpc_arg ssl_name_override = { GRPC_ARG_STRING, const_cast(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG), {const_cast("foo.test.google.fr")}}; grpc_channel_args* new_client_args = - grpc_channel_args_copy_and_add(NULL, &ssl_name_override, 1); + grpc_channel_args_copy_and_add(nullptr, &ssl_name_override, 1); grpc_channel* channel = - grpc_secure_channel_create(ssl_creds, addr, new_client_args, NULL); + grpc_secure_channel_create(ssl_creds, addr, new_client_args, nullptr); { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_channel_args_destroy(&exec_ctx, new_client_args); diff --git a/test/core/surface/secure_channel_create_test.cc b/test/core/surface/secure_channel_create_test.cc index f3163c1d80ad5..dcd1f2ef10099 100644 --- a/test/core/surface/secure_channel_create_test.cc +++ b/test/core/surface/secure_channel_create_test.cc @@ -33,7 +33,7 @@ void test_unknown_scheme_target(void) { grpc_channel_credentials* creds = grpc_fake_transport_security_credentials_create(); grpc_channel* chan = - grpc_secure_channel_create(creds, "blah://blah", NULL, NULL); + grpc_secure_channel_create(creds, "blah://blah", nullptr, nullptr); grpc_channel_element* elem = grpc_channel_stack_element(grpc_channel_get_channel_stack(chan), 0); GPR_ASSERT(0 == strcmp(elem->filter->name, "lame-client")); @@ -46,12 +46,12 @@ void test_unknown_scheme_target(void) { void test_security_connector_already_in_arg(void) { grpc_arg arg; arg.type = GRPC_ARG_POINTER; - arg.value.pointer.p = NULL; + arg.value.pointer.p = nullptr; arg.key = const_cast(GRPC_ARG_SECURITY_CONNECTOR); grpc_channel_args args; args.num_args = 1; args.args = &arg; - grpc_channel* chan = grpc_secure_channel_create(NULL, NULL, &args, NULL); + grpc_channel* chan = grpc_secure_channel_create(nullptr, nullptr, &args, nullptr); grpc_channel_element* elem = grpc_channel_stack_element(grpc_channel_get_channel_stack(chan), 0); GPR_ASSERT(0 == strcmp(elem->filter->name, "lame-client")); @@ -61,7 +61,7 @@ void test_security_connector_already_in_arg(void) { } void test_null_creds(void) { - grpc_channel* chan = grpc_secure_channel_create(NULL, NULL, NULL, NULL); + grpc_channel* chan = grpc_secure_channel_create(nullptr, nullptr, nullptr, nullptr); grpc_channel_element* elem = grpc_channel_stack_element(grpc_channel_get_channel_stack(chan), 0); GPR_ASSERT(0 == strcmp(elem->filter->name, "lame-client")); diff --git a/test/core/surface/sequential_connectivity_test.cc b/test/core/surface/sequential_connectivity_test.cc index 9ffbc826679bb..5bf3b12c73ac4 100644 --- a/test/core/surface/sequential_connectivity_test.cc +++ b/test/core/surface/sequential_connectivity_test.cc @@ -45,9 +45,9 @@ typedef struct { static void server_thread_func(void* args) { server_thread_args* a = static_cast(args); grpc_event ev = grpc_completion_queue_next( - a->cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + a->cq, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); - GPR_ASSERT(ev.tag == NULL); + GPR_ASSERT(ev.tag == nullptr); GPR_ASSERT(ev.success == true); } @@ -59,11 +59,11 @@ static void run_test(const test_fixture* fixture) { char* addr; gpr_join_host_port(&addr, "localhost", grpc_pick_unused_port_or_die()); - grpc_server* server = grpc_server_create(NULL, NULL); + grpc_server* server = grpc_server_create(nullptr, nullptr); fixture->add_server_port(server, addr); grpc_completion_queue* server_cq = - grpc_completion_queue_create_for_next(NULL); - grpc_server_register_completion_queue(server, server_cq, NULL); + grpc_completion_queue_create_for_next(nullptr); + grpc_server_register_completion_queue(server, server_cq, nullptr); grpc_server_start(server); server_thread_args sta = {server, server_cq}; @@ -72,7 +72,7 @@ static void run_test(const test_fixture* fixture) { gpr_thd_options_set_joinable(&thdopt); gpr_thd_new(&server_thread, server_thread_func, &sta, &thdopt); - grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL); + grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr); grpc_channel* channels[NUM_CONNECTIONS]; for (size_t i = 0; i < NUM_CONNECTIONS; i++) { channels[i] = fixture->create_channel(addr); @@ -82,30 +82,30 @@ static void run_test(const test_fixture* fixture) { while ((state = grpc_channel_check_connectivity_state(channels[i], 1)) != GRPC_CHANNEL_READY) { grpc_channel_watch_connectivity_state(channels[i], state, - connect_deadline, cq, NULL); + connect_deadline, cq, nullptr); grpc_event ev = grpc_completion_queue_next( - cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + cq, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); /* check that the watcher from "watch state" was free'd */ GPR_ASSERT(grpc_channel_num_external_connectivity_watchers(channels[i]) == 0); GPR_ASSERT(ev.type == GRPC_OP_COMPLETE); - GPR_ASSERT(ev.tag == NULL); + GPR_ASSERT(ev.tag == nullptr); GPR_ASSERT(ev.success == true); } } - grpc_server_shutdown_and_notify(server, server_cq, NULL); + grpc_server_shutdown_and_notify(server, server_cq, nullptr); gpr_thd_join(server_thread); grpc_completion_queue_shutdown(server_cq); grpc_completion_queue_shutdown(cq); while (grpc_completion_queue_next(server_cq, - gpr_inf_future(GPR_CLOCK_REALTIME), NULL) + gpr_inf_future(GPR_CLOCK_REALTIME), nullptr) .type != GRPC_QUEUE_SHUTDOWN) ; while ( - grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL) + grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr) .type != GRPC_QUEUE_SHUTDOWN) ; @@ -126,7 +126,7 @@ static void insecure_test_add_port(grpc_server* server, const char* addr) { } static grpc_channel* insecure_test_create_channel(const char* addr) { - return grpc_insecure_channel_create(addr, NULL, NULL); + return grpc_insecure_channel_create(addr, nullptr, nullptr); } static const test_fixture insecure_test = { @@ -139,22 +139,22 @@ static void secure_test_add_port(grpc_server* server, const char* addr) { grpc_ssl_pem_key_cert_pair pem_cert_key_pair = {test_server1_key, test_server1_cert}; grpc_server_credentials* ssl_creds = - grpc_ssl_server_credentials_create(NULL, &pem_cert_key_pair, 1, 0, NULL); + grpc_ssl_server_credentials_create(nullptr, &pem_cert_key_pair, 1, 0, nullptr); grpc_server_add_secure_http2_port(server, addr, ssl_creds); grpc_server_credentials_release(ssl_creds); } static grpc_channel* secure_test_create_channel(const char* addr) { grpc_channel_credentials* ssl_creds = - grpc_ssl_credentials_create(test_root_cert, NULL, NULL); + grpc_ssl_credentials_create(test_root_cert, nullptr, nullptr); grpc_arg ssl_name_override = { GRPC_ARG_STRING, const_cast(GRPC_SSL_TARGET_NAME_OVERRIDE_ARG), {const_cast("foo.test.google.fr")}}; grpc_channel_args* new_client_args = - grpc_channel_args_copy_and_add(NULL, &ssl_name_override, 1); + grpc_channel_args_copy_and_add(nullptr, &ssl_name_override, 1); grpc_channel* channel = - grpc_secure_channel_create(ssl_creds, addr, new_client_args, NULL); + grpc_secure_channel_create(ssl_creds, addr, new_client_args, nullptr); { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_channel_args_destroy(&exec_ctx, new_client_args); diff --git a/test/core/surface/server_chttp2_test.cc b/test/core/surface/server_chttp2_test.cc index b0ffb1de3c121..96eaa6a7a94b5 100644 --- a/test/core/surface/server_chttp2_test.cc +++ b/test/core/surface/server_chttp2_test.cc @@ -29,8 +29,8 @@ #include "test/core/util/test_config.h" void test_unparsable_target(void) { - grpc_channel_args args = {0, NULL}; - grpc_server* server = grpc_server_create(&args, NULL); + grpc_channel_args args = {0, nullptr}; + grpc_server* server = grpc_server_create(&args, nullptr); int port = grpc_server_add_insecure_http2_port(server, "["); GPR_ASSERT(port == 0); grpc_server_destroy(server); @@ -44,9 +44,9 @@ void test_add_same_port_twice() { grpc_channel_args args = {1, &a}; int port = grpc_pick_unused_port_or_die(); - char* addr = NULL; - grpc_completion_queue* cq = grpc_completion_queue_create_for_pluck(NULL); - grpc_server* server = grpc_server_create(&args, NULL); + char* addr = nullptr; + grpc_completion_queue* cq = grpc_completion_queue_create_for_pluck(nullptr); + grpc_server* server = grpc_server_create(&args, nullptr); grpc_server_credentials* fake_creds = grpc_fake_transport_security_server_credentials_create(); gpr_join_host_port(&addr, "localhost", port); @@ -55,9 +55,9 @@ void test_add_same_port_twice() { grpc_server_credentials_release(fake_creds); gpr_free(addr); - grpc_server_shutdown_and_notify(server, cq, NULL); - grpc_completion_queue_pluck(cq, NULL, gpr_inf_future(GPR_CLOCK_REALTIME), - NULL); + grpc_server_shutdown_and_notify(server, cq, nullptr); + grpc_completion_queue_pluck(cq, nullptr, gpr_inf_future(GPR_CLOCK_REALTIME), + nullptr); grpc_server_destroy(server); grpc_completion_queue_destroy(cq); } diff --git a/test/core/surface/server_test.cc b/test/core/surface/server_test.cc index 240969a121eec..1998cab3e35d5 100644 --- a/test/core/surface/server_test.cc +++ b/test/core/surface/server_test.cc @@ -28,40 +28,40 @@ #include "test/core/util/test_config.h" void test_register_method_fail(void) { - grpc_server* server = grpc_server_create(NULL, NULL); + grpc_server* server = grpc_server_create(nullptr, nullptr); void* method; void* method_old; method = - grpc_server_register_method(server, NULL, NULL, GRPC_SRM_PAYLOAD_NONE, 0); - GPR_ASSERT(method == NULL); + grpc_server_register_method(server, nullptr, nullptr, GRPC_SRM_PAYLOAD_NONE, 0); + GPR_ASSERT(method == nullptr); method_old = grpc_server_register_method(server, "m", "h", GRPC_SRM_PAYLOAD_NONE, 0); - GPR_ASSERT(method_old != NULL); + GPR_ASSERT(method_old != nullptr); method = grpc_server_register_method( server, "m", "h", GRPC_SRM_PAYLOAD_READ_INITIAL_BYTE_BUFFER, 0); - GPR_ASSERT(method == NULL); + GPR_ASSERT(method == nullptr); method_old = grpc_server_register_method(server, "m2", "h2", GRPC_SRM_PAYLOAD_NONE, GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST); - GPR_ASSERT(method_old != NULL); + GPR_ASSERT(method_old != nullptr); method = grpc_server_register_method(server, "m2", "h2", GRPC_SRM_PAYLOAD_NONE, 0); - GPR_ASSERT(method == NULL); + GPR_ASSERT(method == nullptr); method = grpc_server_register_method( server, "m2", "h2", GRPC_SRM_PAYLOAD_READ_INITIAL_BYTE_BUFFER, GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST); - GPR_ASSERT(method == NULL); + GPR_ASSERT(method == nullptr); grpc_server_destroy(server); } void test_request_call_on_no_server_cq(void) { - grpc_completion_queue* cc = grpc_completion_queue_create_for_next(NULL); - grpc_server* server = grpc_server_create(NULL, NULL); + grpc_completion_queue* cc = grpc_completion_queue_create_for_next(nullptr); + grpc_server* server = grpc_server_create(nullptr, nullptr); GPR_ASSERT(GRPC_CALL_ERROR_NOT_SERVER_COMPLETION_QUEUE == - grpc_server_request_call(server, NULL, NULL, NULL, cc, cc, NULL)); + grpc_server_request_call(server, nullptr, nullptr, nullptr, cc, cc, nullptr)); GPR_ASSERT(GRPC_CALL_ERROR_NOT_SERVER_COMPLETION_QUEUE == - grpc_server_request_registered_call(server, NULL, NULL, NULL, NULL, - NULL, cc, cc, NULL)); + grpc_server_request_registered_call(server, nullptr, nullptr, nullptr, nullptr, + nullptr, cc, cc, nullptr)); grpc_completion_queue_destroy(cc); grpc_server_destroy(server); } @@ -74,24 +74,24 @@ void test_bind_server_twice(void) { grpc_channel_args args = {1, &a}; char* addr; - grpc_server* server1 = grpc_server_create(&args, NULL); - grpc_server* server2 = grpc_server_create(&args, NULL); - grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL); + grpc_server* server1 = grpc_server_create(&args, nullptr); + grpc_server* server2 = grpc_server_create(&args, nullptr); + grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr); int port = grpc_pick_unused_port_or_die(); gpr_asprintf(&addr, "[::]:%d", port); - grpc_server_register_completion_queue(server1, cq, NULL); - grpc_server_register_completion_queue(server2, cq, NULL); - GPR_ASSERT(0 == grpc_server_add_secure_http2_port(server2, addr, NULL)); + grpc_server_register_completion_queue(server1, cq, nullptr); + grpc_server_register_completion_queue(server2, cq, nullptr); + GPR_ASSERT(0 == grpc_server_add_secure_http2_port(server2, addr, nullptr)); GPR_ASSERT(port == grpc_server_add_insecure_http2_port(server1, addr)); GPR_ASSERT(0 == grpc_server_add_insecure_http2_port(server2, addr)); grpc_server_credentials* fake_creds = grpc_fake_transport_security_server_credentials_create(); GPR_ASSERT(0 == grpc_server_add_secure_http2_port(server2, addr, fake_creds)); grpc_server_credentials_release(fake_creds); - grpc_server_shutdown_and_notify(server1, cq, NULL); - grpc_server_shutdown_and_notify(server2, cq, NULL); - grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_MONOTONIC), NULL); - grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_MONOTONIC), NULL); + grpc_server_shutdown_and_notify(server1, cq, nullptr); + grpc_server_shutdown_and_notify(server2, cq, nullptr); + grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_MONOTONIC), nullptr); + grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_MONOTONIC), nullptr); grpc_server_destroy(server1); grpc_server_destroy(server2); grpc_completion_queue_destroy(cq); @@ -104,7 +104,7 @@ void test_bind_server_to_addr(const char* host, bool secure) { gpr_join_host_port(&addr, host, port); gpr_log(GPR_INFO, "Test bind to %s", addr); - grpc_server* server = grpc_server_create(NULL, NULL); + grpc_server* server = grpc_server_create(nullptr, nullptr); if (secure) { grpc_server_credentials* fake_creds = grpc_fake_transport_security_server_credentials_create(); @@ -113,21 +113,21 @@ void test_bind_server_to_addr(const char* host, bool secure) { } else { GPR_ASSERT(grpc_server_add_insecure_http2_port(server, addr)); } - grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL); - grpc_server_register_completion_queue(server, cq, NULL); + grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr); + grpc_server_register_completion_queue(server, cq, nullptr); grpc_server_start(server); - grpc_server_shutdown_and_notify(server, cq, NULL); - grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_MONOTONIC), NULL); + grpc_server_shutdown_and_notify(server, cq, nullptr); + grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_MONOTONIC), nullptr); grpc_server_destroy(server); grpc_completion_queue_destroy(cq); gpr_free(addr); } static int external_dns_works(const char* host) { - grpc_resolved_addresses* res = NULL; + grpc_resolved_addresses* res = nullptr; grpc_error* error = grpc_blocking_resolve_address(host, "80", &res); GRPC_ERROR_UNREF(error); - if (res != NULL) { + if (res != nullptr) { grpc_resolved_addresses_destroy(res); return 1; } diff --git a/test/core/transport/byte_stream_test.cc b/test/core/transport/byte_stream_test.cc index e62a69728494a..0e34fd7651dcc 100644 --- a/test/core/transport/byte_stream_test.cc +++ b/test/core/transport/byte_stream_test.cc @@ -53,7 +53,7 @@ static void test_slice_buffer_stream_basic(void) { grpc_slice_buffer_stream_init(&stream, &buffer, 0); GPR_ASSERT(stream.base.length == 6); grpc_closure closure; - GRPC_CLOSURE_INIT(&closure, not_called_closure, NULL, + GRPC_CLOSURE_INIT(&closure, not_called_closure, nullptr, grpc_schedule_on_exec_ctx); // Read each slice. Note that next() always returns synchronously. for (size_t i = 0; i < GPR_ARRAY_SIZE(input); ++i) { @@ -89,7 +89,7 @@ static void test_slice_buffer_stream_shutdown(void) { grpc_slice_buffer_stream_init(&stream, &buffer, 0); GPR_ASSERT(stream.base.length == 6); grpc_closure closure; - GRPC_CLOSURE_INIT(&closure, not_called_closure, NULL, + GRPC_CLOSURE_INIT(&closure, not_called_closure, nullptr, grpc_schedule_on_exec_ctx); // Read the first slice. GPR_ASSERT( @@ -142,7 +142,7 @@ static void test_caching_byte_stream_basic(void) { grpc_caching_byte_stream stream; grpc_caching_byte_stream_init(&stream, &cache); grpc_closure closure; - GRPC_CLOSURE_INIT(&closure, not_called_closure, NULL, + GRPC_CLOSURE_INIT(&closure, not_called_closure, nullptr, grpc_schedule_on_exec_ctx); // Read each slice. Note that next() always returns synchronously, // because the underlying byte stream always does. @@ -183,7 +183,7 @@ static void test_caching_byte_stream_reset(void) { grpc_caching_byte_stream stream; grpc_caching_byte_stream_init(&stream, &cache); grpc_closure closure; - GRPC_CLOSURE_INIT(&closure, not_called_closure, NULL, + GRPC_CLOSURE_INIT(&closure, not_called_closure, nullptr, grpc_schedule_on_exec_ctx); // Read one slice. GPR_ASSERT( @@ -234,7 +234,7 @@ static void test_caching_byte_stream_shared_cache(void) { grpc_caching_byte_stream stream2; grpc_caching_byte_stream_init(&stream2, &cache); grpc_closure closure; - GRPC_CLOSURE_INIT(&closure, not_called_closure, NULL, + GRPC_CLOSURE_INIT(&closure, not_called_closure, nullptr, grpc_schedule_on_exec_ctx); // Read one slice from stream1. GPR_ASSERT( diff --git a/test/core/transport/chttp2/hpack_encoder_test.cc b/test/core/transport/chttp2/hpack_encoder_test.cc index a7e44abc2bfdd..2d18b7250421e 100644 --- a/test/core/transport/chttp2/hpack_encoder_test.cc +++ b/test/core/transport/chttp2/hpack_encoder_test.cc @@ -39,7 +39,7 @@ grpc_chttp2_hpack_compressor g_compressor; int g_failure = 0; -void** to_delete = NULL; +void** to_delete = nullptr; size_t num_to_delete = 0; size_t cap_to_delete = 0; @@ -80,8 +80,8 @@ static void verify(grpc_exec_ctx* exec_ctx, const verify_params params, exec_ctx, grpc_slice_intern(grpc_slice_from_static_string(key)), value_slice); } - e[0].prev = NULL; - e[nheaders - 1].next = NULL; + e[0].prev = nullptr; + e[nheaders - 1].next = nullptr; va_end(l); b.list.head = &e[0]; @@ -106,7 +106,7 @@ static void verify(grpc_exec_ctx* exec_ctx, const verify_params params, 16384, /* max_frame_size */ &stats /* stats */ }; - grpc_chttp2_encode_header(exec_ctx, &g_compressor, NULL, 0, &b, &hopt, + grpc_chttp2_encode_header(exec_ctx, &g_compressor, nullptr, 0, &b, &hopt, &output); merged = grpc_slice_merge(output.slices, output.count); grpc_slice_buffer_destroy_internal(exec_ctx, &output); @@ -220,8 +220,8 @@ static void verify_table_size_change_match_elem_size(grpc_exec_ctx* exec_ctx, grpc_metadata_batch b; grpc_metadata_batch_init(&b); e[0].md = elem; - e[0].prev = NULL; - e[0].next = NULL; + e[0].prev = nullptr; + e[0].next = nullptr; b.list.head = &e[0]; b.list.tail = &e[0]; b.list.count = 1; @@ -235,7 +235,7 @@ static void verify_table_size_change_match_elem_size(grpc_exec_ctx* exec_ctx, use_true_binary, /* use_true_binary_metadata */ 16384, /* max_frame_size */ &stats /* stats */}; - grpc_chttp2_encode_header(exec_ctx, &g_compressor, NULL, 0, &b, &hopt, + grpc_chttp2_encode_header(exec_ctx, &g_compressor, nullptr, 0, &b, &hopt, &output); grpc_slice_buffer_destroy_internal(exec_ctx, &output); grpc_metadata_batch_destroy(exec_ctx, &b); diff --git a/test/core/transport/chttp2/hpack_parser_test.cc b/test/core/transport/chttp2/hpack_parser_test.cc index 434b46eb2ee37..82fb20aced6e6 100644 --- a/test/core/transport/chttp2/hpack_parser_test.cc +++ b/test/core/transport/chttp2/hpack_parser_test.cc @@ -73,7 +73,7 @@ static void test_vector(grpc_chttp2_hpack_parser* parser, } gpr_free(slices); - GPR_ASSERT(NULL == va_arg(chk.args, char*)); + GPR_ASSERT(nullptr == va_arg(chk.args, char*)); va_end(chk.args); } diff --git a/test/core/transport/chttp2/stream_map_test.cc b/test/core/transport/chttp2/stream_map_test.cc index 23a7b3f4c2d8c..9b21cb236427a 100644 --- a/test/core/transport/chttp2/stream_map_test.cc +++ b/test/core/transport/chttp2/stream_map_test.cc @@ -39,7 +39,7 @@ static void test_empty_find(void) { LOG_TEST("test_empty_find"); grpc_chttp2_stream_map_init(&map, 8); - GPR_ASSERT(NULL == grpc_chttp2_stream_map_find(&map, 39128)); + GPR_ASSERT(nullptr == grpc_chttp2_stream_map_find(&map, 39128)); grpc_chttp2_stream_map_destroy(&map); } @@ -56,13 +56,13 @@ static void test_double_deletion(void) { GPR_ASSERT(1 == grpc_chttp2_stream_map_size(&map)); GPR_ASSERT((void*)1 == grpc_chttp2_stream_map_delete(&map, 1)); GPR_ASSERT(0 == grpc_chttp2_stream_map_size(&map)); - GPR_ASSERT(NULL == grpc_chttp2_stream_map_find(&map, 1)); - GPR_ASSERT(NULL == grpc_chttp2_stream_map_delete(&map, 1)); - GPR_ASSERT(NULL == grpc_chttp2_stream_map_find(&map, 1)); - GPR_ASSERT(NULL == grpc_chttp2_stream_map_delete(&map, 1)); - GPR_ASSERT(NULL == grpc_chttp2_stream_map_find(&map, 1)); - GPR_ASSERT(NULL == grpc_chttp2_stream_map_delete(&map, 1)); - GPR_ASSERT(NULL == grpc_chttp2_stream_map_find(&map, 1)); + GPR_ASSERT(nullptr == grpc_chttp2_stream_map_find(&map, 1)); + GPR_ASSERT(nullptr == grpc_chttp2_stream_map_delete(&map, 1)); + GPR_ASSERT(nullptr == grpc_chttp2_stream_map_find(&map, 1)); + GPR_ASSERT(nullptr == grpc_chttp2_stream_map_delete(&map, 1)); + GPR_ASSERT(nullptr == grpc_chttp2_stream_map_find(&map, 1)); + GPR_ASSERT(nullptr == grpc_chttp2_stream_map_delete(&map, 1)); + GPR_ASSERT(nullptr == grpc_chttp2_stream_map_find(&map, 1)); grpc_chttp2_stream_map_destroy(&map); } @@ -81,8 +81,8 @@ static void test_basic_add_find(uint32_t n) { grpc_chttp2_stream_map_add(&map, i, (void*)(uintptr_t)i); } GPR_ASSERT(n == grpc_chttp2_stream_map_size(&map)); - GPR_ASSERT(NULL == grpc_chttp2_stream_map_find(&map, 0)); - GPR_ASSERT(NULL == grpc_chttp2_stream_map_find(&map, n + 1)); + GPR_ASSERT(nullptr == grpc_chttp2_stream_map_find(&map, 0)); + GPR_ASSERT(nullptr == grpc_chttp2_stream_map_find(&map, n + 1)); for (i = 1; i <= n; i++) { got = (uintptr_t)grpc_chttp2_stream_map_find(&map, i); GPR_ASSERT(i == got); @@ -103,14 +103,14 @@ static void check_delete_evens(grpc_chttp2_stream_map* map, uint32_t n) { uint32_t i; size_t got; - GPR_ASSERT(NULL == grpc_chttp2_stream_map_find(map, 0)); - GPR_ASSERT(NULL == grpc_chttp2_stream_map_find(map, n + 1)); + GPR_ASSERT(nullptr == grpc_chttp2_stream_map_find(map, 0)); + GPR_ASSERT(nullptr == grpc_chttp2_stream_map_find(map, n + 1)); for (i = 1; i <= n; i++) { if (i & 1) { got = (uintptr_t)grpc_chttp2_stream_map_find(map, i); GPR_ASSERT(i == got); } else { - GPR_ASSERT(NULL == grpc_chttp2_stream_map_find(map, i)); + GPR_ASSERT(nullptr == grpc_chttp2_stream_map_find(map, i)); } } diff --git a/test/core/transport/connectivity_state_test.cc b/test/core/transport/connectivity_state_test.cc index 8cd7b30b66353..7a22ec848dca2 100644 --- a/test/core/transport/connectivity_state_test.cc +++ b/test/core/transport/connectivity_state_test.cc @@ -84,7 +84,7 @@ static void test_subscribe_then_unsubscribe(void) { grpc_exec_ctx_flush(&exec_ctx); GPR_ASSERT(state == GRPC_CHANNEL_IDLE); GPR_ASSERT(g_counter == 0); - grpc_connectivity_state_notify_on_state_change(&exec_ctx, &tracker, NULL, + grpc_connectivity_state_notify_on_state_change(&exec_ctx, &tracker, nullptr, closure); grpc_exec_ctx_flush(&exec_ctx); GPR_ASSERT(state == GRPC_CHANNEL_IDLE); diff --git a/test/core/transport/stream_owned_slice_test.cc b/test/core/transport/stream_owned_slice_test.cc index 0b592a049654d..e82df2117dfc3 100644 --- a/test/core/transport/stream_owned_slice_test.cc +++ b/test/core/transport/stream_owned_slice_test.cc @@ -29,7 +29,7 @@ int main(int argc, char** argv) { uint8_t buffer[] = "abc123"; grpc_stream_refcount r; - GRPC_STREAM_REF_INIT(&r, 1, do_nothing, NULL, "test"); + GRPC_STREAM_REF_INIT(&r, 1, do_nothing, nullptr, "test"); GPR_ASSERT(r.refs.count == 1); grpc_slice slice = grpc_slice_from_stream_owned_buffer(&r, buffer, sizeof(buffer)); diff --git a/test/core/tsi/fake_transport_security_test.cc b/test/core/tsi/fake_transport_security_test.cc index 32b0f898af013..73643fc9fd9c3 100644 --- a/test/core/tsi/fake_transport_security_test.cc +++ b/test/core/tsi/fake_transport_security_test.cc @@ -41,12 +41,12 @@ static void fake_test_setup_handshakers(tsi_test_fixture* fixture) { } static void validate_handshaker_peers(tsi_handshaker_result* result) { - GPR_ASSERT(result != NULL); + GPR_ASSERT(result != nullptr); tsi_peer peer; GPR_ASSERT(tsi_handshaker_result_extract_peer(result, &peer) == TSI_OK); const tsi_peer_property* property = tsi_peer_get_property_by_name(&peer, TSI_CERTIFICATE_TYPE_PEER_PROPERTY); - GPR_ASSERT(property != NULL); + GPR_ASSERT(property != nullptr); GPR_ASSERT(memcmp(property->value.data, TSI_FAKE_CERTIFICATE_TYPE, property->value.length) == 0); tsi_peer_destruct(&peer); diff --git a/test/core/tsi/ssl_transport_security_test.cc b/test/core/tsi/ssl_transport_security_test.cc index 0903ce8625bb9..03367d85e5752 100644 --- a/test/core/tsi/ssl_transport_security_test.cc +++ b/test/core/tsi/ssl_transport_security_test.cc @@ -82,19 +82,19 @@ typedef struct ssl_tsi_test_fixture { static void ssl_test_setup_handshakers(tsi_test_fixture* fixture) { ssl_tsi_test_fixture* ssl_fixture = (ssl_tsi_test_fixture*)fixture; - GPR_ASSERT(ssl_fixture != NULL); - GPR_ASSERT(ssl_fixture->key_cert_lib != NULL); - GPR_ASSERT(ssl_fixture->alpn_lib != NULL); + GPR_ASSERT(ssl_fixture != nullptr); + GPR_ASSERT(ssl_fixture->key_cert_lib != nullptr); + GPR_ASSERT(ssl_fixture->alpn_lib != nullptr); ssl_key_cert_lib* key_cert_lib = ssl_fixture->key_cert_lib; ssl_alpn_lib* alpn_lib = ssl_fixture->alpn_lib; /* Create client handshaker factory. */ - tsi_ssl_pem_key_cert_pair* client_key_cert_pair = NULL; + tsi_ssl_pem_key_cert_pair* client_key_cert_pair = nullptr; if (ssl_fixture->force_client_auth) { client_key_cert_pair = key_cert_lib->use_bad_client_cert ? &key_cert_lib->bad_client_pem_key_cert_pair : &key_cert_lib->client_pem_key_cert_pair; } - char** client_alpn_protocols = NULL; + char** client_alpn_protocols = nullptr; uint16_t num_client_alpn_protocols = 0; if (alpn_lib->alpn_mode == ALPN_CLIENT_NO_SERVER || alpn_lib->alpn_mode == ALPN_CLIENT_SERVER_OK || @@ -103,11 +103,11 @@ static void ssl_test_setup_handshakers(tsi_test_fixture* fixture) { num_client_alpn_protocols = alpn_lib->num_client_alpn_protocols; } GPR_ASSERT(tsi_create_ssl_client_handshaker_factory( - client_key_cert_pair, key_cert_lib->root_cert, NULL, + client_key_cert_pair, key_cert_lib->root_cert, nullptr, (const char**)client_alpn_protocols, num_client_alpn_protocols, &ssl_fixture->client_handshaker_factory) == TSI_OK); /* Create server handshaker factory. */ - char** server_alpn_protocols = NULL; + char** server_alpn_protocols = nullptr; uint16_t num_server_alpn_protocols = 0; if (alpn_lib->alpn_mode == ALPN_SERVER_NO_CLIENT || alpn_lib->alpn_mode == ALPN_CLIENT_SERVER_OK || @@ -125,18 +125,18 @@ static void ssl_test_setup_handshakers(tsi_test_fixture* fixture) { key_cert_lib->use_bad_server_cert ? key_cert_lib->bad_server_num_key_cert_pairs : key_cert_lib->server_num_key_cert_pairs, - key_cert_lib->root_cert, ssl_fixture->force_client_auth, NULL, + key_cert_lib->root_cert, ssl_fixture->force_client_auth, nullptr, (const char**)server_alpn_protocols, num_server_alpn_protocols, &ssl_fixture->server_handshaker_factory) == TSI_OK); /* Create server and client handshakers. */ - tsi_handshaker* client_handshaker = NULL; + tsi_handshaker* client_handshaker = nullptr; GPR_ASSERT(tsi_ssl_client_handshaker_factory_create_handshaker( ssl_fixture->client_handshaker_factory, ssl_fixture->server_name_indication, &client_handshaker) == TSI_OK); ssl_fixture->base.client_handshaker = tsi_create_adapter_handshaker(client_handshaker); - tsi_handshaker* server_handshaker = NULL; + tsi_handshaker* server_handshaker = nullptr; GPR_ASSERT(tsi_ssl_server_handshaker_factory_create_handshaker( ssl_fixture->server_handshaker_factory, &server_handshaker) == TSI_OK); @@ -146,15 +146,15 @@ static void ssl_test_setup_handshakers(tsi_test_fixture* fixture) { static void check_alpn(ssl_tsi_test_fixture* ssl_fixture, const tsi_peer* peer) { - GPR_ASSERT(ssl_fixture != NULL); - GPR_ASSERT(ssl_fixture->alpn_lib != NULL); + GPR_ASSERT(ssl_fixture != nullptr); + GPR_ASSERT(ssl_fixture->alpn_lib != nullptr); ssl_alpn_lib* alpn_lib = ssl_fixture->alpn_lib; const tsi_peer_property* alpn_property = tsi_peer_get_property_by_name(peer, TSI_SSL_ALPN_SELECTED_PROTOCOL); if (alpn_lib->alpn_mode != ALPN_CLIENT_SERVER_OK) { - GPR_ASSERT(alpn_property == NULL); + GPR_ASSERT(alpn_property == nullptr); } else { - GPR_ASSERT(alpn_property != NULL); + GPR_ASSERT(alpn_property != nullptr); const char* expected_match = "baz"; GPR_ASSERT(memcmp(alpn_property->value.data, expected_match, alpn_property->value.length) == 0); @@ -165,12 +165,12 @@ static const tsi_peer_property* check_basic_authenticated_peer_and_get_common_name(const tsi_peer* peer) { const tsi_peer_property* cert_type_property = tsi_peer_get_property_by_name(peer, TSI_CERTIFICATE_TYPE_PEER_PROPERTY); - GPR_ASSERT(cert_type_property != NULL); + GPR_ASSERT(cert_type_property != nullptr); GPR_ASSERT(memcmp(cert_type_property->value.data, TSI_X509_CERTIFICATE_TYPE, cert_type_property->value.length) == 0); const tsi_peer_property* property = tsi_peer_get_property_by_name( peer, TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY); - GPR_ASSERT(property != NULL); + GPR_ASSERT(property != nullptr); return property; } @@ -182,7 +182,7 @@ void check_server0_peer(tsi_peer* peer) { property->value.length) == 0); GPR_ASSERT(tsi_peer_get_property_by_name( peer, TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY) == - NULL); + nullptr); GPR_ASSERT(tsi_ssl_peer_matches_name(peer, "foo.test.google.com.au") == 1); GPR_ASSERT(tsi_ssl_peer_matches_name(peer, "bar.test.google.com.au") == 1); GPR_ASSERT(tsi_ssl_peer_matches_name(peer, "bar.test.google.blah") == 0); @@ -226,8 +226,8 @@ void check_server1_peer(tsi_peer* peer) { static void check_client_peer(ssl_tsi_test_fixture* ssl_fixture, tsi_peer* peer) { - GPR_ASSERT(ssl_fixture != NULL); - GPR_ASSERT(ssl_fixture->alpn_lib != NULL); + GPR_ASSERT(ssl_fixture != nullptr); + GPR_ASSERT(ssl_fixture->alpn_lib != nullptr); ssl_alpn_lib* alpn_lib = ssl_fixture->alpn_lib; if (!ssl_fixture->force_client_auth) { GPR_ASSERT(peer->property_count == @@ -244,8 +244,8 @@ static void check_client_peer(ssl_tsi_test_fixture* ssl_fixture, static void ssl_test_check_handshaker_peers(tsi_test_fixture* fixture) { ssl_tsi_test_fixture* ssl_fixture = (ssl_tsi_test_fixture*)fixture; - GPR_ASSERT(ssl_fixture != NULL); - GPR_ASSERT(ssl_fixture->key_cert_lib != NULL); + GPR_ASSERT(ssl_fixture != nullptr); + GPR_ASSERT(ssl_fixture->key_cert_lib != nullptr); ssl_key_cert_lib* key_cert_lib = ssl_fixture->key_cert_lib; tsi_peer peer; bool expect_success = @@ -256,13 +256,13 @@ static void ssl_test_check_handshaker_peers(tsi_test_fixture* fixture) { ssl_fixture->base.client_result, &peer) == TSI_OK); check_alpn(ssl_fixture, &peer); - if (ssl_fixture->server_name_indication != NULL) { + if (ssl_fixture->server_name_indication != nullptr) { check_server1_peer(&peer); } else { check_server0_peer(&peer); } } else { - GPR_ASSERT(ssl_fixture->base.client_result == NULL); + GPR_ASSERT(ssl_fixture->base.client_result == nullptr); } if (expect_success) { GPR_ASSERT(tsi_handshaker_result_extract_peer( @@ -270,7 +270,7 @@ static void ssl_test_check_handshaker_peers(tsi_test_fixture* fixture) { check_alpn(ssl_fixture, &peer); check_client_peer(ssl_fixture, &peer); } else { - GPR_ASSERT(ssl_fixture->base.server_result == NULL); + GPR_ASSERT(ssl_fixture->base.server_result == nullptr); } } @@ -281,7 +281,7 @@ static void ssl_test_pem_key_cert_pair_destroy(tsi_ssl_pem_key_cert_pair kp) { static void ssl_test_destruct(tsi_test_fixture* fixture) { ssl_tsi_test_fixture* ssl_fixture = (ssl_tsi_test_fixture*)fixture; - if (ssl_fixture == NULL) { + if (ssl_fixture == nullptr) { return; } /* Destroy ssl_alpn_lib. */ @@ -397,7 +397,7 @@ static tsi_test_fixture* ssl_tsi_test_fixture_create() { alpn_lib->alpn_mode = NO_ALPN; ssl_fixture->alpn_lib = alpn_lib; ssl_fixture->base.vtable = &vtable; - ssl_fixture->server_name_indication = NULL; + ssl_fixture->server_name_indication = nullptr; ssl_fixture->force_client_auth = false; return &ssl_fixture->base; } @@ -548,9 +548,9 @@ static bool handshaker_factory_destructor_called; static void ssl_tsi_test_handshaker_factory_destructor( tsi_ssl_handshaker_factory* factory) { - GPR_ASSERT(factory != NULL); + GPR_ASSERT(factory != nullptr); handshaker_factory_destructor_called = true; - if (original_vtable != NULL && original_vtable->destroy != NULL) { + if (original_vtable != nullptr && original_vtable->destroy != nullptr) { original_vtable->destroy(factory); } } @@ -565,7 +565,7 @@ void test_tsi_ssl_client_handshaker_factory_refcounting() { tsi_ssl_client_handshaker_factory* client_handshaker_factory; GPR_ASSERT(tsi_create_ssl_client_handshaker_factory( - NULL, cert_chain, NULL, NULL, 0, &client_handshaker_factory) == + nullptr, cert_chain, nullptr, nullptr, 0, &client_handshaker_factory) == TSI_OK); handshaker_factory_destructor_called = false; @@ -609,7 +609,7 @@ void test_tsi_ssl_server_handshaker_factory_refcounting() { load_file(SSL_TSI_TEST_CREDENTIALS_DIR, "server0.key"); GPR_ASSERT(tsi_create_ssl_server_handshaker_factory( - &cert_pair, 1, cert_chain, 0, NULL, NULL, 0, + &cert_pair, 1, cert_chain, 0, nullptr, nullptr, 0, &server_handshaker_factory) == TSI_OK); handshaker_factory_destructor_called = false; @@ -644,7 +644,7 @@ void test_tsi_ssl_client_handshaker_factory_bad_params() { tsi_ssl_client_handshaker_factory* client_handshaker_factory; GPR_ASSERT(tsi_create_ssl_client_handshaker_factory( - NULL, cert_chain, NULL, NULL, 0, &client_handshaker_factory) == + nullptr, cert_chain, nullptr, nullptr, 0, &client_handshaker_factory) == TSI_INVALID_ARGUMENT); tsi_ssl_client_handshaker_factory_unref(client_handshaker_factory); } diff --git a/test/core/tsi/transport_security_test.cc b/test/core/tsi/transport_security_test.cc index 39adf2fab6557..8dfe72e03b1a2 100644 --- a/test/core/tsi/transport_security_test.cc +++ b/test/core/tsi/transport_security_test.cc @@ -54,29 +54,29 @@ typedef struct { chromium/src/net/cert/x509_certificate_unittest.cc. TODO(jboeuf) uncomment test cases as we fix tsi_ssl_peer_matches_name. */ const cert_name_test_entry cert_name_test_entries[] = { - {1, "foo.com", "foo.com", NULL, NULL}, - {1, "f", "f", NULL, NULL}, - {0, "h", "i", NULL, NULL}, - {1, "bar.foo.com", "*.foo.com", NULL, NULL}, + {1, "foo.com", "foo.com", nullptr, nullptr}, + {1, "f", "f", nullptr, nullptr}, + {0, "h", "i", nullptr, nullptr}, + {1, "bar.foo.com", "*.foo.com", nullptr, nullptr}, {1, "www.test.fr", "common.name", - "*.test.com,*.test.co.uk,*.test.de,*.test.fr", NULL}, + "*.test.com,*.test.co.uk,*.test.de,*.test.fr", nullptr}, /* {1, "wwW.tESt.fr", "common.name", ",*.*,*.test.de,*.test.FR,www"}, */ - {0, "f.uk", ".uk", NULL, NULL}, - {0, "w.bar.foo.com", "?.bar.foo.com", NULL, NULL}, - {0, "www.foo.com", "(www|ftp).foo.com", NULL, NULL}, - {0, "www.foo.com", "www.foo.com#", NULL, NULL}, /* # = null char. */ - {0, "www.foo.com", "", "www.foo.com#*.foo.com,#,#", NULL}, - {0, "www.house.example", "ww.house.example", NULL, NULL}, - {0, "test.org", "", "www.test.org,*.test.org,*.org", NULL}, - {0, "w.bar.foo.com", "w*.bar.foo.com", NULL, NULL}, - {0, "www.bar.foo.com", "ww*ww.bar.foo.com", NULL, NULL}, - {0, "wwww.bar.foo.com", "ww*ww.bar.foo.com", NULL, NULL}, - {0, "wwww.bar.foo.com", "w*w.bar.foo.com", NULL, NULL}, - {0, "wwww.bar.foo.com", "w*w.bar.foo.c0m", NULL, NULL}, - {0, "WALLY.bar.foo.com", "wa*.bar.foo.com", NULL, NULL}, - {0, "wally.bar.foo.com", "*Ly.bar.foo.com", NULL, NULL}, + {0, "f.uk", ".uk", nullptr, nullptr}, + {0, "w.bar.foo.com", "?.bar.foo.com", nullptr, nullptr}, + {0, "www.foo.com", "(www|ftp).foo.com", nullptr, nullptr}, + {0, "www.foo.com", "www.foo.com#", nullptr, nullptr}, /* # = null char. */ + {0, "www.foo.com", "", "www.foo.com#*.foo.com,#,#", nullptr}, + {0, "www.house.example", "ww.house.example", nullptr, nullptr}, + {0, "test.org", "", "www.test.org,*.test.org,*.org", nullptr}, + {0, "w.bar.foo.com", "w*.bar.foo.com", nullptr, nullptr}, + {0, "www.bar.foo.com", "ww*ww.bar.foo.com", nullptr, nullptr}, + {0, "wwww.bar.foo.com", "ww*ww.bar.foo.com", nullptr, nullptr}, + {0, "wwww.bar.foo.com", "w*w.bar.foo.com", nullptr, nullptr}, + {0, "wwww.bar.foo.com", "w*w.bar.foo.c0m", nullptr, nullptr}, + {0, "WALLY.bar.foo.com", "wa*.bar.foo.com", nullptr, nullptr}, + {0, "wally.bar.foo.com", "*Ly.bar.foo.com", nullptr, nullptr}, /* {1, "ww%57.foo.com", "", "www.foo.com"}, {1, "www&.foo.com", "www%26.foo.com", NULL}, @@ -84,107 +84,107 @@ const cert_name_test_entry cert_name_test_entries[] = { /* Common name must not be used if subject alternative name was provided. */ {0, "www.test.co.jp", "www.test.co.jp", - "*.test.de,*.jp,www.test.co.uk,www.*.co.jp", NULL}, + "*.test.de,*.jp,www.test.co.uk,www.*.co.jp", nullptr}, {0, "www.bar.foo.com", "www.bar.foo.com", - "*.foo.com,*.*.foo.com,*.*.bar.foo.com,*..bar.foo.com,", NULL}, + "*.foo.com,*.*.foo.com,*.*.bar.foo.com,*..bar.foo.com,", nullptr}, /* IDN tests */ - {1, "xn--poema-9qae5a.com.br", "xn--poema-9qae5a.com.br", NULL, NULL}, - {1, "www.xn--poema-9qae5a.com.br", "*.xn--poema-9qae5a.com.br", NULL, NULL}, + {1, "xn--poema-9qae5a.com.br", "xn--poema-9qae5a.com.br", nullptr, nullptr}, + {1, "www.xn--poema-9qae5a.com.br", "*.xn--poema-9qae5a.com.br", nullptr, nullptr}, {0, "xn--poema-9qae5a.com.br", "", "*.xn--poema-9qae5a.com.br," "xn--poema-*.com.br," "xn--*-9qae5a.com.br," "*--poema-9qae5a.com.br", - NULL}, + nullptr}, /* The following are adapted from the examples quoted from http://tools.ietf.org/html/rfc6125#section-6.4.3 (e.g., *.example.com would match foo.example.com but not bar.foo.example.com or example.com). */ - {1, "foo.example.com", "*.example.com", NULL, NULL}, - {0, "bar.foo.example.com", "*.example.com", NULL, NULL}, - {0, "example.com", "*.example.com", NULL, NULL}, + {1, "foo.example.com", "*.example.com", nullptr, nullptr}, + {0, "bar.foo.example.com", "*.example.com", nullptr, nullptr}, + {0, "example.com", "*.example.com", nullptr, nullptr}, /* Partial wildcards are disallowed, though RFC 2818 rules allow them. That is, forms such as baz*.example.net, *baz.example.net, and b*z.example.net should NOT match domains. Instead, the wildcard must always be the left-most label, and only a single label. */ - {0, "baz1.example.net", "baz*.example.net", NULL, NULL}, - {0, "foobaz.example.net", "*baz.example.net", NULL, NULL}, - {0, "buzz.example.net", "b*z.example.net", NULL, NULL}, - {0, "www.test.example.net", "www.*.example.net", NULL, NULL}, + {0, "baz1.example.net", "baz*.example.net", nullptr, nullptr}, + {0, "foobaz.example.net", "*baz.example.net", nullptr, nullptr}, + {0, "buzz.example.net", "b*z.example.net", nullptr, nullptr}, + {0, "www.test.example.net", "www.*.example.net", nullptr, nullptr}, /* Wildcards should not be valid for public registry controlled domains, and unknown/unrecognized domains, at least three domain components must be present. */ - {1, "www.test.example", "*.test.example", NULL, NULL}, - {1, "test.example.co.uk", "*.example.co.uk", NULL, NULL}, - {0, "test.example", "*.example", NULL, NULL}, + {1, "www.test.example", "*.test.example", nullptr, nullptr}, + {1, "test.example.co.uk", "*.example.co.uk", nullptr, nullptr}, + {0, "test.example", "*.example", nullptr, nullptr}, /* {0, "example.co.uk", "*.co.uk", NULL}, */ - {0, "foo.com", "*.com", NULL, NULL}, - {0, "foo.us", "*.us", NULL, NULL}, - {0, "foo", "*", NULL, NULL}, + {0, "foo.com", "*.com", nullptr, nullptr}, + {0, "foo.us", "*.us", nullptr, nullptr}, + {0, "foo", "*", nullptr, nullptr}, /* IDN variants of wildcards and registry controlled domains. */ - {1, "www.xn--poema-9qae5a.com.br", "*.xn--poema-9qae5a.com.br", NULL, NULL}, - {1, "test.example.xn--mgbaam7a8h", "*.example.xn--mgbaam7a8h", NULL, NULL}, + {1, "www.xn--poema-9qae5a.com.br", "*.xn--poema-9qae5a.com.br", nullptr, nullptr}, + {1, "test.example.xn--mgbaam7a8h", "*.example.xn--mgbaam7a8h", nullptr, nullptr}, /* {0, "xn--poema-9qae5a.com.br", "*.com.br", NULL}, */ - {0, "example.xn--mgbaam7a8h", "*.xn--mgbaam7a8h", NULL, NULL}, + {0, "example.xn--mgbaam7a8h", "*.xn--mgbaam7a8h", nullptr, nullptr}, /* Wildcards should be permissible for 'private' registry controlled domains. */ - {1, "www.appspot.com", "*.appspot.com", NULL, NULL}, - {1, "foo.s3.amazonaws.com", "*.s3.amazonaws.com", NULL, NULL}, + {1, "www.appspot.com", "*.appspot.com", nullptr, nullptr}, + {1, "foo.s3.amazonaws.com", "*.s3.amazonaws.com", nullptr, nullptr}, /* Multiple wildcards are not valid. */ - {0, "foo.example.com", "*.*.com", NULL, NULL}, - {0, "foo.bar.example.com", "*.bar.*.com", NULL, NULL}, + {0, "foo.example.com", "*.*.com", nullptr, nullptr}, + {0, "foo.bar.example.com", "*.bar.*.com", nullptr, nullptr}, /* Absolute vs relative DNS name tests. Although not explicitly specified in RFC 6125, absolute reference names (those ending in a .) should match either absolute or relative presented names. */ - {1, "foo.com", "foo.com.", NULL, NULL}, - {1, "foo.com.", "foo.com", NULL, NULL}, - {1, "foo.com.", "foo.com.", NULL, NULL}, - {1, "f", "f.", NULL, NULL}, - {1, "f.", "f", NULL, NULL}, - {1, "f.", "f.", NULL, NULL}, - {1, "www-3.bar.foo.com", "*.bar.foo.com.", NULL, NULL}, - {1, "www-3.bar.foo.com.", "*.bar.foo.com", NULL, NULL}, - {1, "www-3.bar.foo.com.", "*.bar.foo.com.", NULL, NULL}, - {0, ".", ".", NULL, NULL}, - {0, "example.com", "*.com.", NULL, NULL}, - {0, "example.com.", "*.com", NULL, NULL}, - {0, "example.com.", "*.com.", NULL, NULL}, - {0, "foo.", "*.", NULL, NULL}, - {0, "foo", "*.", NULL, NULL}, + {1, "foo.com", "foo.com.", nullptr, nullptr}, + {1, "foo.com.", "foo.com", nullptr, nullptr}, + {1, "foo.com.", "foo.com.", nullptr, nullptr}, + {1, "f", "f.", nullptr, nullptr}, + {1, "f.", "f", nullptr, nullptr}, + {1, "f.", "f.", nullptr, nullptr}, + {1, "www-3.bar.foo.com", "*.bar.foo.com.", nullptr, nullptr}, + {1, "www-3.bar.foo.com.", "*.bar.foo.com", nullptr, nullptr}, + {1, "www-3.bar.foo.com.", "*.bar.foo.com.", nullptr, nullptr}, + {0, ".", ".", nullptr, nullptr}, + {0, "example.com", "*.com.", nullptr, nullptr}, + {0, "example.com.", "*.com", nullptr, nullptr}, + {0, "example.com.", "*.com.", nullptr, nullptr}, + {0, "foo.", "*.", nullptr, nullptr}, + {0, "foo", "*.", nullptr, nullptr}, /* {0, "foo.co.uk", "*.co.uk.", NULL}, {0, "foo.co.uk.", "*.co.uk.", NULL}, */ /* An empty CN is OK. */ - {1, "test.foo.com", "", "test.foo.com", NULL}, + {1, "test.foo.com", "", "test.foo.com", nullptr}, /* An IP should not be used for the CN. */ - {0, "173.194.195.139", "173.194.195.139", NULL, NULL}, + {0, "173.194.195.139", "173.194.195.139", nullptr, nullptr}, /* An IP can be used if the SAN IP is present */ - {1, "173.194.195.139", "foo.example.com", NULL, "173.194.195.139"}, - {0, "173.194.195.139", "foo.example.com", NULL, "8.8.8.8"}, - {0, "173.194.195.139", "foo.example.com", NULL, "8.8.8.8,8.8.4.4"}, - {1, "173.194.195.139", "foo.example.com", NULL, "8.8.8.8,173.194.195.139"}, - {0, "173.194.195.139", "foo.example.com", NULL, "173.194.195.13"}, - {0, "2001:db8:a0b:12f0::1", "foo.example.com", NULL, "173.194.195.13"}, - {1, "2001:db8:a0b:12f0::1", "foo.example.com", NULL, + {1, "173.194.195.139", "foo.example.com", nullptr, "173.194.195.139"}, + {0, "173.194.195.139", "foo.example.com", nullptr, "8.8.8.8"}, + {0, "173.194.195.139", "foo.example.com", nullptr, "8.8.8.8,8.8.4.4"}, + {1, "173.194.195.139", "foo.example.com", nullptr, "8.8.8.8,173.194.195.139"}, + {0, "173.194.195.139", "foo.example.com", nullptr, "173.194.195.13"}, + {0, "2001:db8:a0b:12f0::1", "foo.example.com", nullptr, "173.194.195.13"}, + {1, "2001:db8:a0b:12f0::1", "foo.example.com", nullptr, "2001:db8:a0b:12f0::1"}, - {0, "2001:db8:a0b:12f0::1", "foo.example.com", NULL, + {0, "2001:db8:a0b:12f0::1", "foo.example.com", nullptr, "2001:db8:a0b:12f0::2"}, - {1, "2001:db8:a0b:12f0::1", "foo.example.com", NULL, + {1, "2001:db8:a0b:12f0::1", "foo.example.com", nullptr, "2001:db8:a0b:12f0::2,2001:db8:a0b:12f0::1,8.8.8.8"}, }; @@ -202,7 +202,7 @@ typedef struct { name_list* name_list_add(const char* n) { name_list* result = static_cast(gpr_malloc(sizeof(name_list))); result->name = n; - result->next = NULL; + result->next = nullptr; return result; } @@ -211,7 +211,7 @@ static parsed_names parse_names(const char* names_str) { name_list* current_nl; size_t i; memset(&result, 0, sizeof(parsed_names)); - if (names_str == 0) return result; + if (names_str == nullptr) return result; result.name_count = 1; result.buffer = gpr_strdup(names_str); result.names = name_list_add(result.buffer); @@ -230,8 +230,8 @@ static parsed_names parse_names(const char* names_str) { static void destruct_parsed_names(parsed_names* pdn) { name_list* nl = pdn->names; - if (pdn->buffer != NULL) gpr_free(pdn->buffer); - while (nl != NULL) { + if (pdn->buffer != nullptr) gpr_free(pdn->buffer); + while (nl != nullptr) { name_list* to_be_free = nl; nl = nl->next; gpr_free(to_be_free); @@ -264,7 +264,7 @@ static tsi_peer peer_from_cert_name_test_entry( TSI_X509_SUBJECT_COMMON_NAME_PEER_PROPERTY, entry->common_name, &peer.properties[0]) == TSI_OK); i = 1; - while (nl != NULL) { + while (nl != nullptr) { char* processed = processed_name(nl->name); GPR_ASSERT(tsi_construct_string_peer_property( TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY, processed, @@ -274,7 +274,7 @@ static tsi_peer peer_from_cert_name_test_entry( } nl = ip_entries.names; - while (nl != NULL) { + while (nl != nullptr) { char* processed = processed_name(nl->name); GPR_ASSERT(tsi_construct_string_peer_property( TSI_X509_SUBJECT_ALTERNATIVE_NAME_PEER_PROPERTY, processed, @@ -294,8 +294,8 @@ char* cert_name_test_entry_to_string(const cert_name_test_entry* entry) { "%s, ip_names = %s}", entry->expected ? "true" : "false", entry->host_name, entry->common_name, - entry->dns_names != NULL ? entry->dns_names : "", - entry->ip_names != NULL ? entry->ip_names : ""); + entry->dns_names != nullptr ? entry->dns_names : "", + entry->ip_names != nullptr ? entry->ip_names : ""); return s; } @@ -344,24 +344,24 @@ static void test_result_strings(void) { } static void test_protector_invalid_args(void) { - GPR_ASSERT(tsi_frame_protector_protect(NULL, NULL, NULL, NULL, NULL) == + GPR_ASSERT(tsi_frame_protector_protect(nullptr, nullptr, nullptr, nullptr, nullptr) == TSI_INVALID_ARGUMENT); - GPR_ASSERT(tsi_frame_protector_protect_flush(NULL, NULL, NULL, NULL) == + GPR_ASSERT(tsi_frame_protector_protect_flush(nullptr, nullptr, nullptr, nullptr) == TSI_INVALID_ARGUMENT); - GPR_ASSERT(tsi_frame_protector_unprotect(NULL, NULL, NULL, NULL, NULL) == + GPR_ASSERT(tsi_frame_protector_unprotect(nullptr, nullptr, nullptr, nullptr, nullptr) == TSI_INVALID_ARGUMENT); } static void test_handshaker_invalid_args(void) { - GPR_ASSERT(tsi_handshaker_get_result(NULL) == TSI_INVALID_ARGUMENT); - GPR_ASSERT(tsi_handshaker_extract_peer(NULL, NULL) == TSI_INVALID_ARGUMENT); - GPR_ASSERT(tsi_handshaker_create_frame_protector(NULL, NULL, NULL) == + GPR_ASSERT(tsi_handshaker_get_result(nullptr) == TSI_INVALID_ARGUMENT); + GPR_ASSERT(tsi_handshaker_extract_peer(nullptr, nullptr) == TSI_INVALID_ARGUMENT); + GPR_ASSERT(tsi_handshaker_create_frame_protector(nullptr, nullptr, nullptr) == TSI_INVALID_ARGUMENT); - GPR_ASSERT(tsi_handshaker_process_bytes_from_peer(NULL, NULL, NULL) == + GPR_ASSERT(tsi_handshaker_process_bytes_from_peer(nullptr, nullptr, nullptr) == TSI_INVALID_ARGUMENT); - GPR_ASSERT(tsi_handshaker_get_bytes_to_send_to_peer(NULL, NULL, NULL) == + GPR_ASSERT(tsi_handshaker_get_bytes_to_send_to_peer(nullptr, nullptr, nullptr) == TSI_INVALID_ARGUMENT); - GPR_ASSERT(tsi_handshaker_next(NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL) == + GPR_ASSERT(tsi_handshaker_next(nullptr, nullptr, 0, nullptr, nullptr, nullptr, nullptr, nullptr) == TSI_INVALID_ARGUMENT); } @@ -370,7 +370,7 @@ static void test_handshaker_invalid_state(void) { tsi_peer peer; tsi_frame_protector* p; GPR_ASSERT(tsi_handshaker_extract_peer(h, &peer) == TSI_FAILED_PRECONDITION); - GPR_ASSERT(tsi_handshaker_create_frame_protector(h, NULL, &p) == + GPR_ASSERT(tsi_handshaker_create_frame_protector(h, nullptr, &p) == TSI_FAILED_PRECONDITION); tsi_handshaker_destroy(h); } diff --git a/test/core/tsi/transport_security_test_lib.cc b/test/core/tsi/transport_security_test_lib.cc index af8316873eed1..47a71717a6ca8 100644 --- a/test/core/tsi/transport_security_test_lib.cc +++ b/test/core/tsi/transport_security_test_lib.cc @@ -55,8 +55,8 @@ typedef struct handshaker_args { static handshaker_args* handshaker_args_create(tsi_test_fixture* fixture, bool is_client) { - GPR_ASSERT(fixture != NULL); - GPR_ASSERT(fixture->config != NULL); + GPR_ASSERT(fixture != nullptr); + GPR_ASSERT(fixture->config != nullptr); handshaker_args* args = static_cast(gpr_zalloc(sizeof(*args))); args->fixture = fixture; @@ -77,9 +77,9 @@ static void handshaker_args_destroy(handshaker_args* args) { static void do_handshaker_next(handshaker_args* args); static void setup_handshakers(tsi_test_fixture* fixture) { - GPR_ASSERT(fixture != NULL); - GPR_ASSERT(fixture->vtable != NULL); - GPR_ASSERT(fixture->vtable->setup_handshakers != NULL); + GPR_ASSERT(fixture != nullptr); + GPR_ASSERT(fixture->vtable != nullptr); + GPR_ASSERT(fixture->vtable->setup_handshakers != nullptr); fixture->vtable->setup_handshakers(fixture); } @@ -90,7 +90,7 @@ static void check_unused_bytes(tsi_test_fixture* fixture) { tsi_handshaker_result* result_without_unused_bytes = fixture->has_client_finished_first ? fixture->client_result : fixture->server_result; - const unsigned char* bytes = NULL; + const unsigned char* bytes = nullptr; size_t bytes_size = 0; GPR_ASSERT(tsi_handshaker_result_get_unused_bytes( result_with_unused_bytes, &bytes, &bytes_size) == TSI_OK); @@ -99,18 +99,18 @@ static void check_unused_bytes(tsi_test_fixture* fixture) { GPR_ASSERT(tsi_handshaker_result_get_unused_bytes( result_without_unused_bytes, &bytes, &bytes_size) == TSI_OK); GPR_ASSERT(bytes_size == 0); - GPR_ASSERT(bytes == NULL); + GPR_ASSERT(bytes == nullptr); } static void check_handshake_results(tsi_test_fixture* fixture) { - GPR_ASSERT(fixture != NULL); - GPR_ASSERT(fixture->vtable != NULL); - GPR_ASSERT(fixture->vtable->check_handshaker_peers != NULL); + GPR_ASSERT(fixture != nullptr); + GPR_ASSERT(fixture->vtable != nullptr); + GPR_ASSERT(fixture->vtable->check_handshaker_peers != nullptr); /* Check handshaker peers. */ fixture->vtable->check_handshaker_peers(fixture); /* Check unused bytes. */ if (fixture->test_unused_bytes) { - if (fixture->server_result != NULL && fixture->client_result != NULL) { + if (fixture->server_result != nullptr && fixture->client_result != nullptr) { check_unused_bytes(fixture); } fixture->bytes_written_to_server_channel = 0; @@ -123,14 +123,14 @@ static void check_handshake_results(tsi_test_fixture* fixture) { static void send_bytes_to_peer(tsi_test_fixture* fixture, const unsigned char* buf, size_t buf_size, bool is_client) { - GPR_ASSERT(fixture != NULL); - GPR_ASSERT(buf != NULL); + GPR_ASSERT(fixture != nullptr); + GPR_ASSERT(buf != nullptr); uint8_t* channel = is_client ? fixture->server_channel : fixture->client_channel; - GPR_ASSERT(channel != NULL); + GPR_ASSERT(channel != nullptr); size_t* bytes_written = is_client ? &fixture->bytes_written_to_server_channel : &fixture->bytes_written_to_client_channel; - GPR_ASSERT(bytes_written != NULL); + GPR_ASSERT(bytes_written != nullptr); GPR_ASSERT(*bytes_written + buf_size <= TSI_TEST_DEFAULT_CHANNEL_SIZE); /* Write data to channel. */ memcpy(channel + *bytes_written, buf, buf_size); @@ -138,14 +138,14 @@ static void send_bytes_to_peer(tsi_test_fixture* fixture, } static void maybe_append_unused_bytes(handshaker_args* args) { - GPR_ASSERT(args != NULL); - GPR_ASSERT(args->fixture != NULL); + GPR_ASSERT(args != nullptr); + GPR_ASSERT(args->fixture != nullptr); tsi_test_fixture* fixture = args->fixture; if (fixture->test_unused_bytes && !args->appended_unused_bytes) { args->appended_unused_bytes = true; send_bytes_to_peer(fixture, (const unsigned char*)TSI_TEST_UNUSED_BYTES, strlen(TSI_TEST_UNUSED_BYTES), args->is_client); - if (fixture->client_result != NULL && fixture->server_result == NULL) { + if (fixture->client_result != nullptr && fixture->server_result == nullptr) { fixture->has_client_finished_first = true; } } @@ -154,18 +154,18 @@ static void maybe_append_unused_bytes(handshaker_args* args) { static void receive_bytes_from_peer(tsi_test_fixture* fixture, unsigned char** buf, size_t* buf_size, bool is_client) { - GPR_ASSERT(fixture != NULL); - GPR_ASSERT(*buf != NULL); - GPR_ASSERT(buf_size != NULL); + GPR_ASSERT(fixture != nullptr); + GPR_ASSERT(*buf != nullptr); + GPR_ASSERT(buf_size != nullptr); uint8_t* channel = is_client ? fixture->client_channel : fixture->server_channel; - GPR_ASSERT(channel != NULL); + GPR_ASSERT(channel != nullptr); size_t* bytes_read = is_client ? &fixture->bytes_read_from_client_channel : &fixture->bytes_read_from_server_channel; size_t* bytes_written = is_client ? &fixture->bytes_written_to_client_channel : &fixture->bytes_written_to_server_channel; - GPR_ASSERT(bytes_read != NULL); - GPR_ASSERT(bytes_written != NULL); + GPR_ASSERT(bytes_read != nullptr); + GPR_ASSERT(bytes_written != nullptr); size_t to_read = *buf_size < *bytes_written - *bytes_read ? *buf_size : *bytes_written - *bytes_read; @@ -179,9 +179,9 @@ static void send_message_to_peer(tsi_test_fixture* fixture, tsi_frame_protector* protector, bool is_client) { /* Initialization. */ - GPR_ASSERT(fixture != NULL); - GPR_ASSERT(fixture->config != NULL); - GPR_ASSERT(protector != NULL); + GPR_ASSERT(fixture != nullptr); + GPR_ASSERT(fixture->config != nullptr); + GPR_ASSERT(protector != nullptr); tsi_test_frame_protector_config* config = fixture->config; unsigned char* protected_buffer = static_cast(gpr_zalloc(config->protected_buffer_size)); @@ -189,7 +189,7 @@ static void send_message_to_peer(tsi_test_fixture* fixture, is_client ? config->client_message_size : config->server_message_size; uint8_t* message = is_client ? config->client_message : config->server_message; - GPR_ASSERT(message != NULL); + GPR_ASSERT(message != nullptr); const unsigned char* message_bytes = (const unsigned char*)message; tsi_result result = TSI_OK; /* Do protect and send protected data to peer. */ @@ -230,11 +230,11 @@ static void receive_message_from_peer(tsi_test_fixture* fixture, unsigned char* message, size_t* bytes_received, bool is_client) { /* Initialization. */ - GPR_ASSERT(fixture != NULL); - GPR_ASSERT(protector != NULL); - GPR_ASSERT(message != NULL); - GPR_ASSERT(bytes_received != NULL); - GPR_ASSERT(fixture->config != NULL); + GPR_ASSERT(fixture != nullptr); + GPR_ASSERT(protector != nullptr); + GPR_ASSERT(message != nullptr); + GPR_ASSERT(bytes_received != nullptr); + GPR_ASSERT(fixture->config != nullptr); tsi_test_frame_protector_config* config = fixture->config; size_t read_offset = 0; size_t message_offset = 0; @@ -287,8 +287,8 @@ grpc_error* on_handshake_next_done(tsi_result result, void* user_data, size_t bytes_to_send_size, tsi_handshaker_result* handshaker_result) { handshaker_args* args = (handshaker_args*)user_data; - GPR_ASSERT(args != NULL); - GPR_ASSERT(args->fixture != NULL); + GPR_ASSERT(args != nullptr); + GPR_ASSERT(args->fixture != nullptr); tsi_test_fixture* fixture = args->fixture; grpc_error* error = GRPC_ERROR_NONE; /* Read more data if we need to. */ @@ -303,10 +303,10 @@ grpc_error* on_handshake_next_done(tsi_result result, void* user_data, GRPC_ERROR_CREATE_FROM_STATIC_STRING("Handshake failed"), result); } /* Update handshaker result. */ - if (handshaker_result != NULL) { + if (handshaker_result != nullptr) { tsi_handshaker_result** result_to_write = args->is_client ? &fixture->client_result : &fixture->server_result; - GPR_ASSERT(*result_to_write == NULL); + GPR_ASSERT(*result_to_write == nullptr); *result_to_write = handshaker_result; } /* Send data to peer, if needed. */ @@ -315,7 +315,7 @@ grpc_error* on_handshake_next_done(tsi_result result, void* user_data, args->is_client); args->transferred_data = true; } - if (handshaker_result != NULL) { + if (handshaker_result != nullptr) { maybe_append_unused_bytes(args); } notification_signal(fixture); @@ -331,11 +331,11 @@ static void on_handshake_next_done_wrapper( } static bool is_handshake_finished_properly(handshaker_args* args) { - GPR_ASSERT(args != NULL); - GPR_ASSERT(args->fixture != NULL); + GPR_ASSERT(args != nullptr); + GPR_ASSERT(args->fixture != nullptr); tsi_test_fixture* fixture = args->fixture; - if ((args->is_client && fixture->client_result != NULL) || - (!args->is_client && fixture->server_result != NULL)) { + if ((args->is_client && fixture->client_result != nullptr) || + (!args->is_client && fixture->server_result != nullptr)) { return true; } return false; @@ -343,16 +343,16 @@ static bool is_handshake_finished_properly(handshaker_args* args) { static void do_handshaker_next(handshaker_args* args) { /* Initialization. */ - GPR_ASSERT(args != NULL); - GPR_ASSERT(args->fixture != NULL); + GPR_ASSERT(args != nullptr); + GPR_ASSERT(args->fixture != nullptr); tsi_test_fixture* fixture = args->fixture; tsi_handshaker* handshaker = args->is_client ? fixture->client_handshaker : fixture->server_handshaker; if (is_handshake_finished_properly(args)) { return; } - tsi_handshaker_result* handshaker_result = NULL; - unsigned char* bytes_to_send = NULL; + tsi_handshaker_result* handshaker_result = nullptr; + unsigned char* bytes_to_send = nullptr; size_t bytes_to_send_size = 0; tsi_result result = TSI_OK; /* Receive data from peer, if available. */ @@ -399,7 +399,7 @@ void tsi_test_do_handshake(tsi_test_fixture* fixture) { break; } GPR_ASSERT(client_args->transferred_data || server_args->transferred_data); - } while (fixture->client_result == NULL || fixture->server_result == NULL); + } while (fixture->client_result == nullptr || fixture->server_result == nullptr); /* Verify handshake results. */ check_handshake_results(fixture); /* Cleanup. */ @@ -409,11 +409,11 @@ void tsi_test_do_handshake(tsi_test_fixture* fixture) { void tsi_test_do_round_trip(tsi_test_fixture* fixture) { /* Initialization. */ - GPR_ASSERT(fixture != NULL); - GPR_ASSERT(fixture->config != NULL); + GPR_ASSERT(fixture != nullptr); + GPR_ASSERT(fixture->config != nullptr); tsi_test_frame_protector_config* config = fixture->config; - tsi_frame_protector* client_frame_protector = NULL; - tsi_frame_protector* server_frame_protector = NULL; + tsi_frame_protector* client_frame_protector = nullptr; + tsi_frame_protector* server_frame_protector = nullptr; /* Perform handshake. */ tsi_test_do_handshake(fixture); /* Create frame protectors.*/ @@ -422,7 +422,7 @@ void tsi_test_do_round_trip(tsi_test_fixture* fixture) { GPR_ASSERT(tsi_handshaker_result_create_frame_protector( fixture->client_result, client_max_output_protected_frame_size == 0 - ? NULL + ? nullptr : &client_max_output_protected_frame_size, &client_frame_protector) == TSI_OK); size_t server_max_output_protected_frame_size = @@ -430,7 +430,7 @@ void tsi_test_do_round_trip(tsi_test_fixture* fixture) { GPR_ASSERT(tsi_handshaker_result_create_frame_protector( fixture->server_result, server_max_output_protected_frame_size == 0 - ? NULL + ? nullptr : &server_max_output_protected_frame_size, &server_frame_protector) == TSI_OK); /* Client sends a message to server. */ @@ -536,7 +536,7 @@ void tsi_test_frame_protector_config_set_buffer_size( size_t message_buffer_allocated_size, size_t protected_buffer_size, size_t client_max_output_protected_frame_size, size_t server_max_output_protected_frame_size) { - GPR_ASSERT(config != NULL); + GPR_ASSERT(config != nullptr); config->read_buffer_allocated_size = read_buffer_allocated_size; config->message_buffer_allocated_size = message_buffer_allocated_size; config->protected_buffer_size = protected_buffer_size; @@ -548,7 +548,7 @@ void tsi_test_frame_protector_config_set_buffer_size( void tsi_test_frame_protector_config_destroy( tsi_test_frame_protector_config* config) { - GPR_ASSERT(config != NULL); + GPR_ASSERT(config != nullptr); gpr_free(config->client_message); gpr_free(config->server_message); gpr_free(config); @@ -574,7 +574,7 @@ void tsi_test_fixture_init(tsi_test_fixture* fixture) { } void tsi_test_fixture_destroy(tsi_test_fixture* fixture) { - GPR_ASSERT(fixture != NULL); + GPR_ASSERT(fixture != nullptr); tsi_test_frame_protector_config_destroy(fixture->config); tsi_handshaker_destroy(fixture->client_handshaker); tsi_handshaker_destroy(fixture->server_handshaker); @@ -582,8 +582,8 @@ void tsi_test_fixture_destroy(tsi_test_fixture* fixture) { tsi_handshaker_result_destroy(fixture->server_result); gpr_free(fixture->client_channel); gpr_free(fixture->server_channel); - GPR_ASSERT(fixture->vtable != NULL); - GPR_ASSERT(fixture->vtable->destruct != NULL); + GPR_ASSERT(fixture->vtable != nullptr); + GPR_ASSERT(fixture->vtable->destruct != nullptr); fixture->vtable->destruct(fixture); gpr_mu_destroy(&fixture->mu); gpr_cv_destroy(&fixture->cv); diff --git a/test/core/util/debugger_macros.cc b/test/core/util/debugger_macros.cc index d344c3fb7499e..f1e4ffd3af988 100644 --- a/test/core/util/debugger_macros.cc +++ b/test/core/util/debugger_macros.cc @@ -37,16 +37,16 @@ grpc_stream* grpc_transport_stream_from_call(grpc_call* call) { grpc_call_element* el = grpc_call_stack_element(cs, cs->count - 1); if (el->filter == &grpc_client_channel_filter) { grpc_subchannel_call* scc = grpc_client_channel_get_subchannel_call(el); - if (scc == NULL) { + if (scc == nullptr) { fprintf(stderr, "No subchannel-call"); - return NULL; + return nullptr; } cs = grpc_subchannel_call_get_call_stack(scc); } else if (el->filter == &grpc_connected_filter) { return grpc_connected_channel_get_stream(el); } else { fprintf(stderr, "Unrecognized filter: %s", el->filter->name); - return NULL; + return nullptr; } } } diff --git a/test/core/util/fuzzer_corpus_test.cc b/test/core/util/fuzzer_corpus_test.cc index a5e99a1bacd36..d7aea54262d3e 100644 --- a/test/core/util/fuzzer_corpus_test.cc +++ b/test/core/util/fuzzer_corpus_test.cc @@ -32,6 +32,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size); extern "C" bool squelch; extern "C" bool leak_check; +// In some distros, gflags is in the namespace google, and in some others, +// in gflags. This hack is enabling us to find both. +namespace google {} +namespace gflags {} +using namespace google; +using namespace gflags; + DEFINE_string(file, "", "Use this file as test data"); DEFINE_string(directory, "", "Use this directory as test data"); @@ -65,7 +72,7 @@ class ExampleGenerator struct dirent* ep; dp = opendir(FLAGS_directory.c_str()); - if (dp != NULL) { + if (dp != nullptr) { while ((ep = readdir(dp)) != nullptr) { if (ep->d_type == DT_REG) { examples_.push_back(FLAGS_directory + "/" + ep->d_name); @@ -129,7 +136,7 @@ INSTANTIATE_TEST_CASE_P( int main(int argc, char** argv) { grpc_test_init(argc, argv); - ::gflags::ParseCommandLineFlags(&argc, &argv, true); + ParseCommandLineFlags(&argc, &argv, true); ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); diff --git a/test/core/util/memory_counters.cc b/test/core/util/memory_counters.cc index ff85a6380355c..32d7b89c9aae5 100644 --- a/test/core/util/memory_counters.cc +++ b/test/core/util/memory_counters.cc @@ -43,7 +43,7 @@ static void guard_free(void* vptr); static void* guard_malloc(size_t size) { size_t* ptr; - if (!size) return NULL; + if (!size) return nullptr; NO_BARRIER_FETCH_ADD(&g_memory_counters.total_size_absolute, (gpr_atm)size); NO_BARRIER_FETCH_ADD(&g_memory_counters.total_size_relative, (gpr_atm)size); NO_BARRIER_FETCH_ADD(&g_memory_counters.total_allocs_absolute, (gpr_atm)1); @@ -55,12 +55,12 @@ static void* guard_malloc(size_t size) { static void* guard_realloc(void* vptr, size_t size) { size_t* ptr = (size_t*)vptr; - if (vptr == NULL) { + if (vptr == nullptr) { return guard_malloc(size); } if (size == 0) { guard_free(vptr); - return NULL; + return nullptr; } --ptr; NO_BARRIER_FETCH_ADD(&g_memory_counters.total_size_absolute, (gpr_atm)size); @@ -81,7 +81,7 @@ static void guard_free(void* vptr) { g_old_allocs.free_fn(ptr); } -struct gpr_allocation_functions g_guard_allocs = {guard_malloc, NULL, +struct gpr_allocation_functions g_guard_allocs = {guard_malloc, nullptr, guard_realloc, guard_free}; void grpc_memory_counters_init() { diff --git a/test/core/util/mock_endpoint.cc b/test/core/util/mock_endpoint.cc index a467dcdc184ed..d9545efa4997c 100644 --- a/test/core/util/mock_endpoint.cc +++ b/test/core/util/mock_endpoint.cc @@ -81,7 +81,7 @@ static void me_shutdown(grpc_exec_ctx* exec_ctx, grpc_endpoint* ep, GRPC_CLOSURE_SCHED(exec_ctx, m->on_read, GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING( "Endpoint Shutdown", &why, 1)); - m->on_read = NULL; + m->on_read = nullptr; } gpr_mu_unlock(&m->mu); grpc_resource_user_shutdown(exec_ctx, m->resource_user); @@ -130,7 +130,7 @@ grpc_endpoint* grpc_mock_endpoint_create(void (*on_write)(grpc_slice slice), grpc_slice_buffer_init(&m->read_buffer); gpr_mu_init(&m->mu); m->on_write = on_write; - m->on_read = NULL; + m->on_read = nullptr; return &m->base; } @@ -138,10 +138,10 @@ void grpc_mock_endpoint_put_read(grpc_exec_ctx* exec_ctx, grpc_endpoint* ep, grpc_slice slice) { grpc_mock_endpoint* m = (grpc_mock_endpoint*)ep; gpr_mu_lock(&m->mu); - if (m->on_read != NULL) { + if (m->on_read != nullptr) { grpc_slice_buffer_add(m->on_read_out, slice); GRPC_CLOSURE_SCHED(exec_ctx, m->on_read, GRPC_ERROR_NONE); - m->on_read = NULL; + m->on_read = nullptr; } else { grpc_slice_buffer_add(&m->read_buffer, slice); } diff --git a/test/core/util/parse_hexstring.cc b/test/core/util/parse_hexstring.cc index 6dee0f163ab74..622642a2981d0 100644 --- a/test/core/util/parse_hexstring.cc +++ b/test/core/util/parse_hexstring.cc @@ -21,7 +21,7 @@ grpc_slice parse_hexstring(const char* hexstring) { size_t nibbles = 0; - const char* p = 0; + const char* p = nullptr; uint8_t* out; uint8_t temp; grpc_slice slice; diff --git a/test/core/util/passthru_endpoint.cc b/test/core/util/passthru_endpoint.cc index acce90201035d..a9efe22b6969f 100644 --- a/test/core/util/passthru_endpoint.cc +++ b/test/core/util/passthru_endpoint.cc @@ -85,12 +85,12 @@ static void me_write(grpc_exec_ctx* exec_ctx, grpc_endpoint* ep, gpr_atm_no_barrier_fetch_add(&m->parent->stats->num_writes, (gpr_atm)1); if (m->parent->shutdown) { error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("Endpoint already shutdown"); - } else if (m->on_read != NULL) { + } else if (m->on_read != nullptr) { for (size_t i = 0; i < slices->count; i++) { grpc_slice_buffer_add(m->on_read_out, grpc_slice_copy(slices->slices[i])); } GRPC_CLOSURE_SCHED(exec_ctx, m->on_read, GRPC_ERROR_NONE); - m->on_read = NULL; + m->on_read = nullptr; } else { for (size_t i = 0; i < slices->count; i++) { grpc_slice_buffer_add(&m->read_buffer, @@ -120,14 +120,14 @@ static void me_shutdown(grpc_exec_ctx* exec_ctx, grpc_endpoint* ep, GRPC_CLOSURE_SCHED( exec_ctx, m->on_read, GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING("Shutdown", &why, 1)); - m->on_read = NULL; + m->on_read = nullptr; } m = other_half(m); if (m->on_read) { GRPC_CLOSURE_SCHED( exec_ctx, m->on_read, GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING("Shutdown", &why, 1)); - m->on_read = NULL; + m->on_read = nullptr; } gpr_mu_unlock(&m->parent->mu); grpc_resource_user_shutdown(exec_ctx, m->resource_user); @@ -182,7 +182,7 @@ static void half_init(half* m, passthru_endpoint* parent, m->base.vtable = &vtable; m->parent = parent; grpc_slice_buffer_init(&m->read_buffer); - m->on_read = NULL; + m->on_read = nullptr; char* name; gpr_asprintf(&name, "passthru_endpoint_%s_%" PRIxPTR, half_name, (intptr_t)parent); @@ -197,7 +197,7 @@ void grpc_passthru_endpoint_create(grpc_endpoint** client, passthru_endpoint* m = (passthru_endpoint*)gpr_malloc(sizeof(*m)); m->halves = 2; m->shutdown = 0; - m->stats = stats == NULL ? &m->dummy_stats : stats; + m->stats = stats == nullptr ? &m->dummy_stats : stats; memset(m->stats, 0, sizeof(*m->stats)); half_init(&m->client, m, resource_quota, "client"); half_init(&m->server, m, resource_quota, "server"); diff --git a/test/core/util/port.cc b/test/core/util/port.cc index c5bebe08e77a4..9d02b673edd3d 100644 --- a/test/core/util/port.cc +++ b/test/core/util/port.cc @@ -36,7 +36,7 @@ #include "src/core/lib/iomgr/sockaddr_utils.h" #include "test/core/util/port_server_client.h" -static int* chosen_ports = NULL; +static int* chosen_ports = nullptr; static size_t num_chosen_ports = 0; static int free_chosen_port(int port) { @@ -71,7 +71,7 @@ static void free_chosen_ports(void) { } static void chose_port(int port) { - if (chosen_ports == NULL) { + if (chosen_ports == nullptr) { atexit(free_chosen_ports); } num_chosen_ports++; @@ -123,9 +123,9 @@ void grpc_recycle_unused_port(int port) { } void grpc_set_pick_port_functions(grpc_pick_port_functions functions) { - GPR_ASSERT(functions.pick_unused_port_fn != NULL); - GPR_ASSERT(functions.pick_unused_port_or_die_fn != NULL); - GPR_ASSERT(functions.recycle_unused_port_fn != NULL); + GPR_ASSERT(functions.pick_unused_port_fn != nullptr); + GPR_ASSERT(functions.pick_unused_port_or_die_fn != nullptr); + GPR_ASSERT(functions.recycle_unused_port_fn != nullptr); g_pick_port_functions = functions; } diff --git a/test/core/util/port_server_client.cc b/test/core/util/port_server_client.cc index 927bc91d38b4a..edec50b42408a 100644 --- a/test/core/util/port_server_client.cc +++ b/test/core/util/port_server_client.cc @@ -55,7 +55,7 @@ static void freed_port_from_server(grpc_exec_ctx* exec_ctx, void* arg, GRPC_LOG_IF_ERROR( "pollset_kick", grpc_pollset_kick(exec_ctx, grpc_polling_entity_pollset(&pr->pops), - NULL)); + nullptr)); gpr_mu_unlock(pr->mu); } @@ -96,7 +96,7 @@ void grpc_free_port_using_server(int port) { grpc_exec_ctx_flush(&exec_ctx); gpr_mu_lock(pr.mu); while (!pr.done) { - grpc_pollset_worker* worker = NULL; + grpc_pollset_worker* worker = nullptr; if (!GRPC_LOG_IF_ERROR( "pollset_work", grpc_pollset_work(&exec_ctx, grpc_polling_entity_pollset(&pr.pops), @@ -155,7 +155,7 @@ static void got_port_from_server(grpc_exec_ctx* exec_ctx, void* arg, GRPC_LOG_IF_ERROR( "pollset_kick", grpc_pollset_kick(exec_ctx, grpc_polling_entity_pollset(&pr->pops), - NULL)); + nullptr)); gpr_mu_unlock(pr->mu); return; } @@ -192,7 +192,7 @@ static void got_port_from_server(grpc_exec_ctx* exec_ctx, void* arg, GRPC_LOG_IF_ERROR( "pollset_kick", grpc_pollset_kick(exec_ctx, grpc_polling_entity_pollset(&pr->pops), - NULL)); + nullptr)); gpr_mu_unlock(pr->mu); } @@ -231,7 +231,7 @@ int grpc_pick_port_using_server(void) { grpc_exec_ctx_flush(&exec_ctx); gpr_mu_lock(pr.mu); while (pr.port == -1) { - grpc_pollset_worker* worker = NULL; + grpc_pollset_worker* worker = nullptr; if (!GRPC_LOG_IF_ERROR( "pollset_work", grpc_pollset_work(&exec_ctx, grpc_polling_entity_pollset(&pr.pops), diff --git a/test/core/util/reconnect_server.cc b/test/core/util/reconnect_server.cc index c7c0595d7f06f..4775b074eb54e 100644 --- a/test/core/util/reconnect_server.cc +++ b/test/core/util/reconnect_server.cc @@ -70,10 +70,10 @@ static void on_connect(grpc_exec_ctx* exec_ctx, void* arg, grpc_endpoint* tcp, grpc_endpoint_destroy(exec_ctx, tcp); if (peer) { last_colon = strrchr(peer, ':'); - if (server->peer == NULL) { + if (server->peer == nullptr) { server->peer = peer; } else { - if (last_colon == NULL) { + if (last_colon == nullptr) { gpr_log(GPR_ERROR, "peer does not contain a ':'"); } else if (strncmp(server->peer, peer, (size_t)(last_colon - peer)) != 0) { @@ -84,8 +84,8 @@ static void on_connect(grpc_exec_ctx* exec_ctx, void* arg, grpc_endpoint* tcp, } new_tail = static_cast(gpr_malloc(sizeof(timestamp_list))); new_tail->timestamp = now; - new_tail->next = NULL; - if (server->tail == NULL) { + new_tail->next = nullptr; + if (server->tail == nullptr) { server->head = new_tail; server->tail = new_tail; } else { @@ -97,9 +97,9 @@ static void on_connect(grpc_exec_ctx* exec_ctx, void* arg, grpc_endpoint* tcp, void reconnect_server_init(reconnect_server* server) { test_tcp_server_init(&server->tcp_server, on_connect, server); - server->head = NULL; - server->tail = NULL; - server->peer = NULL; + server->head = nullptr; + server->tail = nullptr; + server->peer = nullptr; server->max_reconnect_backoff_ms = 0; } @@ -118,9 +118,9 @@ void reconnect_server_clear_timestamps(reconnect_server* server) { gpr_free(server->head); server->head = new_head; } - server->tail = NULL; + server->tail = nullptr; gpr_free(server->peer); - server->peer = NULL; + server->peer = nullptr; } void reconnect_server_destroy(reconnect_server* server) { diff --git a/test/core/util/slice_splitter.cc b/test/core/util/slice_splitter.cc index e25e1d862a17a..7225b6dc03b52 100644 --- a/test/core/util/slice_splitter.cc +++ b/test/core/util/slice_splitter.cc @@ -105,7 +105,7 @@ void grpc_split_slice_buffer(grpc_slice_split_mode mode, grpc_slice_buffer* src, } grpc_slice grpc_slice_merge(grpc_slice* slices, size_t nslices) { - uint8_t* out = NULL; + uint8_t* out = nullptr; size_t length = 0; size_t capacity = 0; size_t i; diff --git a/test/core/util/test_config.cc b/test/core/util/test_config.cc index 3106fb01ea31f..aeaa38ac65fc1 100644 --- a/test/core/util/test_config.cc +++ b/test/core/util/test_config.cc @@ -203,7 +203,7 @@ static void install_crash_handler() { #define SIGNAL_NAMES_LENGTH 32 static const char* const signal_names[] = { - NULL, "SIGHUP", "SIGINT", "SIGQUIT", "SIGILL", "SIGTRAP", + nullptr, "SIGHUP", "SIGINT", "SIGQUIT", "SIGILL", "SIGTRAP", "SIGABRT", "SIGBUS", "SIGFPE", "SIGKILL", "SIGUSR1", "SIGSEGV", "SIGUSR2", "SIGPIPE", "SIGALRM", "SIGTERM", "SIGSTKFLT", "SIGCHLD", "SIGCONT", "SIGSTOP", "SIGTSTP", "SIGTTIN", "SIGTTOU", "SIGURG", @@ -263,15 +263,15 @@ static void install_crash_handler() { memset(&sa, 0, sizeof(sa)); ss.ss_size = sizeof(g_alt_stack); ss.ss_sp = g_alt_stack; - GPR_ASSERT(sigaltstack(&ss, NULL) == 0); + GPR_ASSERT(sigaltstack(&ss, nullptr) == 0); sa.sa_flags = (int)(SA_SIGINFO | SA_ONSTACK | SA_RESETHAND); sa.sa_sigaction = crash_handler; - GPR_ASSERT(sigaction(SIGILL, &sa, NULL) == 0); - GPR_ASSERT(sigaction(SIGABRT, &sa, NULL) == 0); - GPR_ASSERT(sigaction(SIGBUS, &sa, NULL) == 0); - GPR_ASSERT(sigaction(SIGSEGV, &sa, NULL) == 0); - GPR_ASSERT(sigaction(SIGTERM, &sa, NULL) == 0); - GPR_ASSERT(sigaction(SIGQUIT, &sa, NULL) == 0); + GPR_ASSERT(sigaction(SIGILL, &sa, nullptr) == 0); + GPR_ASSERT(sigaction(SIGABRT, &sa, nullptr) == 0); + GPR_ASSERT(sigaction(SIGBUS, &sa, nullptr) == 0); + GPR_ASSERT(sigaction(SIGSEGV, &sa, nullptr) == 0); + GPR_ASSERT(sigaction(SIGTERM, &sa, nullptr) == 0); + GPR_ASSERT(sigaction(SIGQUIT, &sa, nullptr) == 0); } #else static void install_crash_handler() {} @@ -380,7 +380,7 @@ void grpc_test_init(int argc, char** argv) { install_crash_handler(); { /* poll-cv poll strategy runs much more slowly than anything else */ char* s = gpr_getenv("GRPC_POLL_STRATEGY"); - if (s != NULL && 0 == strcmp(s, "poll-cv")) { + if (s != nullptr && 0 == strcmp(s, "poll-cv")) { g_poller_slowdown_factor = 5; } gpr_free(s); diff --git a/test/core/util/test_tcp_server.cc b/test/core/util/test_tcp_server.cc index 925209d255ab5..da34da6fd0059 100644 --- a/test/core/util/test_tcp_server.cc +++ b/test/core/util/test_tcp_server.cc @@ -42,7 +42,7 @@ static void on_server_destroyed(grpc_exec_ctx* exec_ctx, void* data, void test_tcp_server_init(test_tcp_server* server, grpc_tcp_server_cb on_connect, void* user_data) { grpc_init(); - server->tcp_server = NULL; + server->tcp_server = nullptr; GRPC_CLOSURE_INIT(&server->shutdown_complete, on_server_destroyed, server, grpc_schedule_on_exec_ctx); server->shutdown = 0; @@ -63,7 +63,7 @@ void test_tcp_server_start(test_tcp_server* server, int port) { memset(&addr->sin_addr, 0, sizeof(addr->sin_addr)); grpc_error* error = grpc_tcp_server_create( - &exec_ctx, &server->shutdown_complete, NULL, &server->tcp_server); + &exec_ctx, &server->shutdown_complete, nullptr, &server->tcp_server); GPR_ASSERT(error == GRPC_ERROR_NONE); error = grpc_tcp_server_add_port(server->tcp_server, &resolved_addr, &port_added); @@ -78,7 +78,7 @@ void test_tcp_server_start(test_tcp_server* server, int port) { } void test_tcp_server_poll(test_tcp_server* server, int seconds) { - grpc_pollset_worker* worker = NULL; + grpc_pollset_worker* worker = nullptr; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_millis deadline = grpc_timespec_to_millis_round_up( grpc_timeout_seconds_to_deadline(seconds)); @@ -101,7 +101,7 @@ void test_tcp_server_destroy(test_tcp_server* server) { gpr_timespec shutdown_deadline; grpc_closure do_nothing_cb; grpc_tcp_server_unref(&exec_ctx, server->tcp_server); - GRPC_CLOSURE_INIT(&do_nothing_cb, do_nothing, NULL, + GRPC_CLOSURE_INIT(&do_nothing_cb, do_nothing, nullptr, grpc_schedule_on_exec_ctx); shutdown_deadline = gpr_time_add(gpr_now(GPR_CLOCK_MONOTONIC), gpr_time_from_seconds(5, GPR_TIMESPAN)); diff --git a/test/core/util/trickle_endpoint.cc b/test/core/util/trickle_endpoint.cc index c8b54b481dd9a..63d9728600866 100644 --- a/test/core/util/trickle_endpoint.cc +++ b/test/core/util/trickle_endpoint.cc @@ -53,10 +53,10 @@ static void te_read(grpc_exec_ctx* exec_ctx, grpc_endpoint* ep, static void maybe_call_write_cb_locked(grpc_exec_ctx* exec_ctx, trickle_endpoint* te) { - if (te->write_cb != NULL && (te->error != GRPC_ERROR_NONE || + if (te->write_cb != nullptr && (te->error != GRPC_ERROR_NONE || te->write_buffer.length <= WRITE_BUFFER_SIZE)) { GRPC_CLOSURE_SCHED(exec_ctx, te->write_cb, GRPC_ERROR_REF(te->error)); - te->write_cb = NULL; + te->write_cb = nullptr; } } @@ -64,7 +64,7 @@ static void te_write(grpc_exec_ctx* exec_ctx, grpc_endpoint* ep, grpc_slice_buffer* slices, grpc_closure* cb) { trickle_endpoint* te = (trickle_endpoint*)ep; gpr_mu_lock(&te->mu); - GPR_ASSERT(te->write_cb == NULL); + GPR_ASSERT(te->write_cb == nullptr); if (te->write_buffer.length == 0) { te->last_write = gpr_now(GPR_CLOCK_MONOTONIC); } @@ -159,7 +159,7 @@ grpc_endpoint* grpc_trickle_endpoint_create(grpc_endpoint* wrap, te->base.vtable = &vtable; te->wrapped = wrap; te->bytes_per_second = bytes_per_second; - te->write_cb = NULL; + te->write_cb = nullptr; gpr_mu_init(&te->mu); grpc_slice_buffer_init(&te->write_buffer); grpc_slice_buffer_init(&te->writing_buffer); diff --git a/test/cpp/codegen/proto_utils_test.cc b/test/cpp/codegen/proto_utils_test.cc index fd05c90e9dcc1..2b853b1bea22a 100644 --- a/test/cpp/codegen/proto_utils_test.cc +++ b/test/cpp/codegen/proto_utils_test.cc @@ -63,7 +63,7 @@ TEST_F(ProtoUtilsTest, BackupNext) { EXPECT_TRUE(!peer.have_backup()); // On the next allocation, the slice is non-inlined. ASSERT_TRUE(writer.Next(&data, &size)); - EXPECT_TRUE(peer.slice().refcount != NULL); + EXPECT_TRUE(peer.slice().refcount != nullptr); // Cleanup. g_core_codegen_interface->grpc_byte_buffer_destroy(bp); diff --git a/test/cpp/common/auth_property_iterator_test.cc b/test/cpp/common/auth_property_iterator_test.cc index 4a097e8739e13..fce409aa2fe9c 100644 --- a/test/cpp/common/auth_property_iterator_test.cc +++ b/test/cpp/common/auth_property_iterator_test.cc @@ -40,7 +40,7 @@ class TestAuthPropertyIterator : public AuthPropertyIterator { class AuthPropertyIteratorTest : public ::testing::Test { protected: void SetUp() override { - ctx_ = grpc_auth_context_create(NULL); + ctx_ = grpc_auth_context_create(nullptr); grpc_auth_context_add_cstring_property(ctx_, "name", "chapi"); grpc_auth_context_add_cstring_property(ctx_, "name", "chapo"); grpc_auth_context_add_cstring_property(ctx_, "foo", "bar"); diff --git a/test/cpp/common/secure_auth_context_test.cc b/test/cpp/common/secure_auth_context_test.cc index 0cc32c18530b9..7a0530c20a882 100644 --- a/test/cpp/common/secure_auth_context_test.cc +++ b/test/cpp/common/secure_auth_context_test.cc @@ -42,7 +42,7 @@ TEST_F(SecureAuthContextTest, EmptyContext) { } TEST_F(SecureAuthContextTest, Properties) { - grpc_auth_context* ctx = grpc_auth_context_create(NULL); + grpc_auth_context* ctx = grpc_auth_context_create(nullptr); SecureAuthContext context(ctx, true); context.AddProperty("name", "chapi"); context.AddProperty("name", "chapo"); @@ -60,7 +60,7 @@ TEST_F(SecureAuthContextTest, Properties) { } TEST_F(SecureAuthContextTest, Iterators) { - grpc_auth_context* ctx = grpc_auth_context_create(NULL); + grpc_auth_context* ctx = grpc_auth_context_create(nullptr); SecureAuthContext context(ctx, true); context.AddProperty("name", "chapi"); context.AddProperty("name", "chapo"); diff --git a/test/cpp/end2end/async_end2end_test.cc b/test/cpp/end2end/async_end2end_test.cc index 5b6e9aa312167..1ea087e706ad9 100644 --- a/test/cpp/end2end/async_end2end_test.cc +++ b/test/cpp/end2end/async_end2end_test.cc @@ -466,7 +466,7 @@ TEST_P(AsyncEnd2endTest, ReconnectChannel) { // It needs 2 pollset_works to reconnect the channel with polling engine // "poll" char* s = gpr_getenv("GRPC_POLL_STRATEGY"); - if (s != NULL && 0 == strcmp(s, "poll")) { + if (s != nullptr && 0 == strcmp(s, "poll")) { poller_slowdown_factor = 2; } gpr_free(s); diff --git a/test/cpp/end2end/client_lb_end2end_test.cc b/test/cpp/end2end/client_lb_end2end_test.cc index 95630a771471a..894143cbc80b8 100644 --- a/test/cpp/end2end/client_lb_end2end_test.cc +++ b/test/cpp/end2end/client_lb_end2end_test.cc @@ -113,22 +113,22 @@ class ClientLbEnd2endTest : public ::testing::Test { void SetNextResolution(const std::vector& ports) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_lb_addresses* addresses = grpc_lb_addresses_create(ports.size(), NULL); + grpc_lb_addresses* addresses = grpc_lb_addresses_create(ports.size(), nullptr); for (size_t i = 0; i < ports.size(); ++i) { char* lb_uri_str; gpr_asprintf(&lb_uri_str, "ipv4:127.0.0.1:%d", ports[i]); grpc_uri* lb_uri = grpc_uri_parse(&exec_ctx, lb_uri_str, true); - GPR_ASSERT(lb_uri != NULL); + GPR_ASSERT(lb_uri != nullptr); grpc_lb_addresses_set_address_from_uri(addresses, i, lb_uri, false /* is balancer */, - "" /* balancer name */, NULL); + "" /* balancer name */, nullptr); grpc_uri_destroy(lb_uri); gpr_free(lb_uri_str); } const grpc_arg fake_addresses = grpc_lb_addresses_create_channel_arg(addresses); grpc_channel_args* fake_result = - grpc_channel_args_copy_and_add(NULL, &fake_addresses, 1); + grpc_channel_args_copy_and_add(nullptr, &fake_addresses, 1); grpc_fake_resolver_response_generator_set_response( &exec_ctx, response_generator_, fake_result); grpc_channel_args_destroy(&exec_ctx, fake_result); diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index 82ca39466efce..c71034bbe8eb1 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -711,7 +711,7 @@ TEST_P(End2endTest, ReconnectChannel) { // It needs 2 pollset_works to reconnect the channel with polling engine // "poll" char* s = gpr_getenv("GRPC_POLL_STRATEGY"); - if (s != NULL && 0 == strcmp(s, "poll")) { + if (s != nullptr && 0 == strcmp(s, "poll")) { poller_slowdown_factor = 2; } gpr_free(s); @@ -1148,7 +1148,7 @@ TEST_P(End2endTest, ChannelState) { CompletionQueue cq; std::chrono::system_clock::time_point deadline = std::chrono::system_clock::now() + std::chrono::milliseconds(10); - channel_->NotifyOnStateChange(GRPC_CHANNEL_IDLE, deadline, &cq, NULL); + channel_->NotifyOnStateChange(GRPC_CHANNEL_IDLE, deadline, &cq, nullptr); void* tag; bool ok = true; cq.Next(&tag, &ok); diff --git a/test/cpp/grpclb/grpclb_api_test.cc b/test/cpp/grpclb/grpclb_api_test.cc index 6b0350e1f91b8..7b62080b4974f 100644 --- a/test/cpp/grpclb/grpclb_api_test.cc +++ b/test/cpp/grpclb/grpclb_api_test.cc @@ -48,7 +48,7 @@ grpc::string PackedStringToIp(const grpc_grpclb_ip_address& pb_ip) { } else { abort(); } - GPR_ASSERT(inet_ntop(af, (void*)pb_ip.bytes, ip_str, 46) != NULL); + GPR_ASSERT(inet_ntop(af, (void*)pb_ip.bytes, ip_str, 46) != nullptr); return ip_str; } diff --git a/test/cpp/grpclb/grpclb_test.cc b/test/cpp/grpclb/grpclb_test.cc index a7647344c018a..1cc529991e7e8 100644 --- a/test/cpp/grpclb/grpclb_test.cc +++ b/test/cpp/grpclb/grpclb_test.cc @@ -159,7 +159,7 @@ static void drain_cq(grpc_completion_queue* cq) { grpc_event ev; do { ev = grpc_completion_queue_next(cq, grpc_timeout_seconds_to_deadline(5), - NULL); + nullptr); } while (ev.type != GRPC_QUEUE_SHUTDOWN); } @@ -198,16 +198,16 @@ static void start_lb_server(server_fixture* sf, int* ports, size_t nports, // make sure we've received the initial metadata from the grpclb request. GPR_ASSERT(request_metadata_recv.count > 0); - GPR_ASSERT(request_metadata_recv.metadata != NULL); + GPR_ASSERT(request_metadata_recv.metadata != nullptr); // receive request for backends op = ops; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &request_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(202), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(202), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(202), 1); cq_verify(cqv); @@ -232,14 +232,14 @@ static void start_lb_server(server_fixture* sf, int* ports, size_t nports, 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_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(201), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(201), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); gpr_log(GPR_INFO, "LB Server[%s](%s) after tag 201", sf->servers_hostport, sf->balancer_name); @@ -262,9 +262,9 @@ static void start_lb_server(server_fixture* sf, int* ports, size_t nports, op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = response_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(203), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(203), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(203), 1); cq_verify(cqv); @@ -284,9 +284,9 @@ static void start_lb_server(server_fixture* sf, int* ports, size_t nports, grpc_slice status_details = grpc_slice_from_static_string("xyz"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(204), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(204), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(201), 1); @@ -329,7 +329,7 @@ static void start_backend_server(server_fixture* sf) { GPR_ASSERT(GRPC_CALL_OK == error); gpr_log(GPR_INFO, "Server[%s] up", sf->servers_hostport); ev = grpc_completion_queue_next(sf->cq, - grpc_timeout_seconds_to_deadline(60), NULL); + grpc_timeout_seconds_to_deadline(60), nullptr); if (!ev.success) { gpr_log(GPR_INFO, "Server[%s] being torn down", sf->servers_hostport); cq_verifier_destroy(cqv); @@ -351,14 +351,14 @@ static void start_backend_server(server_fixture* sf) { 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_CLOSE_ON_SERVER; op->data.recv_close_on_server.cancelled = &was_cancelled; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(101), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(101), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); gpr_log(GPR_INFO, "Server[%s] after tag 101", sf->servers_hostport); @@ -369,15 +369,15 @@ static void start_backend_server(server_fixture* sf) { op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &request_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(102), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); ev = grpc_completion_queue_next( - sf->cq, grpc_timeout_seconds_to_deadline(3), NULL); + sf->cq, grpc_timeout_seconds_to_deadline(3), nullptr); if (ev.type == GRPC_OP_COMPLETE && ev.success) { GPR_ASSERT(ev.tag = tag(102)); - if (request_payload_recv == NULL) { + if (request_payload_recv == nullptr) { exit = true; gpr_log(GPR_INFO, "Server[%s] recv \"close\" from client, exiting. Call #%d", @@ -398,13 +398,13 @@ static void start_backend_server(server_fixture* sf) { op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = response_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; error = - grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), NULL); + grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(103), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); ev = grpc_completion_queue_next( - sf->cq, grpc_timeout_seconds_to_deadline(3), NULL); + sf->cq, grpc_timeout_seconds_to_deadline(3), nullptr); if (ev.type == GRPC_OP_COMPLETE && ev.success) { GPR_ASSERT(ev.tag = tag(103)); } else { @@ -432,9 +432,9 @@ static void start_backend_server(server_fixture* sf) { grpc_slice_from_static_string("Backend server out a-ok"); op->data.send_status_from_server.status_details = &status_details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(104), NULL); + error = grpc_call_start_batch(s, ops, (size_t)(op - ops), tag(104), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(101), 1); @@ -469,10 +469,10 @@ static void perform_request(client_fixture* cf) { grpc_slice_from_copied_string("hello world"); grpc_slice host = grpc_slice_from_static_string("foo.test.google.fr:1234"); - c = grpc_channel_create_call(cf->client, NULL, GRPC_PROPAGATE_DEFAULTS, + c = grpc_channel_create_call(cf->client, nullptr, GRPC_PROPAGATE_DEFAULTS, cf->cq, grpc_slice_from_static_string("/foo"), &host, grpc_timeout_seconds_to_deadline(5), - NULL); + nullptr); gpr_log(GPR_INFO, "Call 0x%" PRIxPTR " created", (intptr_t)c); GPR_ASSERT(c); char* peer; @@ -484,21 +484,21 @@ static void perform_request(client_fixture* cf) { 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 = &initial_metadata_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_STATUS_ON_CLIENT; op->data.recv_status_on_client.trailing_metadata = &trailing_metadata_recv; op->data.recv_status_on_client.status = &status; op->data.recv_status_on_client.status_details = &details; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(1), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); for (i = 0; i < 4; i++) { @@ -508,14 +508,14 @@ static void perform_request(client_fixture* cf) { op->op = GRPC_OP_SEND_MESSAGE; op->data.send_message.send_message = request_payload; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; op->op = GRPC_OP_RECV_MESSAGE; op->data.recv_message.recv_message = &response_payload_recv; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(2), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(2), 1); @@ -532,9 +532,9 @@ static void perform_request(client_fixture* cf) { op = ops; op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT; op->flags = 0; - op->reserved = NULL; + op->reserved = nullptr; op++; - error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), NULL); + error = grpc_call_start_batch(c, ops, (size_t)(op - ops), tag(3), nullptr); GPR_ASSERT(GRPC_CALL_OK == error); CQ_EXPECT_COMPLETION(cqv, tag(1), 1); @@ -560,20 +560,20 @@ static void setup_client(const server_fixture* lb_server, const server_fixture* backends, client_fixture* cf) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - char* expected_target_names = NULL; + char* expected_target_names = nullptr; const char* backends_name = lb_server->servers_hostport; gpr_asprintf(&expected_target_names, "%s;%s", backends_name, BALANCERS_NAME); grpc_fake_resolver_response_generator* response_generator = grpc_fake_resolver_response_generator_create(); - grpc_lb_addresses* addresses = grpc_lb_addresses_create(1, NULL); + grpc_lb_addresses* addresses = grpc_lb_addresses_create(1, nullptr); char* lb_uri_str; gpr_asprintf(&lb_uri_str, "ipv4:%s", lb_server->servers_hostport); grpc_uri* lb_uri = grpc_uri_parse(&exec_ctx, lb_uri_str, true); - GPR_ASSERT(lb_uri != NULL); + GPR_ASSERT(lb_uri != nullptr); grpc_lb_addresses_set_address_from_uri(addresses, 0, lb_uri, true, - lb_server->balancer_name, NULL); + lb_server->balancer_name, nullptr); grpc_uri_destroy(lb_uri); gpr_free(lb_uri_str); @@ -581,7 +581,7 @@ static void setup_client(const server_fixture* lb_server, const grpc_arg fake_addresses = grpc_lb_addresses_create_channel_arg(addresses); grpc_channel_args* fake_result = - grpc_channel_args_copy_and_add(NULL, &fake_addresses, 1); + grpc_channel_args_copy_and_add(nullptr, &fake_addresses, 1); grpc_lb_addresses_destroy(&exec_ctx, addresses); const grpc_arg new_args[] = { @@ -589,14 +589,14 @@ static void setup_client(const server_fixture* lb_server, grpc_fake_resolver_response_generator_arg(response_generator)}; grpc_channel_args* args = - grpc_channel_args_copy_and_add(NULL, new_args, GPR_ARRAY_SIZE(new_args)); + grpc_channel_args_copy_and_add(nullptr, new_args, GPR_ARRAY_SIZE(new_args)); gpr_free(expected_target_names); - cf->cq = grpc_completion_queue_create_for_next(NULL); + cf->cq = grpc_completion_queue_create_for_next(nullptr); grpc_channel_credentials* fake_creds = grpc_fake_transport_security_credentials_create(); cf->client = - grpc_secure_channel_create(fake_creds, cf->server_uri, args, NULL); + grpc_secure_channel_create(fake_creds, cf->server_uri, args, nullptr); grpc_fake_resolver_response_generator_set_response( &exec_ctx, response_generator, fake_result); grpc_channel_args_destroy(&exec_ctx, fake_result); @@ -610,16 +610,16 @@ static void teardown_client(client_fixture* cf) { grpc_completion_queue_shutdown(cf->cq); drain_cq(cf->cq); grpc_completion_queue_destroy(cf->cq); - cf->cq = NULL; + cf->cq = nullptr; grpc_channel_destroy(cf->client); - cf->client = NULL; + cf->client = nullptr; gpr_free(cf->server_uri); } static void setup_server(const char* host, server_fixture* sf) { int assigned_port; - sf->cq = grpc_completion_queue_create_for_next(NULL); + sf->cq = grpc_completion_queue_create_for_next(nullptr); const char* colon_idx = strchr(host, ':'); if (colon_idx) { const char* port_str = colon_idx + 1; @@ -633,8 +633,8 @@ static void setup_server(const char* host, server_fixture* sf) { grpc_server_credentials* server_creds = grpc_fake_transport_security_server_credentials_create(); - sf->server = grpc_server_create(NULL, NULL); - grpc_server_register_completion_queue(sf->server, sf->cq, NULL); + sf->server = grpc_server_create(nullptr, nullptr); + grpc_server_register_completion_queue(sf->server, sf->cq, nullptr); GPR_ASSERT((assigned_port = grpc_server_add_secure_http2_port( sf->server, sf->servers_hostport, server_creds)) > 0); grpc_server_credentials_release(server_creds); @@ -648,17 +648,17 @@ static void teardown_server(server_fixture* sf) { gpr_log(GPR_INFO, "Server[%s] shutting down", sf->servers_hostport); grpc_completion_queue* shutdown_cq = - grpc_completion_queue_create_for_pluck(NULL); + grpc_completion_queue_create_for_pluck(nullptr); grpc_server_shutdown_and_notify(sf->server, shutdown_cq, tag(1000)); GPR_ASSERT(grpc_completion_queue_pluck(shutdown_cq, tag(1000), grpc_timeout_seconds_to_deadline(5), - NULL) + nullptr) .type == GRPC_OP_COMPLETE); grpc_completion_queue_destroy(shutdown_cq); grpc_server_destroy(sf->server); gpr_thd_join(sf->tid); - sf->server = NULL; + sf->server = nullptr; grpc_completion_queue_shutdown(sf->cq); drain_cq(sf->cq); grpc_completion_queue_destroy(sf->cq); diff --git a/test/cpp/interop/http2_client.cc b/test/cpp/interop/http2_client.cc index 1e04e57d09d41..2de7abcf17e69 100644 --- a/test/cpp/interop/http2_client.cc +++ b/test/cpp/interop/http2_client.cc @@ -217,7 +217,7 @@ int main(int argc, char** argv) { "goaway", "max_streams", "ping", "rst_after_data", "rst_after_header", "rst_during_data"}; char* joined_testcases = - gpr_strjoin_sep(testcases, GPR_ARRAY_SIZE(testcases), "\n", NULL); + gpr_strjoin_sep(testcases, GPR_ARRAY_SIZE(testcases), "\n", nullptr); gpr_log(GPR_ERROR, "Unsupported test case %s. Valid options are\n%s", FLAGS_test_case.c_str(), joined_testcases); diff --git a/test/cpp/interop/stress_test.cc b/test/cpp/interop/stress_test.cc index 991fc88ad2bbe..028ff11b209ff 100644 --- a/test/cpp/interop/stress_test.cc +++ b/test/cpp/interop/stress_test.cc @@ -230,7 +230,7 @@ int main(int argc, char** argv) { log_level = FLAGS_log_level; gpr_set_log_function(TestLogFunction); - srand(time(NULL)); + srand(time(nullptr)); // Parse the server addresses std::vector server_addresses; diff --git a/test/cpp/microbenchmarks/bm_call_create.cc b/test/cpp/microbenchmarks/bm_call_create.cc index ec5c1275d1f9d..8102470d54993 100644 --- a/test/cpp/microbenchmarks/bm_call_create.cc +++ b/test/cpp/microbenchmarks/bm_call_create.cc @@ -91,7 +91,7 @@ class InsecureChannel : public BaseChannelFixture { public: InsecureChannel() : BaseChannelFixture( - grpc_insecure_channel_create("localhost:1234", NULL, NULL)) {} + grpc_insecure_channel_create("localhost:1234", nullptr, nullptr)) {} }; class LameChannel : public BaseChannelFixture { @@ -105,14 +105,14 @@ template static void BM_CallCreateDestroy(benchmark::State& state) { TrackCounters track_counters; Fixture fixture; - grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL); + grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr); gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); void* method_hdl = - grpc_channel_register_call(fixture.channel(), "/foo/bar", NULL, NULL); + grpc_channel_register_call(fixture.channel(), "/foo/bar", nullptr, nullptr); while (state.KeepRunning()) { grpc_call_unref(grpc_channel_create_registered_call( - fixture.channel(), NULL, GRPC_PROPAGATE_DEFAULTS, cq, method_hdl, - deadline, NULL)); + fixture.channel(), nullptr, GRPC_PROPAGATE_DEFAULTS, cq, method_hdl, + deadline, nullptr)); } grpc_completion_queue_destroy(cq); track_counters.Finish(state); @@ -161,7 +161,7 @@ static void BM_LameChannelCallCreateCore(benchmark::State& state) { grpc_completion_queue* cq; grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; - grpc_byte_buffer* response_payload_recv = NULL; + grpc_byte_buffer* response_payload_recv = nullptr; grpc_status_code status; grpc_slice details; grpc::testing::EchoRequest send_request; @@ -170,14 +170,14 @@ static void BM_LameChannelCallCreateCore(benchmark::State& state) { channel = grpc_lame_client_channel_create( "localhost:1234", GRPC_STATUS_UNAUTHENTICATED, "blah"); - cq = grpc_completion_queue_create_for_next(NULL); + cq = grpc_completion_queue_create_for_next(nullptr); void* rc = grpc_channel_register_call( - channel, "/grpc.testing.EchoTestService/Echo", NULL, NULL); + channel, "/grpc.testing.EchoTestService/Echo", nullptr, nullptr); while (state.KeepRunning()) { GPR_TIMER_SCOPE("BenchmarkCycle", 0); grpc_call* call = grpc_channel_create_registered_call( - channel, NULL, GRPC_PROPAGATE_DEFAULTS, cq, rc, - gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + channel, nullptr, GRPC_PROPAGATE_DEFAULTS, cq, rc, + gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&trailing_metadata_recv); grpc_byte_buffer* request_payload_send = @@ -210,9 +210,9 @@ static void BM_LameChannelCallCreateCore(benchmark::State& state) { GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call, ops, (size_t)(op - ops), - (void*)1, NULL)); + (void*)1, nullptr)); grpc_event ev = grpc_completion_queue_next( - cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + cq, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); GPR_ASSERT(ev.type != GRPC_QUEUE_SHUTDOWN); GPR_ASSERT(ev.success != 0); grpc_call_unref(call); @@ -235,7 +235,7 @@ static void BM_LameChannelCallCreateCoreSeparateBatch(benchmark::State& state) { grpc_completion_queue* cq; grpc_metadata_array initial_metadata_recv; grpc_metadata_array trailing_metadata_recv; - grpc_byte_buffer* response_payload_recv = NULL; + grpc_byte_buffer* response_payload_recv = nullptr; grpc_status_code status; grpc_slice details; grpc::testing::EchoRequest send_request; @@ -244,14 +244,14 @@ static void BM_LameChannelCallCreateCoreSeparateBatch(benchmark::State& state) { channel = grpc_lame_client_channel_create( "localhost:1234", GRPC_STATUS_UNAUTHENTICATED, "blah"); - cq = grpc_completion_queue_create_for_next(NULL); + cq = grpc_completion_queue_create_for_next(nullptr); void* rc = grpc_channel_register_call( - channel, "/grpc.testing.EchoTestService/Echo", NULL, NULL); + channel, "/grpc.testing.EchoTestService/Echo", nullptr, nullptr); while (state.KeepRunning()) { GPR_TIMER_SCOPE("BenchmarkCycle", 0); grpc_call* call = grpc_channel_create_registered_call( - channel, NULL, GRPC_PROPAGATE_DEFAULTS, cq, rc, - gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + channel, nullptr, GRPC_PROPAGATE_DEFAULTS, cq, rc, + gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); grpc_metadata_array_init(&initial_metadata_recv); grpc_metadata_array_init(&trailing_metadata_recv); grpc_byte_buffer* request_payload_send = @@ -271,7 +271,7 @@ static void BM_LameChannelCallCreateCoreSeparateBatch(benchmark::State& state) { op++; GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call, ops, (size_t)(op - ops), - (void*)0, NULL)); + (void*)nullptr, nullptr)); memset(ops, 0, sizeof(ops)); op = ops; op->op = GRPC_OP_RECV_INITIAL_METADATA; @@ -289,13 +289,13 @@ static void BM_LameChannelCallCreateCoreSeparateBatch(benchmark::State& state) { GPR_ASSERT(GRPC_CALL_OK == grpc_call_start_batch(call, ops, (size_t)(op - ops), - (void*)1, NULL)); + (void*)1, nullptr)); grpc_event ev = grpc_completion_queue_next( - cq, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); + cq, gpr_inf_future(GPR_CLOCK_REALTIME), nullptr); GPR_ASSERT(ev.type != GRPC_QUEUE_SHUTDOWN); GPR_ASSERT(ev.success == 0); ev = grpc_completion_queue_next(cq, gpr_inf_future(GPR_CLOCK_REALTIME), - NULL); + nullptr); GPR_ASSERT(ev.type != GRPC_QUEUE_SHUTDOWN); GPR_ASSERT(ev.success != 0); grpc_call_unref(call); @@ -538,7 +538,7 @@ static void BM_IsolatedFilter(benchmark::State& state) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; size_t channel_size = grpc_channel_stack_size( - filters.size() == 0 ? NULL : &filters[0], filters.size()); + filters.size() == 0 ? nullptr : &filters[0], filters.size()); grpc_channel_stack* channel_stack = static_cast(gpr_zalloc(channel_size)); GPR_ASSERT(GRPC_LOG_IF_ERROR( @@ -559,8 +559,8 @@ static void BM_IsolatedFilter(benchmark::State& state) { TestOp test_op_data; grpc_call_element_args call_args; call_args.call_stack = call_stack; - call_args.server_transport_data = NULL; - call_args.context = NULL; + call_args.server_transport_data = nullptr; + call_args.context = nullptr; call_args.path = method; call_args.start_time = start_time; call_args.deadline = deadline; @@ -569,9 +569,9 @@ static void BM_IsolatedFilter(benchmark::State& state) { while (state.KeepRunning()) { GPR_TIMER_SCOPE("BenchmarkCycle", 0); GRPC_ERROR_UNREF(grpc_call_stack_init(&exec_ctx, channel_stack, 1, - DoNothing, NULL, &call_args)); + DoNothing, nullptr, &call_args)); typename TestOp::Op op(&exec_ctx, &test_op_data, call_stack); - grpc_call_stack_destroy(&exec_ctx, call_stack, &final_info, NULL); + grpc_call_stack_destroy(&exec_ctx, call_stack, &final_info, nullptr); op.Finish(&exec_ctx); grpc_exec_ctx_flush(&exec_ctx); // recreate arena every 64k iterations to avoid oom @@ -708,14 +708,14 @@ class IsolatedCallFixture : public TrackCounters { grpc_channel_stack_builder_set_name(builder, "dummy"); grpc_channel_stack_builder_set_target(builder, "dummy_target"); GPR_ASSERT(grpc_channel_stack_builder_append_filter( - builder, &isolated_call_filter::isolated_call_filter, NULL, NULL)); + builder, &isolated_call_filter::isolated_call_filter, nullptr, nullptr)); { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; channel_ = grpc_channel_create_with_builder(&exec_ctx, builder, GRPC_CLIENT_CHANNEL); grpc_exec_ctx_finish(&exec_ctx); } - cq_ = grpc_completion_queue_create_for_next(NULL); + cq_ = grpc_completion_queue_create_for_next(nullptr); } void Finish(benchmark::State& state) { @@ -736,12 +736,12 @@ static void BM_IsolatedCall_NoOp(benchmark::State& state) { IsolatedCallFixture fixture; gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); void* method_hdl = - grpc_channel_register_call(fixture.channel(), "/foo/bar", NULL, NULL); + grpc_channel_register_call(fixture.channel(), "/foo/bar", nullptr, nullptr); while (state.KeepRunning()) { GPR_TIMER_SCOPE("BenchmarkCycle", 0); grpc_call_unref(grpc_channel_create_registered_call( fixture.channel(), nullptr, GRPC_PROPAGATE_DEFAULTS, fixture.cq(), - method_hdl, deadline, NULL)); + method_hdl, deadline, nullptr)); } fixture.Finish(state); } @@ -751,10 +751,10 @@ static void BM_IsolatedCall_Unary(benchmark::State& state) { IsolatedCallFixture fixture; gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); void* method_hdl = - grpc_channel_register_call(fixture.channel(), "/foo/bar", NULL, NULL); + grpc_channel_register_call(fixture.channel(), "/foo/bar", nullptr, nullptr); grpc_slice slice = grpc_slice_from_static_string("hello world"); grpc_byte_buffer* send_message = grpc_raw_byte_buffer_create(&slice, 1); - grpc_byte_buffer* recv_message = NULL; + grpc_byte_buffer* recv_message = nullptr; grpc_status_code status_code; grpc_slice status_details = grpc_empty_slice(); grpc_metadata_array recv_initial_metadata; @@ -780,10 +780,10 @@ static void BM_IsolatedCall_Unary(benchmark::State& state) { GPR_TIMER_SCOPE("BenchmarkCycle", 0); grpc_call* call = grpc_channel_create_registered_call( fixture.channel(), nullptr, GRPC_PROPAGATE_DEFAULTS, fixture.cq(), - method_hdl, deadline, NULL); - grpc_call_start_batch(call, ops, 6, tag(1), NULL); + method_hdl, deadline, nullptr); + grpc_call_start_batch(call, ops, 6, tag(1), nullptr); grpc_completion_queue_next(fixture.cq(), - gpr_inf_future(GPR_CLOCK_MONOTONIC), NULL); + gpr_inf_future(GPR_CLOCK_MONOTONIC), nullptr); grpc_call_unref(call); } fixture.Finish(state); @@ -797,7 +797,7 @@ static void BM_IsolatedCall_StreamingSend(benchmark::State& state) { IsolatedCallFixture fixture; gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); void* method_hdl = - grpc_channel_register_call(fixture.channel(), "/foo/bar", NULL, NULL); + grpc_channel_register_call(fixture.channel(), "/foo/bar", nullptr, nullptr); grpc_slice slice = grpc_slice_from_static_string("hello world"); grpc_byte_buffer* send_message = grpc_raw_byte_buffer_create(&slice, 1); grpc_metadata_array recv_initial_metadata; @@ -812,18 +812,18 @@ static void BM_IsolatedCall_StreamingSend(benchmark::State& state) { &recv_initial_metadata; grpc_call* call = grpc_channel_create_registered_call( fixture.channel(), nullptr, GRPC_PROPAGATE_DEFAULTS, fixture.cq(), - method_hdl, deadline, NULL); - grpc_call_start_batch(call, ops, 2, tag(1), NULL); + method_hdl, deadline, nullptr); + grpc_call_start_batch(call, ops, 2, tag(1), nullptr); grpc_completion_queue_next(fixture.cq(), gpr_inf_future(GPR_CLOCK_MONOTONIC), - NULL); + nullptr); memset(ops, 0, sizeof(ops)); ops[0].op = GRPC_OP_SEND_MESSAGE; ops[0].data.send_message.send_message = send_message; while (state.KeepRunning()) { GPR_TIMER_SCOPE("BenchmarkCycle", 0); - grpc_call_start_batch(call, ops, 1, tag(2), NULL); + grpc_call_start_batch(call, ops, 1, tag(2), nullptr); grpc_completion_queue_next(fixture.cq(), - gpr_inf_future(GPR_CLOCK_MONOTONIC), NULL); + gpr_inf_future(GPR_CLOCK_MONOTONIC), nullptr); } grpc_call_unref(call); fixture.Finish(state); diff --git a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc index 45f5382fdedb6..3fff8b02d6137 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_hpack.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_hpack.cc @@ -85,7 +85,7 @@ static void BM_HpackEncoderEncodeDeadline(benchmark::State& state) { (size_t)1024, &stats, }; - grpc_chttp2_encode_header(&exec_ctx, &c, NULL, 0, &b, &hopt, &outbuf); + grpc_chttp2_encode_header(&exec_ctx, &c, nullptr, 0, &b, &hopt, &outbuf); grpc_slice_buffer_reset_and_unref_internal(&exec_ctx, &outbuf); grpc_exec_ctx_flush(&exec_ctx); } @@ -136,7 +136,7 @@ static void BM_HpackEncoderEncodeHeader(benchmark::State& state) { (size_t)state.range(1), &stats, }; - grpc_chttp2_encode_header(&exec_ctx, &c, NULL, 0, &b, &hopt, &outbuf); + grpc_chttp2_encode_header(&exec_ctx, &c, nullptr, 0, &b, &hopt, &outbuf); if (!logged_representative_output && state.iterations() > 3) { logged_representative_output = true; for (size_t i = 0; i < outbuf.count; i++) { @@ -775,7 +775,7 @@ static void OnHeaderNew(grpc_exec_ctx* exec_ctx, void* user_data, grpc_millis* cached_timeout = static_cast(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)) { diff --git a/test/cpp/microbenchmarks/bm_chttp2_transport.cc b/test/cpp/microbenchmarks/bm_chttp2_transport.cc index 154cc917785d8..b95ee0cc01674 100644 --- a/test/cpp/microbenchmarks/bm_chttp2_transport.cc +++ b/test/cpp/microbenchmarks/bm_chttp2_transport.cc @@ -100,7 +100,7 @@ class DummyEndpoint : public grpc_endpoint { GRPC_CLOSURE_SCHED(exec_ctx, cb, GRPC_ERROR_NONE); } - static grpc_workqueue* get_workqueue(grpc_endpoint* ep) { return NULL; } + static grpc_workqueue* get_workqueue(grpc_endpoint* ep) { return nullptr; } static void add_to_pollset(grpc_exec_ctx* exec_ctx, grpc_endpoint* ep, grpc_pollset* pollset) {} @@ -137,7 +137,7 @@ class Fixture { grpc_channel_args c_args = args.c_channel_args(); ep_ = new DummyEndpoint; t_ = grpc_create_chttp2_transport(exec_ctx(), &c_args, ep_, client); - grpc_chttp2_transport_start_reading(exec_ctx(), t_, NULL); + grpc_chttp2_transport_start_reading(exec_ctx(), t_, nullptr); FlushExecCtx(); } @@ -222,7 +222,7 @@ class Stream { } grpc_transport_init_stream(f_->exec_ctx(), f_->transport(), static_cast(stream_), &refcount_, - NULL, arena_); + nullptr, arena_); } void DestroyThen(grpc_exec_ctx* exec_ctx, grpc_closure* closure) { @@ -586,7 +586,7 @@ static void BM_TransportStreamRecv(benchmark::State& state) { }); drain_start = MakeClosure([&](grpc_exec_ctx* exec_ctx, grpc_error* error) { - if (recv_stream == NULL) { + if (recv_stream == nullptr) { GPR_ASSERT(!state.KeepRunning()); return; } diff --git a/test/cpp/microbenchmarks/bm_closure.cc b/test/cpp/microbenchmarks/bm_closure.cc index 458a2ceb138ca..e603b7088958b 100644 --- a/test/cpp/microbenchmarks/bm_closure.cc +++ b/test/cpp/microbenchmarks/bm_closure.cc @@ -59,7 +59,7 @@ static void BM_ClosureInitAgainstExecCtx(benchmark::State& state) { grpc_closure c; while (state.KeepRunning()) { benchmark::DoNotOptimize( - GRPC_CLOSURE_INIT(&c, DoNothing, NULL, grpc_schedule_on_exec_ctx)); + GRPC_CLOSURE_INIT(&c, DoNothing, nullptr, grpc_schedule_on_exec_ctx)); } track_counters.Finish(state); } @@ -72,7 +72,7 @@ static void BM_ClosureInitAgainstCombiner(benchmark::State& state) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { benchmark::DoNotOptimize(GRPC_CLOSURE_INIT( - &c, DoNothing, NULL, grpc_combiner_scheduler(combiner))); + &c, DoNothing, nullptr, grpc_combiner_scheduler(combiner))); } GRPC_COMBINER_UNREF(&exec_ctx, combiner, "finished"); grpc_exec_ctx_finish(&exec_ctx); @@ -83,7 +83,7 @@ BENCHMARK(BM_ClosureInitAgainstCombiner); static void BM_ClosureRunOnExecCtx(benchmark::State& state) { TrackCounters track_counters; grpc_closure c; - GRPC_CLOSURE_INIT(&c, DoNothing, NULL, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&c, DoNothing, nullptr, grpc_schedule_on_exec_ctx); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { GRPC_CLOSURE_RUN(&exec_ctx, &c, GRPC_ERROR_NONE); @@ -100,7 +100,7 @@ static void BM_ClosureCreateAndRun(benchmark::State& state) { while (state.KeepRunning()) { GRPC_CLOSURE_RUN( &exec_ctx, - GRPC_CLOSURE_CREATE(DoNothing, NULL, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_CREATE(DoNothing, nullptr, grpc_schedule_on_exec_ctx), GRPC_ERROR_NONE); } grpc_exec_ctx_finish(&exec_ctx); @@ -115,7 +115,7 @@ static void BM_ClosureInitAndRun(benchmark::State& state) { while (state.KeepRunning()) { GRPC_CLOSURE_RUN( &exec_ctx, - GRPC_CLOSURE_INIT(&c, DoNothing, NULL, grpc_schedule_on_exec_ctx), + GRPC_CLOSURE_INIT(&c, DoNothing, nullptr, grpc_schedule_on_exec_ctx), GRPC_ERROR_NONE); } grpc_exec_ctx_finish(&exec_ctx); @@ -126,7 +126,7 @@ BENCHMARK(BM_ClosureInitAndRun); static void BM_ClosureSchedOnExecCtx(benchmark::State& state) { TrackCounters track_counters; grpc_closure c; - GRPC_CLOSURE_INIT(&c, DoNothing, NULL, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&c, DoNothing, nullptr, grpc_schedule_on_exec_ctx); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { GRPC_CLOSURE_SCHED(&exec_ctx, &c, GRPC_ERROR_NONE); @@ -141,8 +141,8 @@ static void BM_ClosureSched2OnExecCtx(benchmark::State& state) { TrackCounters track_counters; grpc_closure c1; grpc_closure c2; - GRPC_CLOSURE_INIT(&c1, DoNothing, NULL, grpc_schedule_on_exec_ctx); - GRPC_CLOSURE_INIT(&c2, DoNothing, NULL, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&c1, DoNothing, nullptr, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&c2, DoNothing, nullptr, grpc_schedule_on_exec_ctx); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { GRPC_CLOSURE_SCHED(&exec_ctx, &c1, GRPC_ERROR_NONE); @@ -159,9 +159,9 @@ static void BM_ClosureSched3OnExecCtx(benchmark::State& state) { grpc_closure c1; grpc_closure c2; grpc_closure c3; - GRPC_CLOSURE_INIT(&c1, DoNothing, NULL, grpc_schedule_on_exec_ctx); - GRPC_CLOSURE_INIT(&c2, DoNothing, NULL, grpc_schedule_on_exec_ctx); - GRPC_CLOSURE_INIT(&c3, DoNothing, NULL, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&c1, DoNothing, nullptr, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&c2, DoNothing, nullptr, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&c3, DoNothing, nullptr, grpc_schedule_on_exec_ctx); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { GRPC_CLOSURE_SCHED(&exec_ctx, &c1, GRPC_ERROR_NONE); @@ -182,7 +182,7 @@ static void BM_AcquireMutex(benchmark::State& state) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { gpr_mu_lock(&mu); - DoNothing(&exec_ctx, NULL, GRPC_ERROR_NONE); + DoNothing(&exec_ctx, nullptr, GRPC_ERROR_NONE); gpr_mu_unlock(&mu); } grpc_exec_ctx_finish(&exec_ctx); @@ -198,7 +198,7 @@ static void BM_TryAcquireMutex(benchmark::State& state) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { if (gpr_mu_trylock(&mu)) { - DoNothing(&exec_ctx, NULL, GRPC_ERROR_NONE); + DoNothing(&exec_ctx, nullptr, GRPC_ERROR_NONE); gpr_mu_unlock(&mu); } else { abort(); @@ -216,7 +216,7 @@ static void BM_AcquireSpinlock(benchmark::State& state) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { gpr_spinlock_lock(&mu); - DoNothing(&exec_ctx, NULL, GRPC_ERROR_NONE); + DoNothing(&exec_ctx, nullptr, GRPC_ERROR_NONE); gpr_spinlock_unlock(&mu); } grpc_exec_ctx_finish(&exec_ctx); @@ -231,7 +231,7 @@ static void BM_TryAcquireSpinlock(benchmark::State& state) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { if (gpr_spinlock_trylock(&mu)) { - DoNothing(&exec_ctx, NULL, GRPC_ERROR_NONE); + DoNothing(&exec_ctx, nullptr, GRPC_ERROR_NONE); gpr_spinlock_unlock(&mu); } else { abort(); @@ -246,7 +246,7 @@ static void BM_ClosureSchedOnCombiner(benchmark::State& state) { TrackCounters track_counters; grpc_combiner* combiner = grpc_combiner_create(); grpc_closure c; - GRPC_CLOSURE_INIT(&c, DoNothing, NULL, grpc_combiner_scheduler(combiner)); + GRPC_CLOSURE_INIT(&c, DoNothing, nullptr, grpc_combiner_scheduler(combiner)); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { GRPC_CLOSURE_SCHED(&exec_ctx, &c, GRPC_ERROR_NONE); @@ -263,8 +263,8 @@ static void BM_ClosureSched2OnCombiner(benchmark::State& state) { grpc_combiner* combiner = grpc_combiner_create(); grpc_closure c1; grpc_closure c2; - GRPC_CLOSURE_INIT(&c1, DoNothing, NULL, grpc_combiner_scheduler(combiner)); - GRPC_CLOSURE_INIT(&c2, DoNothing, NULL, grpc_combiner_scheduler(combiner)); + GRPC_CLOSURE_INIT(&c1, DoNothing, nullptr, grpc_combiner_scheduler(combiner)); + GRPC_CLOSURE_INIT(&c2, DoNothing, nullptr, grpc_combiner_scheduler(combiner)); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { GRPC_CLOSURE_SCHED(&exec_ctx, &c1, GRPC_ERROR_NONE); @@ -283,9 +283,9 @@ static void BM_ClosureSched3OnCombiner(benchmark::State& state) { grpc_closure c1; grpc_closure c2; grpc_closure c3; - GRPC_CLOSURE_INIT(&c1, DoNothing, NULL, grpc_combiner_scheduler(combiner)); - GRPC_CLOSURE_INIT(&c2, DoNothing, NULL, grpc_combiner_scheduler(combiner)); - GRPC_CLOSURE_INIT(&c3, DoNothing, NULL, grpc_combiner_scheduler(combiner)); + GRPC_CLOSURE_INIT(&c1, DoNothing, nullptr, grpc_combiner_scheduler(combiner)); + GRPC_CLOSURE_INIT(&c2, DoNothing, nullptr, grpc_combiner_scheduler(combiner)); + GRPC_CLOSURE_INIT(&c3, DoNothing, nullptr, grpc_combiner_scheduler(combiner)); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { GRPC_CLOSURE_SCHED(&exec_ctx, &c1, GRPC_ERROR_NONE); @@ -305,8 +305,8 @@ static void BM_ClosureSched2OnTwoCombiners(benchmark::State& state) { grpc_combiner* combiner2 = grpc_combiner_create(); grpc_closure c1; grpc_closure c2; - GRPC_CLOSURE_INIT(&c1, DoNothing, NULL, grpc_combiner_scheduler(combiner1)); - GRPC_CLOSURE_INIT(&c2, DoNothing, NULL, grpc_combiner_scheduler(combiner2)); + GRPC_CLOSURE_INIT(&c1, DoNothing, nullptr, grpc_combiner_scheduler(combiner1)); + GRPC_CLOSURE_INIT(&c2, DoNothing, nullptr, grpc_combiner_scheduler(combiner2)); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { GRPC_CLOSURE_SCHED(&exec_ctx, &c1, GRPC_ERROR_NONE); @@ -328,10 +328,10 @@ static void BM_ClosureSched4OnTwoCombiners(benchmark::State& state) { grpc_closure c2; grpc_closure c3; grpc_closure c4; - GRPC_CLOSURE_INIT(&c1, DoNothing, NULL, grpc_combiner_scheduler(combiner1)); - GRPC_CLOSURE_INIT(&c2, DoNothing, NULL, grpc_combiner_scheduler(combiner2)); - GRPC_CLOSURE_INIT(&c3, DoNothing, NULL, grpc_combiner_scheduler(combiner1)); - GRPC_CLOSURE_INIT(&c4, DoNothing, NULL, grpc_combiner_scheduler(combiner2)); + GRPC_CLOSURE_INIT(&c1, DoNothing, nullptr, grpc_combiner_scheduler(combiner1)); + GRPC_CLOSURE_INIT(&c2, DoNothing, nullptr, grpc_combiner_scheduler(combiner2)); + GRPC_CLOSURE_INIT(&c3, DoNothing, nullptr, grpc_combiner_scheduler(combiner1)); + GRPC_CLOSURE_INIT(&c4, DoNothing, nullptr, grpc_combiner_scheduler(combiner2)); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { GRPC_CLOSURE_SCHED(&exec_ctx, &c1, GRPC_ERROR_NONE); diff --git a/test/cpp/microbenchmarks/bm_cq.cc b/test/cpp/microbenchmarks/bm_cq.cc index dac702b08bf46..343681bb9b068 100644 --- a/test/cpp/microbenchmarks/bm_cq.cc +++ b/test/cpp/microbenchmarks/bm_cq.cc @@ -47,7 +47,7 @@ static void BM_CreateDestroyCpp2(benchmark::State& state) { TrackCounters track_counters; while (state.KeepRunning()) { grpc_completion_queue* core_cq = - grpc_completion_queue_create_for_next(NULL); + grpc_completion_queue_create_for_next(nullptr); CompletionQueue cq(core_cq); } track_counters.Finish(state); @@ -59,7 +59,7 @@ static void BM_CreateDestroyCore(benchmark::State& state) { while (state.KeepRunning()) { // TODO: sreek Templatize this benchmark and pass completion type and // polling type as parameters - grpc_completion_queue_destroy(grpc_completion_queue_create_for_next(NULL)); + grpc_completion_queue_destroy(grpc_completion_queue_create_for_next(nullptr)); } track_counters.Finish(state); } @@ -83,7 +83,7 @@ static void BM_Pass1Cpp(benchmark::State& state) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; GPR_ASSERT(grpc_cq_begin_op(c_cq, &dummy_tag)); grpc_cq_end_op(&exec_ctx, c_cq, &dummy_tag, GRPC_ERROR_NONE, - DoneWithCompletionOnStack, NULL, &completion); + DoneWithCompletionOnStack, nullptr, &completion); grpc_exec_ctx_finish(&exec_ctx); void* tag; bool ok; @@ -96,16 +96,16 @@ BENCHMARK(BM_Pass1Cpp); static void BM_Pass1Core(benchmark::State& state) { TrackCounters track_counters; // TODO: sreek Templatize this benchmark and pass polling_type as a param - grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL); + grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr); gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); while (state.KeepRunning()) { grpc_cq_completion completion; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - GPR_ASSERT(grpc_cq_begin_op(cq, NULL)); - grpc_cq_end_op(&exec_ctx, cq, NULL, GRPC_ERROR_NONE, - DoneWithCompletionOnStack, NULL, &completion); + GPR_ASSERT(grpc_cq_begin_op(cq, nullptr)); + grpc_cq_end_op(&exec_ctx, cq, nullptr, GRPC_ERROR_NONE, + DoneWithCompletionOnStack, nullptr, &completion); grpc_exec_ctx_finish(&exec_ctx); - grpc_completion_queue_next(cq, deadline, NULL); + grpc_completion_queue_next(cq, deadline, nullptr); } grpc_completion_queue_destroy(cq); track_counters.Finish(state); @@ -115,16 +115,16 @@ BENCHMARK(BM_Pass1Core); static void BM_Pluck1Core(benchmark::State& state) { TrackCounters track_counters; // TODO: sreek Templatize this benchmark and pass polling_type as a param - grpc_completion_queue* cq = grpc_completion_queue_create_for_pluck(NULL); + grpc_completion_queue* cq = grpc_completion_queue_create_for_pluck(nullptr); gpr_timespec deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC); while (state.KeepRunning()) { grpc_cq_completion completion; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - GPR_ASSERT(grpc_cq_begin_op(cq, NULL)); - grpc_cq_end_op(&exec_ctx, cq, NULL, GRPC_ERROR_NONE, - DoneWithCompletionOnStack, NULL, &completion); + GPR_ASSERT(grpc_cq_begin_op(cq, nullptr)); + grpc_cq_end_op(&exec_ctx, cq, nullptr, GRPC_ERROR_NONE, + DoneWithCompletionOnStack, nullptr, &completion); grpc_exec_ctx_finish(&exec_ctx); - grpc_completion_queue_pluck(cq, NULL, deadline, NULL); + grpc_completion_queue_pluck(cq, nullptr, deadline, nullptr); } grpc_completion_queue_destroy(cq); track_counters.Finish(state); @@ -134,10 +134,10 @@ BENCHMARK(BM_Pluck1Core); static void BM_EmptyCore(benchmark::State& state) { TrackCounters track_counters; // TODO: sreek Templatize this benchmark and pass polling_type as a param - grpc_completion_queue* cq = grpc_completion_queue_create_for_next(NULL); + grpc_completion_queue* cq = grpc_completion_queue_create_for_next(nullptr); gpr_timespec deadline = gpr_inf_past(GPR_CLOCK_MONOTONIC); while (state.KeepRunning()) { - grpc_completion_queue_next(cq, deadline, NULL); + grpc_completion_queue_next(cq, deadline, nullptr); } grpc_completion_queue_destroy(cq); track_counters.Finish(state); diff --git a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc index 8d4349a297e61..7ccebb55ee089 100644 --- a/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc +++ b/test/cpp/microbenchmarks/bm_cq_multiple_threads.cc @@ -80,7 +80,7 @@ static grpc_error* pollset_work(grpc_exec_ctx* exec_ctx, grpc_pollset* ps, gpr_mu_unlock(&ps->mu); GPR_ASSERT(grpc_cq_begin_op(g_cq, g_tag)); - grpc_cq_end_op(exec_ctx, g_cq, g_tag, GRPC_ERROR_NONE, cq_done_cb, NULL, + grpc_cq_end_op(exec_ctx, g_cq, g_tag, GRPC_ERROR_NONE, cq_done_cb, nullptr, (grpc_cq_completion*)gpr_malloc(sizeof(grpc_cq_completion))); grpc_exec_ctx_flush(exec_ctx); gpr_mu_lock(&ps->mu); @@ -108,7 +108,7 @@ static void setup() { g_old_vtable = grpc_get_event_engine_test_only(); grpc_set_event_engine_test_only(&g_vtable); - g_cq = grpc_completion_queue_create_for_next(NULL); + g_cq = grpc_completion_queue_create_for_next(nullptr); } static void teardown() { @@ -116,7 +116,7 @@ static void teardown() { /* Drain any events */ gpr_timespec deadline = gpr_time_0(GPR_CLOCK_MONOTONIC); - while (grpc_completion_queue_next(g_cq, deadline, NULL).type != + while (grpc_completion_queue_next(g_cq, deadline, nullptr).type != GRPC_QUEUE_SHUTDOWN) { /* Do nothing */ } @@ -151,7 +151,7 @@ static void BM_Cq_Throughput(benchmark::State& state) { } while (state.KeepRunning()) { - GPR_ASSERT(grpc_completion_queue_next(g_cq, deadline, NULL).type == + GPR_ASSERT(grpc_completion_queue_next(g_cq, deadline, nullptr).type == GRPC_OP_COMPLETE); } diff --git a/test/cpp/microbenchmarks/bm_error.cc b/test/cpp/microbenchmarks/bm_error.cc index aa7822653ffa1..fa9af0ac5aa25 100644 --- a/test/cpp/microbenchmarks/bm_error.cc +++ b/test/cpp/microbenchmarks/bm_error.cc @@ -251,7 +251,7 @@ static void BM_ErrorGetStatus(benchmark::State& state) { grpc_status_code status; grpc_slice slice; grpc_error_get_status(&exec_ctx, fixture.error(), fixture.deadline(), - &status, &slice, NULL); + &status, &slice, nullptr); } grpc_exec_ctx_finish(&exec_ctx); track_counters.Finish(state); @@ -265,7 +265,7 @@ static void BM_ErrorGetStatusCode(benchmark::State& state) { while (state.KeepRunning()) { grpc_status_code status; grpc_error_get_status(&exec_ctx, fixture.error(), fixture.deadline(), - &status, NULL, NULL); + &status, nullptr, nullptr); } grpc_exec_ctx_finish(&exec_ctx); track_counters.Finish(state); @@ -278,8 +278,8 @@ static void BM_ErrorHttpError(benchmark::State& state) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { grpc_http2_error_code error; - grpc_error_get_status(&exec_ctx, fixture.error(), fixture.deadline(), NULL, - NULL, &error); + grpc_error_get_status(&exec_ctx, fixture.error(), fixture.deadline(), nullptr, + nullptr, &error); } grpc_exec_ctx_finish(&exec_ctx); track_counters.Finish(state); diff --git a/test/cpp/microbenchmarks/bm_fullstack_trickle.cc b/test/cpp/microbenchmarks/bm_fullstack_trickle.cc index f75c3e4436913..bb974fad507e0 100644 --- a/test/cpp/microbenchmarks/bm_fullstack_trickle.cc +++ b/test/cpp/microbenchmarks/bm_fullstack_trickle.cc @@ -216,10 +216,10 @@ class TrickledCHTTP2 : public EndpointPairFixture { void UpdateStats(grpc_chttp2_transport* t, Stats* s, size_t backlog) GPR_ATTRIBUTE_NO_TSAN { if (backlog == 0) { - if (t->lists[GRPC_CHTTP2_LIST_STALLED_BY_STREAM].head != NULL) { + if (t->lists[GRPC_CHTTP2_LIST_STALLED_BY_STREAM].head != nullptr) { s->streams_stalled_due_to_stream_flow_control++; } - if (t->lists[GRPC_CHTTP2_LIST_STALLED_BY_TRANSPORT].head != NULL) { + if (t->lists[GRPC_CHTTP2_LIST_STALLED_BY_TRANSPORT].head != nullptr) { s->streams_stalled_due_to_transport_flow_control++; } } diff --git a/test/cpp/microbenchmarks/bm_metadata.cc b/test/cpp/microbenchmarks/bm_metadata.cc index 1ed05f7466d20..73bce084668a9 100644 --- a/test/cpp/microbenchmarks/bm_metadata.cc +++ b/test/cpp/microbenchmarks/bm_metadata.cc @@ -92,7 +92,7 @@ static void BM_MetadataFromNonInternedSlices(benchmark::State& state) { gpr_slice v = grpc_slice_from_static_string("value"); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { - GRPC_MDELEM_UNREF(&exec_ctx, grpc_mdelem_create(&exec_ctx, k, v, NULL)); + GRPC_MDELEM_UNREF(&exec_ctx, grpc_mdelem_create(&exec_ctx, k, v, nullptr)); } grpc_exec_ctx_finish(&exec_ctx); track_counters.Finish(state); @@ -105,7 +105,7 @@ static void BM_MetadataFromInternedSlices(benchmark::State& state) { gpr_slice v = grpc_slice_intern(grpc_slice_from_static_string("value")); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { - GRPC_MDELEM_UNREF(&exec_ctx, grpc_mdelem_create(&exec_ctx, k, v, NULL)); + GRPC_MDELEM_UNREF(&exec_ctx, grpc_mdelem_create(&exec_ctx, k, v, nullptr)); } grpc_exec_ctx_finish(&exec_ctx); grpc_slice_unref(k); @@ -120,9 +120,9 @@ static void BM_MetadataFromInternedSlicesAlreadyInIndex( gpr_slice k = grpc_slice_intern(grpc_slice_from_static_string("key")); gpr_slice v = grpc_slice_intern(grpc_slice_from_static_string("value")); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; - grpc_mdelem seed = grpc_mdelem_create(&exec_ctx, k, v, NULL); + grpc_mdelem seed = grpc_mdelem_create(&exec_ctx, k, v, nullptr); while (state.KeepRunning()) { - GRPC_MDELEM_UNREF(&exec_ctx, grpc_mdelem_create(&exec_ctx, k, v, NULL)); + GRPC_MDELEM_UNREF(&exec_ctx, grpc_mdelem_create(&exec_ctx, k, v, nullptr)); } GRPC_MDELEM_UNREF(&exec_ctx, seed); grpc_exec_ctx_finish(&exec_ctx); @@ -138,7 +138,7 @@ static void BM_MetadataFromInternedKey(benchmark::State& state) { gpr_slice v = grpc_slice_from_static_string("value"); grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { - GRPC_MDELEM_UNREF(&exec_ctx, grpc_mdelem_create(&exec_ctx, k, v, NULL)); + GRPC_MDELEM_UNREF(&exec_ctx, grpc_mdelem_create(&exec_ctx, k, v, nullptr)); } grpc_exec_ctx_finish(&exec_ctx); grpc_slice_unref(k); @@ -209,7 +209,7 @@ static void BM_MetadataFromStaticMetadataStrings(benchmark::State& state) { gpr_slice v = GRPC_MDSTR_200; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { - GRPC_MDELEM_UNREF(&exec_ctx, grpc_mdelem_create(&exec_ctx, k, v, NULL)); + GRPC_MDELEM_UNREF(&exec_ctx, grpc_mdelem_create(&exec_ctx, k, v, nullptr)); } grpc_exec_ctx_finish(&exec_ctx); grpc_slice_unref(k); @@ -224,7 +224,7 @@ static void BM_MetadataFromStaticMetadataStringsNotIndexed( gpr_slice v = GRPC_MDSTR_GZIP; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; while (state.KeepRunning()) { - GRPC_MDELEM_UNREF(&exec_ctx, grpc_mdelem_create(&exec_ctx, k, v, NULL)); + GRPC_MDELEM_UNREF(&exec_ctx, grpc_mdelem_create(&exec_ctx, k, v, nullptr)); } grpc_exec_ctx_finish(&exec_ctx); grpc_slice_unref(k); @@ -273,7 +273,7 @@ static void BM_MetadataRefUnrefAllocated(benchmark::State& state) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_mdelem el = grpc_mdelem_create(&exec_ctx, grpc_slice_from_static_string("a"), - grpc_slice_from_static_string("b"), NULL); + grpc_slice_from_static_string("b"), nullptr); while (state.KeepRunning()) { GRPC_MDELEM_UNREF(&exec_ctx, GRPC_MDELEM_REF(el)); } @@ -287,7 +287,7 @@ static void BM_MetadataRefUnrefStatic(benchmark::State& state) { TrackCounters track_counters; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; grpc_mdelem el = - grpc_mdelem_create(&exec_ctx, GRPC_MDSTR_STATUS, GRPC_MDSTR_200, NULL); + grpc_mdelem_create(&exec_ctx, GRPC_MDSTR_STATUS, GRPC_MDSTR_200, nullptr); while (state.KeepRunning()) { GRPC_MDELEM_UNREF(&exec_ctx, GRPC_MDELEM_REF(el)); } diff --git a/test/cpp/microbenchmarks/bm_pollset.cc b/test/cpp/microbenchmarks/bm_pollset.cc index 92d76f307e328..0a04dde15fc50 100644 --- a/test/cpp/microbenchmarks/bm_pollset.cc +++ b/test/cpp/microbenchmarks/bm_pollset.cc @@ -117,7 +117,7 @@ static void BM_PollEmptyPollset(benchmark::State& state) { grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; gpr_mu_lock(mu); while (state.KeepRunning()) { - GRPC_ERROR_UNREF(grpc_pollset_work(&exec_ctx, ps, NULL, 0)); + GRPC_ERROR_UNREF(grpc_pollset_work(&exec_ctx, ps, nullptr, 0)); } grpc_closure shutdown_ps_closure; GRPC_CLOSURE_INIT(&shutdown_ps_closure, shutdown_ps, ps, @@ -145,7 +145,7 @@ static void BM_PollAddFd(benchmark::State& state) { grpc_pollset_add_fd(&exec_ctx, ps, fd); grpc_exec_ctx_flush(&exec_ctx); } - grpc_fd_orphan(&exec_ctx, fd, NULL, NULL, false /* already_closed */, "xxx"); + grpc_fd_orphan(&exec_ctx, fd, nullptr, nullptr, false /* already_closed */, "xxx"); grpc_closure shutdown_ps_closure; GRPC_CLOSURE_INIT(&shutdown_ps_closure, shutdown_ps, ps, grpc_schedule_on_exec_ctx); @@ -240,9 +240,9 @@ static void BM_SingleThreadPollOneFd(benchmark::State& state) { gpr_mu_lock(mu); while (!done) { GRPC_ERROR_UNREF( - grpc_pollset_work(&exec_ctx, ps, NULL, GRPC_MILLIS_INF_FUTURE)); + grpc_pollset_work(&exec_ctx, ps, nullptr, GRPC_MILLIS_INF_FUTURE)); } - grpc_fd_orphan(&exec_ctx, wakeup, NULL, NULL, false /* already_closed */, + grpc_fd_orphan(&exec_ctx, wakeup, nullptr, nullptr, false /* already_closed */, "done"); wakeup_fd.read_fd = 0; grpc_closure shutdown_ps_closure; diff --git a/test/cpp/microbenchmarks/fullstack_fixtures.h b/test/cpp/microbenchmarks/fullstack_fixtures.h index 71bbb393db425..323ca1e5d7fc8 100644 --- a/test/cpp/microbenchmarks/fullstack_fixtures.h +++ b/test/cpp/microbenchmarks/fullstack_fixtures.h @@ -185,8 +185,8 @@ class EndpointPairFixture : public BaseFixture { } grpc_server_setup_transport(&exec_ctx, server_->c_server(), - server_transport_, NULL, server_args); - grpc_chttp2_transport_start_reading(&exec_ctx, server_transport_, NULL); + server_transport_, nullptr, server_args); + grpc_chttp2_transport_start_reading(&exec_ctx, server_transport_, nullptr); } /* create channel */ @@ -202,7 +202,7 @@ class EndpointPairFixture : public BaseFixture { grpc_channel* channel = grpc_channel_create(&exec_ctx, "target", &c_args, GRPC_CLIENT_DIRECT_CHANNEL, client_transport_); - grpc_chttp2_transport_start_reading(&exec_ctx, client_transport_, NULL); + grpc_chttp2_transport_start_reading(&exec_ctx, client_transport_, nullptr); channel_ = CreateChannelInternal("", channel); } @@ -244,7 +244,7 @@ class SockPair : public EndpointPairFixture { SockPair(Service* service, const FixtureConfiguration& fixture_configuration = FixtureConfiguration()) : EndpointPairFixture(service, - grpc_iomgr_create_endpoint_pair("test", NULL), + grpc_iomgr_create_endpoint_pair("test", nullptr), fixture_configuration) {} }; diff --git a/test/cpp/naming/resolver_component_test.cc b/test/cpp/naming/resolver_component_test.cc index 94adbcbd35999..9c1b4c7b733d5 100644 --- a/test/cpp/naming/resolver_component_test.cc +++ b/test/cpp/naming/resolver_component_test.cc @@ -157,7 +157,7 @@ void ArgsInit(grpc_exec_ctx* exec_ctx, ArgsStruct* args) { grpc_pollset_set_add_pollset(exec_ctx, args->pollset_set, args->pollset); args->lock = grpc_combiner_create(); gpr_atm_rel_store(&args->done_atm, 0); - args->channel_args = NULL; + args->channel_args = nullptr; } void DoNothing(grpc_exec_ctx* exec_ctx, void* arg, grpc_error* error) {} @@ -167,7 +167,7 @@ void ArgsFinish(grpc_exec_ctx* exec_ctx, ArgsStruct* args) { grpc_pollset_set_del_pollset(exec_ctx, args->pollset_set, args->pollset); grpc_pollset_set_destroy(exec_ctx, args->pollset_set); grpc_closure DoNothing_cb; - GRPC_CLOSURE_INIT(&DoNothing_cb, DoNothing, NULL, grpc_schedule_on_exec_ctx); + GRPC_CLOSURE_INIT(&DoNothing_cb, DoNothing, nullptr, grpc_schedule_on_exec_ctx); grpc_pollset_shutdown(exec_ctx, args->pollset, &DoNothing_cb); // exec_ctx needs to be flushed before calling grpc_pollset_destroy() grpc_channel_args_destroy(exec_ctx, args->channel_args); @@ -194,7 +194,7 @@ void PollPollsetUntilRequestDone(ArgsStruct* args) { gpr_log(GPR_DEBUG, "done=%d, time_left=%" PRId64 ".%09d", done, time_left.tv_sec, time_left.tv_nsec); GPR_ASSERT(gpr_time_cmp(time_left, gpr_time_0(GPR_TIMESPAN)) >= 0); - grpc_pollset_worker* worker = NULL; + grpc_pollset_worker* worker = nullptr; grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT; gpr_mu_lock(args->mu); GRPC_LOG_IF_ERROR("pollset_work", @@ -212,12 +212,12 @@ void CheckServiceConfigResultLocked(grpc_channel_args* channel_args, const grpc_arg* service_config_arg = grpc_channel_args_find(channel_args, GRPC_ARG_SERVICE_CONFIG); if (args->expected_service_config_string != "") { - GPR_ASSERT(service_config_arg != NULL); + GPR_ASSERT(service_config_arg != nullptr); GPR_ASSERT(service_config_arg->type == GRPC_ARG_STRING); EXPECT_EQ(service_config_arg->value.string, args->expected_service_config_string); } else { - GPR_ASSERT(service_config_arg == NULL); + GPR_ASSERT(service_config_arg == nullptr); } } @@ -226,11 +226,11 @@ void CheckLBPolicyResultLocked(grpc_channel_args* channel_args, const grpc_arg* lb_policy_arg = grpc_channel_args_find(channel_args, GRPC_ARG_LB_POLICY_NAME); if (args->expected_lb_policy != "") { - GPR_ASSERT(lb_policy_arg != NULL); + GPR_ASSERT(lb_policy_arg != nullptr); GPR_ASSERT(lb_policy_arg->type == GRPC_ARG_STRING); EXPECT_EQ(lb_policy_arg->value.string, args->expected_lb_policy); } else { - GPR_ASSERT(lb_policy_arg == NULL); + GPR_ASSERT(lb_policy_arg == nullptr); } } @@ -240,7 +240,7 @@ void CheckResolverResultLocked(grpc_exec_ctx* exec_ctx, void* argsp, grpc_channel_args* channel_args = args->channel_args; const grpc_arg* channel_arg = grpc_channel_args_find(channel_args, GRPC_ARG_LB_ADDRESSES); - GPR_ASSERT(channel_arg != NULL); + GPR_ASSERT(channel_arg != nullptr); GPR_ASSERT(channel_arg->type == GRPC_ARG_POINTER); grpc_lb_addresses* addresses = (grpc_lb_addresses*)channel_arg->value.pointer.p; @@ -272,7 +272,7 @@ void CheckResolverResultLocked(grpc_exec_ctx* exec_ctx, void* argsp, 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); } @@ -284,12 +284,12 @@ TEST(ResolverComponentTest, TestResolvesRelevantRecords) { args.expected_service_config_string = FLAGS_expected_chosen_service_config; args.expected_lb_policy = FLAGS_expected_lb_policy; // maybe build the address with an authority - char* whole_uri = NULL; + char* whole_uri = nullptr; GPR_ASSERT(asprintf(&whole_uri, "dns://%s/%s", FLAGS_local_dns_server_address.c_str(), FLAGS_target_name.c_str())); // create resolver and resolve - grpc_resolver* resolver = grpc_resolver_create(&exec_ctx, whole_uri, NULL, + grpc_resolver* resolver = grpc_resolver_create(&exec_ctx, whole_uri, nullptr, args.pollset_set, args.lock); gpr_free(whole_uri); grpc_closure on_resolver_result_changed; diff --git a/test/cpp/naming/resolver_component_tests_runner_invoker.cc b/test/cpp/naming/resolver_component_tests_runner_invoker.cc index 7ea005cc1d8ed..0beb27de1b843 100644 --- a/test/cpp/naming/resolver_component_tests_runner_invoker.cc +++ b/test/cpp/naming/resolver_component_tests_runner_invoker.cc @@ -60,8 +60,8 @@ static void register_sighandler() { struct sigaction act; memset(&act, 0, sizeof(act)); act.sa_handler = sighandler; - sigaction(SIGINT, &act, NULL); - sigaction(SIGTERM, &act, NULL); + sigaction(SIGINT, &act, nullptr); + sigaction(SIGTERM, &act, nullptr); } namespace { diff --git a/test/cpp/performance/writes_per_rpc_test.cc b/test/cpp/performance/writes_per_rpc_test.cc index 6c232450210d1..23fff2ea8b0cc 100644 --- a/test/cpp/performance/writes_per_rpc_test.cc +++ b/test/cpp/performance/writes_per_rpc_test.cc @@ -100,8 +100,8 @@ class EndpointPairFixture { } grpc_server_setup_transport(&exec_ctx, server_->c_server(), transport, - NULL, server_args); - grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL); + nullptr, server_args); + grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr); } /* create channel */ @@ -116,7 +116,7 @@ class EndpointPairFixture { GPR_ASSERT(transport); grpc_channel* channel = grpc_channel_create( &exec_ctx, "target", &c_args, GRPC_CLIENT_DIRECT_CHANNEL, transport); - grpc_chttp2_transport_start_reading(&exec_ctx, transport, NULL); + grpc_chttp2_transport_start_reading(&exec_ctx, transport, nullptr); channel_ = CreateChannelInternal("", channel); } diff --git a/test/cpp/qps/json_run_localhost.cc b/test/cpp/qps/json_run_localhost.cc index 4b788eae732b5..db8b2a3943717 100644 --- a/test/cpp/qps/json_run_localhost.cc +++ b/test/cpp/qps/json_run_localhost.cc @@ -46,7 +46,7 @@ std::string as_string(const T& val) { static void sighandler(int sig) { const int errno_saved = errno; - if (g_driver != NULL) g_driver->Interrupt(); + if (g_driver != nullptr) g_driver->Interrupt(); for (int i = 0; i < kNumWorkers; ++i) { if (g_workers[i]) g_workers[i]->Interrupt(); } @@ -58,8 +58,8 @@ static void register_sighandler() { memset(&act, 0, sizeof(act)); act.sa_handler = sighandler; - sigaction(SIGINT, &act, NULL); - sigaction(SIGTERM, &act, NULL); + sigaction(SIGINT, &act, nullptr); + sigaction(SIGTERM, &act, nullptr); } static void LogStatus(int status, const char* label) { diff --git a/test/cpp/qps/qps_json_driver.cc b/test/cpp/qps/qps_json_driver.cc index 16725274267c0..b2449da69cb25 100644 --- a/test/cpp/qps/qps_json_driver.cc +++ b/test/cpp/qps/qps_json_driver.cc @@ -181,7 +181,7 @@ static bool QpsDriver() { if (scfile) { // Read the json data from disk FILE* json_file = fopen(FLAGS_scenarios_file.c_str(), "r"); - GPR_ASSERT(json_file != NULL); + GPR_ASSERT(json_file != nullptr); fseek(json_file, 0, SEEK_END); long len = ftell(json_file); char* data = new char[len]; diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc index 23c7e85283350..72ae7721478d7 100644 --- a/test/cpp/qps/server_async.cc +++ b/test/cpp/qps/server_async.cc @@ -79,7 +79,7 @@ class AsyncQpsServerTest final : public grpc::testing::Server { auto port_num = port(); // Negative port number means inproc server, so no listen port needed if (port_num >= 0) { - char* server_address = NULL; + char* server_address = nullptr; gpr_join_host_port(&server_address, "::", port_num); builder.AddListeningPort(server_address, Server::CreateServerCredentials(config)); diff --git a/test/cpp/qps/server_sync.cc b/test/cpp/qps/server_sync.cc index 4ef57bd08b82f..ea89a30e2edf2 100644 --- a/test/cpp/qps/server_sync.cc +++ b/test/cpp/qps/server_sync.cc @@ -159,7 +159,7 @@ class SynchronousServer final : public grpc::testing::Server { auto port_num = port(); // Negative port number means inproc server, so no listen port needed if (port_num >= 0) { - char* server_address = NULL; + char* server_address = nullptr; gpr_join_host_port(&server_address, "::", port_num); builder.AddListeningPort(server_address, Server::CreateServerCredentials(config)); diff --git a/test/cpp/thread_manager/thread_manager_test.cc b/test/cpp/thread_manager/thread_manager_test.cc index af90d4449599f..8282d4669481a 100644 --- a/test/cpp/thread_manager/thread_manager_test.cc +++ b/test/cpp/thread_manager/thread_manager_test.cc @@ -111,7 +111,7 @@ void ThreadManagerTest::PerformTest() { } // namespace grpc int main(int argc, char** argv) { - std::srand(std::time(NULL)); + std::srand(std::time(nullptr)); grpc::testing::InitTest(&argc, &argv, true); grpc::ThreadManagerTest test_rpc_manager; diff --git a/test/cpp/util/grpc_tool.cc b/test/cpp/util/grpc_tool.cc index cd6084ac6dcac..7d51c5f45fb5d 100644 --- a/test/cpp/util/grpc_tool.cc +++ b/test/cpp/util/grpc_tool.cc @@ -230,7 +230,7 @@ const Command* FindCommand(const grpc::string& name) { return &ops[i]; } } - return NULL; + return nullptr; } } // namespace @@ -245,7 +245,7 @@ int GrpcToolMainLib(int argc, const char** argv, const CliCredentials& cred, argv += 2; const Command* cmd = FindCommand(command); - if (cmd != NULL) { + if (cmd != nullptr) { GrpcTool grpc_tool; if (argc < cmd->min_args || argc > cmd->max_args) { // Force the command to print its usage message @@ -281,7 +281,7 @@ bool GrpcTool::Help(int argc, const char** argv, const CliCredentials& cred, Usage(""); } else { const Command* cmd = FindCommand(argv[0]); - if (cmd == NULL) { + if (cmd == nullptr) { Usage("Unknown command '" + grpc::string(argv[0]) + "'"); } SetPrintCommandMode(0); diff --git a/test/cpp/util/grpc_tool_test.cc b/test/cpp/util/grpc_tool_test.cc index d0b3d7b81ba70..a8677eeba2460 100644 --- a/test/cpp/util/grpc_tool_test.cc +++ b/test/cpp/util/grpc_tool_test.cc @@ -395,7 +395,7 @@ TEST_F(GrpcToolTest, CallCommand) { std::bind(PrintStream, &output_stream, std::placeholders::_1))); // Expected output: "message: \"Hello\"" - EXPECT_TRUE(NULL != + EXPECT_TRUE(nullptr != strstr(output_stream.str().c_str(), "message: \"Hello\"")); ShutdownServer(); } @@ -421,7 +421,7 @@ TEST_F(GrpcToolTest, CallCommandBatch) { // Expected output: "message: "Hello0"\nmessage: "Hello1"\nmessage: // "Hello2"\n" - EXPECT_TRUE(NULL != strstr(output_stream.str().c_str(), + EXPECT_TRUE(nullptr != strstr(output_stream.str().c_str(), "message: \"Hello0\"\nmessage: " "\"Hello1\"\nmessage: \"Hello2\"\n")); std::cin.rdbuf(orig); @@ -448,7 +448,7 @@ TEST_F(GrpcToolTest, CallCommandBatchWithBadRequest) { FLAGS_batch = false; // Expected output: "message: "Hello0"\nmessage: "Hello2"\n" - EXPECT_TRUE(NULL != strstr(output_stream.str().c_str(), + EXPECT_TRUE(nullptr != strstr(output_stream.str().c_str(), "message: \"Hello0\"\nmessage: \"Hello2\"\n")); std::cin.rdbuf(orig); ShutdownServer(); @@ -473,7 +473,7 @@ TEST_F(GrpcToolTest, CallCommandRequestStream) { std::placeholders::_1))); // Expected output: "message: \"Hello0Hello1Hello2\"" - EXPECT_TRUE(NULL != strstr(output_stream.str().c_str(), + EXPECT_TRUE(nullptr != strstr(output_stream.str().c_str(), "message: \"Hello0Hello1Hello2\"")); std::cin.rdbuf(orig); ShutdownServer(); @@ -498,7 +498,7 @@ TEST_F(GrpcToolTest, CallCommandRequestStreamWithBadRequest) { std::placeholders::_1))); // Expected output: "message: \"Hello0Hello2\"" - EXPECT_TRUE(NULL != + EXPECT_TRUE(nullptr != strstr(output_stream.str().c_str(), "message: \"Hello0Hello2\"")); std::cin.rdbuf(orig); ShutdownServer(); @@ -521,7 +521,7 @@ TEST_F(GrpcToolTest, CallCommandResponseStream) { for (int i = 0; i < kServerDefaultResponseStreamsToSend; i++) { grpc::string expected_response_text = "message: \"Hello" + grpc::to_string(i) + "\"\n"; - EXPECT_TRUE(NULL != strstr(output_stream.str().c_str(), + EXPECT_TRUE(nullptr != strstr(output_stream.str().c_str(), expected_response_text.c_str())); } @@ -547,7 +547,7 @@ TEST_F(GrpcToolTest, CallCommandBidiStream) { // Expected output: "message: \"Hello0\"\nmessage: \"Hello1\"\nmessage: // \"Hello2\"\n\n" - EXPECT_TRUE(NULL != strstr(output_stream.str().c_str(), + EXPECT_TRUE(nullptr != strstr(output_stream.str().c_str(), "message: \"Hello0\"\nmessage: " "\"Hello1\"\nmessage: \"Hello2\"\n")); std::cin.rdbuf(orig); @@ -573,7 +573,7 @@ TEST_F(GrpcToolTest, CallCommandBidiStreamWithBadRequest) { // Expected output: "message: \"Hello0\"\nmessage: \"Hello1\"\nmessage: // \"Hello2\"\n\n" - EXPECT_TRUE(NULL != strstr(output_stream.str().c_str(), + EXPECT_TRUE(nullptr != strstr(output_stream.str().c_str(), "message: \"Hello0\"\nmessage: \"Hello2\"\n")); std::cin.rdbuf(orig); diff --git a/tools/distrib/run_clang_tidy.py b/tools/distrib/run_clang_tidy.py new file mode 100755 index 0000000000000..d002a04de9f47 --- /dev/null +++ b/tools/distrib/run_clang_tidy.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python2.7 +# Copyright 2017 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import sys +import os +import subprocess +import argparse +import multiprocessing + +sys.path.append( + os.path.join( + os.path.dirname(sys.argv[0]), '..', 'run_tests', 'python_utils')) +import jobset + +GRPC_CHECKS = [ + 'modernize-use-nullptr', +] + +extra_args = [ + '-x', + 'c++', + '-std=c++11', +] +with open('.clang_complete') as f: + for line in f: + line = line.strip() + if line.startswith('-I'): + extra_args.append(line) + +clang_tidy = os.environ.get('CLANG_TIDY', 'clang-tidy') + +argp = argparse.ArgumentParser(description='Run clang-tidy against core') +argp.add_argument('files', nargs='+', help='Files to tidy') +argp.add_argument('--fix', dest='fix', action='store_true') +argp.add_argument('-j', '--jobs', type=int, default=multiprocessing.cpu_count(), + help='Number of CPUs to use') +argp.set_defaults(fix=False) +args = argp.parse_args() + +cmdline = [ + clang_tidy, + '--checks=-*,%s' % ','.join(GRPC_CHECKS), + '--warnings-as-errors=%s' % ','.join(GRPC_CHECKS) +] + [ + '--extra-arg-before=%s' % arg + for arg in extra_args +] + +if args.fix: + cmdline.append('--fix') + +jobs = [] +for filename in args.files: + jobs.append(jobset.JobSpec(cmdline + [filename], + shortname=filename, + ))#verbose_success=True)) + +jobset.run(jobs, maxjobs=args.jobs) diff --git a/tools/run_tests/sanity/check_clang_tidy.sh b/tools/run_tests/sanity/check_clang_tidy.sh new file mode 100755 index 0000000000000..42ab511a202c0 --- /dev/null +++ b/tools/run_tests/sanity/check_clang_tidy.sh @@ -0,0 +1,21 @@ +#!/bin/sh +# Copyright 2017 gRPC authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -e + +make buildtests \ + -j `python -c 'import multiprocessing; print multiprocessing.cpu_count()'` +find src/core src/cpp test/core test/cpp -name '*.h' -or -name '*.cc' | \ + xargs tools/distrib/run_clang_tidy.py $* diff --git a/tools/run_tests/sanity/sanity_tests.yaml b/tools/run_tests/sanity/sanity_tests.yaml index 4bc4b7c56f251..ec58a10a85364 100644 --- a/tools/run_tests/sanity/sanity_tests.yaml +++ b/tools/run_tests/sanity/sanity_tests.yaml @@ -17,4 +17,5 @@ - script: tools/distrib/pylint_code.sh - script: tools/distrib/yapf_code.sh - script: tools/distrib/python/check_grpcio_tools.py - +- script: tools/run_tests/sanity/check_clang_tidy.sh -j 3 + cpu_cost: 3