@@ -121,9 +121,9 @@ static void ares_poll_close_cb(uv_handle_t* watcher) {
121121static ares_task_t * ares_task_create (Environment* env, ares_socket_t sock) {
122122 ares_task_t * task = static_cast <ares_task_t *>(malloc (sizeof (*task)));
123123
124- if (task == NULL ) {
124+ if (task == nullptr ) {
125125 /* Out of memory. */
126- return NULL ;
126+ return nullptr ;
127127 }
128128
129129 task->env = env;
@@ -132,7 +132,7 @@ static ares_task_t* ares_task_create(Environment* env, ares_socket_t sock) {
132132 if (uv_poll_init_socket (env->event_loop (), &task->poll_watcher , sock) < 0 ) {
133133 /* This should never happen. */
134134 free (task);
135- return NULL ;
135+ return nullptr ;
136136 }
137137
138138 return task;
@@ -163,7 +163,7 @@ static void ares_sockstate_cb(void* data,
163163 }
164164
165165 task = ares_task_create (env, sock);
166- if (task == NULL ) {
166+ if (task == nullptr ) {
167167 /* This should never happen unless we're out of memory or something */
168168 /* is seriously wrong. The socket won't be polled, but the the query */
169169 /* will eventually time out. */
@@ -202,7 +202,7 @@ static Local<Array> HostentToAddresses(Environment* env, struct hostent* host) {
202202 Local<Array> addresses = Array::New (env->isolate ());
203203
204204 char ip[INET6_ADDRSTRLEN];
205- for (uint32_t i = 0 ; host->h_addr_list [i] != NULL ; ++i) {
205+ for (uint32_t i = 0 ; host->h_addr_list [i] != nullptr ; ++i) {
206206 uv_inet_ntop (host->h_addrtype , host->h_addr_list [i], ip, sizeof (ip));
207207 Local<String> address = OneByteString (env->isolate (), ip);
208208 addresses->Set (i, address);
@@ -216,7 +216,7 @@ static Local<Array> HostentToNames(Environment* env, struct hostent* host) {
216216 EscapableHandleScope scope (env->isolate ());
217217 Local<Array> names = Array::New (env->isolate ());
218218
219- for (uint32_t i = 0 ; host->h_aliases [i] != NULL ; ++i) {
219+ for (uint32_t i = 0 ; host->h_aliases [i] != nullptr ; ++i) {
220220 Local<String> address = OneByteString (env->isolate (), host->h_aliases [i]);
221221 names->Set (i, address);
222222 }
@@ -375,7 +375,7 @@ class QueryAWrap: public QueryWrap {
375375
376376 struct hostent * host;
377377
378- int status = ares_parse_a_reply (buf, len, &host, NULL , NULL );
378+ int status = ares_parse_a_reply (buf, len, &host, nullptr , nullptr );
379379 if (status != ARES_SUCCESS) {
380380 ParseError (status);
381381 return ;
@@ -412,7 +412,7 @@ class QueryAaaaWrap: public QueryWrap {
412412
413413 struct hostent * host;
414414
415- int status = ares_parse_aaaa_reply (buf, len, &host, NULL , NULL );
415+ int status = ares_parse_aaaa_reply (buf, len, &host, nullptr , nullptr );
416416 if (status != ARES_SUCCESS) {
417417 ParseError (status);
418418 return ;
@@ -448,7 +448,7 @@ class QueryCnameWrap: public QueryWrap {
448448 Context::Scope context_scope (env ()->context ());
449449 struct hostent * host;
450450
451- int status = ares_parse_a_reply (buf, len, &host, NULL , NULL );
451+ int status = ares_parse_a_reply (buf, len, &host, nullptr , nullptr );
452452 if (status != ARES_SUCCESS) {
453453 ParseError (status);
454454 return ;
@@ -498,7 +498,7 @@ class QueryMxWrap: public QueryWrap {
498498 Local<String> priority_symbol = env ()->priority_string ();
499499
500500 ares_mx_reply* current = mx_start;
501- for (uint32_t i = 0 ; current != NULL ; ++i, current = current->next ) {
501+ for (uint32_t i = 0 ; current != nullptr ; ++i, current = current->next ) {
502502 Local<Object> mx_record = Object::New (env ()->isolate ());
503503 mx_record->Set (exchange_symbol,
504504 OneByteString (env ()->isolate (), current->host ));
@@ -583,7 +583,7 @@ class QueryTxtWrap: public QueryWrap {
583583
584584 ares_txt_reply* current = txt_out;
585585 uint32_t i = 0 ;
586- for (uint32_t j = 0 ; current != NULL ; current = current->next ) {
586+ for (uint32_t j = 0 ; current != nullptr ; current = current->next ) {
587587 Local<String> txt = OneByteString (env ()->isolate (), current->txt );
588588 // New record found - write out the current chunk
589589 if (current->record_start ) {
@@ -639,7 +639,7 @@ class QuerySrvWrap: public QueryWrap {
639639 Local<String> weight_symbol = env ()->weight_string ();
640640
641641 ares_srv_reply* current = srv_start;
642- for (uint32_t i = 0 ; current != NULL ; ++i, current = current->next ) {
642+ for (uint32_t i = 0 ; current != nullptr ; ++i, current = current->next ) {
643643 Local<Object> srv_record = Object::New (env ()->isolate ());
644644 srv_record->Set (name_symbol,
645645 OneByteString (env ()->isolate (), current->host ));
@@ -696,7 +696,7 @@ class QueryNaptrWrap: public QueryWrap {
696696 Local<String> preference_symbol = env ()->preference_string ();
697697
698698 ares_naptr_reply* current = naptr_start;
699- for (uint32_t i = 0 ; current != NULL ; ++i, current = current->next ) {
699+ for (uint32_t i = 0 ; current != nullptr ; ++i, current = current->next ) {
700700 Local<Object> naptr_record = Object::New (env ()->isolate ());
701701 naptr_record->Set (flags_symbol,
702702 OneByteString (env ()->isolate (), current->flags ));
@@ -1044,7 +1044,7 @@ static void GetAddrInfo(const FunctionCallbackInfo<Value>& args) {
10441044 &req_wrap->req_ ,
10451045 AfterGetAddrInfo,
10461046 *hostname,
1047- NULL ,
1047+ nullptr ,
10481048 &hints);
10491049 req_wrap->Dispatched ();
10501050 if (err)
@@ -1098,7 +1098,7 @@ static void GetServers(const FunctionCallbackInfo<Value>& args) {
10981098
10991099 ares_addr_node* cur = servers;
11001100
1101- for (uint32_t i = 0 ; cur != NULL ; ++i, cur = cur->next ) {
1101+ for (uint32_t i = 0 ; cur != nullptr ; ++i, cur = cur->next ) {
11021102 char ip[INET6_ADDRSTRLEN];
11031103
11041104 const void * caddr = static_cast <const void *>(&cur->addr );
@@ -1125,12 +1125,12 @@ static void SetServers(const FunctionCallbackInfo<Value>& args) {
11251125 uint32_t len = arr->Length ();
11261126
11271127 if (len == 0 ) {
1128- int rv = ares_set_servers (env->cares_channel (), NULL );
1128+ int rv = ares_set_servers (env->cares_channel (), nullptr );
11291129 return args.GetReturnValue ().Set (rv);
11301130 }
11311131
11321132 ares_addr_node* servers = new ares_addr_node[len];
1133- ares_addr_node* last = NULL ;
1133+ ares_addr_node* last = nullptr ;
11341134
11351135 int err;
11361136
@@ -1164,9 +1164,9 @@ static void SetServers(const FunctionCallbackInfo<Value>& args) {
11641164 if (err)
11651165 break ;
11661166
1167- cur->next = NULL ;
1167+ cur->next = nullptr ;
11681168
1169- if (last != NULL )
1169+ if (last != nullptr )
11701170 last->next = cur;
11711171
11721172 last = cur;
@@ -1230,7 +1230,7 @@ static void Initialize(Handle<Object> target,
12301230 env->RegisterHandleCleanup (
12311231 reinterpret_cast <uv_handle_t *>(env->cares_timer_handle ()),
12321232 CaresTimerClose,
1233- NULL );
1233+ nullptr );
12341234
12351235 env->SetMethod (target, " queryA" , Query<QueryAWrap>);
12361236 env->SetMethod (target, " queryAaaa" , Query<QueryAaaaWrap>);
0 commit comments