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;
|
||||
stats.req_todo += client->req_todo;
|
||||
auto index = &client - &clients[0];
|
||||
clients[index] = NULL;
|
||||
clients[index] = nullptr;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue