diff --git a/src/h2load.cc b/src/h2load.cc index 32cd5add..561e58c2 100644 --- a/src/h2load.cc +++ b/src/h2load.cc @@ -1589,7 +1589,7 @@ void Worker::free_client(Client *deleted_client) { client->req_todo = client->req_done; stats.req_todo += client->req_todo; auto index = &client - &clients[0]; - clients[index] = NULL; + clients[index] = nullptr; return; } } diff --git a/src/h2load_http3_session.cc b/src/h2load_http3_session.cc index 573a8a14..6ca1e419 100644 --- a/src/h2load_http3_session.cc +++ b/src/h2load_http3_session.cc @@ -319,7 +319,8 @@ int Http3Session::init_conn() { int64_t ctrl_stream_id; - rv = ngtcp2_conn_open_uni_stream(client_->quic.conn, &ctrl_stream_id, NULL); + rv = + ngtcp2_conn_open_uni_stream(client_->quic.conn, &ctrl_stream_id, nullptr); if (rv != 0) { std::cerr << "ngtcp2_conn_open_uni_stream: " << ngtcp2_strerror(rv) << std::endl; @@ -336,7 +337,7 @@ int Http3Session::init_conn() { int64_t qpack_enc_stream_id, qpack_dec_stream_id; rv = ngtcp2_conn_open_uni_stream(client_->quic.conn, &qpack_enc_stream_id, - NULL); + nullptr); if (rv != 0) { std::cerr << "ngtcp2_conn_open_uni_stream: " << ngtcp2_strerror(rv) << std::endl; @@ -344,7 +345,7 @@ int Http3Session::init_conn() { } rv = ngtcp2_conn_open_uni_stream(client_->quic.conn, &qpack_dec_stream_id, - NULL); + nullptr); if (rv != 0) { std::cerr << "ngtcp2_conn_open_uni_stream: " << ngtcp2_strerror(rv) << std::endl; diff --git a/src/inflatehd.cc b/src/inflatehd.cc index 9a159ad6..f484042a 100644 --- a/src/inflatehd.cc +++ b/src/inflatehd.cc @@ -171,7 +171,7 @@ static int inflate_hd(json_t *obj, nghttp2_hd_inflater *inflater, int seq) { } static int perform(void) { - nghttp2_hd_inflater *inflater = NULL; + nghttp2_hd_inflater *inflater = nullptr; json_error_t error; auto json = json_loadf(stdin, 0, &error); diff --git a/src/nghttpd.cc b/src/nghttpd.cc index e2232403..b930d47a 100644 --- a/src/nghttpd.cc +++ b/src/nghttpd.cc @@ -55,7 +55,7 @@ namespace nghttp2 { namespace { int parse_push_config(Config &config, const char *optarg) { const char *eq = strchr(optarg, '='); - if (eq == NULL) { + if (eq == nullptr) { return -1; } auto &paths = config.push[std::string(optarg, eq)]; @@ -63,7 +63,7 @@ int parse_push_config(Config &config, const char *optarg) { auto i = eq + 1; for (;;) { const char *j = strchr(i, ','); - if (j == NULL) { + if (j == nullptr) { j = optarg_end; } paths.emplace_back(i, j); diff --git a/src/shrpx-unittest.cc b/src/shrpx-unittest.cc index 53b3ff03..24a1acdc 100644 --- a/src/shrpx-unittest.cc +++ b/src/shrpx-unittest.cc @@ -52,7 +52,7 @@ static int init_suite1(void) { return 0; } static int clean_suite1(void) { return 0; } int main(int argc, char *argv[]) { - CU_pSuite pSuite = NULL; + CU_pSuite pSuite = nullptr; unsigned int num_tests_failed; nghttp2::tls::libssl_init(); @@ -65,7 +65,7 @@ int main(int argc, char *argv[]) { // add a suite to the registry pSuite = CU_add_suite("shrpx_TestSuite", init_suite1, clean_suite1); - if (NULL == pSuite) { + if (nullptr == pSuite) { CU_cleanup_registry(); return CU_get_error(); } diff --git a/src/shrpx_http2_session.cc b/src/shrpx_http2_session.cc index 37a6eb40..4fcb90b7 100644 --- a/src/shrpx_http2_session.cc +++ b/src/shrpx_http2_session.cc @@ -1875,7 +1875,7 @@ void Http2Session::start_checking_connection() { SSLOG(INFO, this) << "Start checking connection"; // If connection is down, we may get error when writing data. Issue // ping frame to see whether connection is alive. - nghttp2_submit_ping(session_, NGHTTP2_FLAG_NONE, NULL); + nghttp2_submit_ping(session_, NGHTTP2_FLAG_NONE, nullptr); // set ping timeout and start timer again reset_connection_check_timer(CONNCHK_PING_TIMEOUT); diff --git a/src/shrpx_log.cc b/src/shrpx_log.cc index fe626d6b..de5e09fa 100644 --- a/src/shrpx_log.cc +++ b/src/shrpx_log.cc @@ -90,7 +90,7 @@ pthread_once_t lckey_once = PTHREAD_ONCE_INIT; } // namespace namespace { -void make_key() { pthread_key_create(&lckey, NULL); } +void make_key() { pthread_key_create(&lckey, nullptr); } } // namespace LogBuffer *get_logbuf() { diff --git a/src/shrpx_log_config.cc b/src/shrpx_log_config.cc index a23184c6..92eb0559 100644 --- a/src/shrpx_log_config.cc +++ b/src/shrpx_log_config.cc @@ -71,7 +71,7 @@ pthread_once_t lckey_once = PTHREAD_ONCE_INIT; } // namespace namespace { -void make_key() { pthread_key_create(&lckey, NULL); } +void make_key() { pthread_key_create(&lckey, nullptr); } } // namespace LogConfig *log_config() { diff --git a/src/util.cc b/src/util.cc index 7ee5acf9..2a2d211a 100644 --- a/src/util.cc +++ b/src/util.cc @@ -90,7 +90,7 @@ int nghttp2_inet_pton(int af, const char *src, void *dst) { int size = sizeof(struct in6_addr); - if (WSAStringToAddress(addr, af, NULL, (LPSOCKADDR)dst, &size) == 0) + if (WSAStringToAddress(addr, af, nullptr, (LPSOCKADDR)dst, &size) == 0) return 1; return 0; # endif diff --git a/src/util_test.cc b/src/util_test.cc index 17d640d5..48d7efaf 100644 --- a/src/util_test.cc +++ b/src/util_test.cc @@ -207,7 +207,7 @@ void test_util_http_date(void) { } void test_util_select_h2(void) { - const unsigned char *out = NULL; + const unsigned char *out = nullptr; unsigned char outlen = 0; // Check single entry and select it. @@ -217,7 +217,7 @@ void test_util_select_h2(void) { memcmp(NGHTTP2_PROTO_VERSION_ID, out, NGHTTP2_PROTO_VERSION_ID_LEN) == 0); CU_ASSERT(NGHTTP2_PROTO_VERSION_ID_LEN == outlen); - out = NULL; + out = nullptr; outlen = 0; // Check the case where id is correct but length is invalid and too @@ -233,7 +233,7 @@ void test_util_select_h2(void) { memcmp(NGHTTP2_PROTO_VERSION_ID, out, NGHTTP2_PROTO_VERSION_ID_LEN) == 0); CU_ASSERT(NGHTTP2_PROTO_VERSION_ID_LEN == outlen); - out = NULL; + out = nullptr; outlen = 0; // Check the case that last entry's length is invalid and too long.