Use nullptr for C++ code
This commit is contained in:
parent
02f2336ab1
commit
bd3cc94a36
|
@ -1589,7 +1589,7 @@ void Worker::free_client(Client *deleted_client) {
|
||||||
client->req_todo = client->req_done;
|
client->req_todo = client->req_done;
|
||||||
stats.req_todo += client->req_todo;
|
stats.req_todo += client->req_todo;
|
||||||
auto index = &client - &clients[0];
|
auto index = &client - &clients[0];
|
||||||
clients[index] = NULL;
|
clients[index] = nullptr;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -319,7 +319,8 @@ int Http3Session::init_conn() {
|
||||||
|
|
||||||
int64_t ctrl_stream_id;
|
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) {
|
if (rv != 0) {
|
||||||
std::cerr << "ngtcp2_conn_open_uni_stream: " << ngtcp2_strerror(rv)
|
std::cerr << "ngtcp2_conn_open_uni_stream: " << ngtcp2_strerror(rv)
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
@ -336,7 +337,7 @@ int Http3Session::init_conn() {
|
||||||
int64_t qpack_enc_stream_id, qpack_dec_stream_id;
|
int64_t qpack_enc_stream_id, qpack_dec_stream_id;
|
||||||
|
|
||||||
rv = ngtcp2_conn_open_uni_stream(client_->quic.conn, &qpack_enc_stream_id,
|
rv = ngtcp2_conn_open_uni_stream(client_->quic.conn, &qpack_enc_stream_id,
|
||||||
NULL);
|
nullptr);
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
std::cerr << "ngtcp2_conn_open_uni_stream: " << ngtcp2_strerror(rv)
|
std::cerr << "ngtcp2_conn_open_uni_stream: " << ngtcp2_strerror(rv)
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
@ -344,7 +345,7 @@ int Http3Session::init_conn() {
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = ngtcp2_conn_open_uni_stream(client_->quic.conn, &qpack_dec_stream_id,
|
rv = ngtcp2_conn_open_uni_stream(client_->quic.conn, &qpack_dec_stream_id,
|
||||||
NULL);
|
nullptr);
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
std::cerr << "ngtcp2_conn_open_uni_stream: " << ngtcp2_strerror(rv)
|
std::cerr << "ngtcp2_conn_open_uni_stream: " << ngtcp2_strerror(rv)
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
|
@ -171,7 +171,7 @@ static int inflate_hd(json_t *obj, nghttp2_hd_inflater *inflater, int seq) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int perform(void) {
|
static int perform(void) {
|
||||||
nghttp2_hd_inflater *inflater = NULL;
|
nghttp2_hd_inflater *inflater = nullptr;
|
||||||
json_error_t error;
|
json_error_t error;
|
||||||
|
|
||||||
auto json = json_loadf(stdin, 0, &error);
|
auto json = json_loadf(stdin, 0, &error);
|
||||||
|
|
|
@ -55,7 +55,7 @@ namespace nghttp2 {
|
||||||
namespace {
|
namespace {
|
||||||
int parse_push_config(Config &config, const char *optarg) {
|
int parse_push_config(Config &config, const char *optarg) {
|
||||||
const char *eq = strchr(optarg, '=');
|
const char *eq = strchr(optarg, '=');
|
||||||
if (eq == NULL) {
|
if (eq == nullptr) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
auto &paths = config.push[std::string(optarg, eq)];
|
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;
|
auto i = eq + 1;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
const char *j = strchr(i, ',');
|
const char *j = strchr(i, ',');
|
||||||
if (j == NULL) {
|
if (j == nullptr) {
|
||||||
j = optarg_end;
|
j = optarg_end;
|
||||||
}
|
}
|
||||||
paths.emplace_back(i, j);
|
paths.emplace_back(i, j);
|
||||||
|
|
|
@ -52,7 +52,7 @@ static int init_suite1(void) { return 0; }
|
||||||
static int clean_suite1(void) { return 0; }
|
static int clean_suite1(void) { return 0; }
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
CU_pSuite pSuite = NULL;
|
CU_pSuite pSuite = nullptr;
|
||||||
unsigned int num_tests_failed;
|
unsigned int num_tests_failed;
|
||||||
|
|
||||||
nghttp2::tls::libssl_init();
|
nghttp2::tls::libssl_init();
|
||||||
|
@ -65,7 +65,7 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
// add a suite to the registry
|
// add a suite to the registry
|
||||||
pSuite = CU_add_suite("shrpx_TestSuite", init_suite1, clean_suite1);
|
pSuite = CU_add_suite("shrpx_TestSuite", init_suite1, clean_suite1);
|
||||||
if (NULL == pSuite) {
|
if (nullptr == pSuite) {
|
||||||
CU_cleanup_registry();
|
CU_cleanup_registry();
|
||||||
return CU_get_error();
|
return CU_get_error();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1875,7 +1875,7 @@ void Http2Session::start_checking_connection() {
|
||||||
SSLOG(INFO, this) << "Start checking connection";
|
SSLOG(INFO, this) << "Start checking connection";
|
||||||
// If connection is down, we may get error when writing data. Issue
|
// If connection is down, we may get error when writing data. Issue
|
||||||
// ping frame to see whether connection is alive.
|
// 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
|
// set ping timeout and start timer again
|
||||||
reset_connection_check_timer(CONNCHK_PING_TIMEOUT);
|
reset_connection_check_timer(CONNCHK_PING_TIMEOUT);
|
||||||
|
|
|
@ -90,7 +90,7 @@ pthread_once_t lckey_once = PTHREAD_ONCE_INIT;
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
void make_key() { pthread_key_create(&lckey, NULL); }
|
void make_key() { pthread_key_create(&lckey, nullptr); }
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
LogBuffer *get_logbuf() {
|
LogBuffer *get_logbuf() {
|
||||||
|
|
|
@ -71,7 +71,7 @@ pthread_once_t lckey_once = PTHREAD_ONCE_INIT;
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
void make_key() { pthread_key_create(&lckey, NULL); }
|
void make_key() { pthread_key_create(&lckey, nullptr); }
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
LogConfig *log_config() {
|
LogConfig *log_config() {
|
||||||
|
|
|
@ -90,7 +90,7 @@ int nghttp2_inet_pton(int af, const char *src, void *dst) {
|
||||||
|
|
||||||
int size = sizeof(struct in6_addr);
|
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 1;
|
||||||
return 0;
|
return 0;
|
||||||
# endif
|
# endif
|
||||||
|
|
|
@ -207,7 +207,7 @@ void test_util_http_date(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_util_select_h2(void) {
|
void test_util_select_h2(void) {
|
||||||
const unsigned char *out = NULL;
|
const unsigned char *out = nullptr;
|
||||||
unsigned char outlen = 0;
|
unsigned char outlen = 0;
|
||||||
|
|
||||||
// Check single entry and select it.
|
// 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);
|
memcmp(NGHTTP2_PROTO_VERSION_ID, out, NGHTTP2_PROTO_VERSION_ID_LEN) == 0);
|
||||||
CU_ASSERT(NGHTTP2_PROTO_VERSION_ID_LEN == outlen);
|
CU_ASSERT(NGHTTP2_PROTO_VERSION_ID_LEN == outlen);
|
||||||
|
|
||||||
out = NULL;
|
out = nullptr;
|
||||||
outlen = 0;
|
outlen = 0;
|
||||||
|
|
||||||
// Check the case where id is correct but length is invalid and too
|
// 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);
|
memcmp(NGHTTP2_PROTO_VERSION_ID, out, NGHTTP2_PROTO_VERSION_ID_LEN) == 0);
|
||||||
CU_ASSERT(NGHTTP2_PROTO_VERSION_ID_LEN == outlen);
|
CU_ASSERT(NGHTTP2_PROTO_VERSION_ID_LEN == outlen);
|
||||||
|
|
||||||
out = NULL;
|
out = nullptr;
|
||||||
outlen = 0;
|
outlen = 0;
|
||||||
|
|
||||||
// Check the case that last entry's length is invalid and too long.
|
// Check the case that last entry's length is invalid and too long.
|
||||||
|
|
Loading…
Reference in New Issue