GeezerVison is showing github.com — src: replace NULL with nullptr · easternbloc/node@2d82cdf
File treeExpand file treeCollapse file tree Open diff view settings Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: src/async-wrap-inl.h +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -100,7 +100,7 @@ inline v8::Handle<v8::Value> AsyncWrap::MakeDomainCallback( | 100 | 100 | v8::Local<v8::Function> enter = | 101 | 101 | domain->Get(env()->enter_string()).As<v8::Function>(); | 102 | 102 | if (enter->IsFunction()) { | 103 | | - enter->Call(domain, 0, NULL); | | 103 | + enter->Call(domain, 0, nullptr); | 104 | 104 | if (try_catch.HasCaught()) | 105 | 105 | return Undefined(env()->isolate()); | 106 | 106 | } | @@ -116,7 +116,7 @@ inline v8::Handle<v8::Value> AsyncWrap::MakeDomainCallback( | 116 | 116 | v8::Local<v8::Function> exit = | 117 | 117 | domain->Get(env()->exit_string()).As<v8::Function>(); | 118 | 118 | if (exit->IsFunction()) { | 119 | | - exit->Call(domain, 0, NULL); | | 119 | + exit->Call(domain, 0, nullptr); | 120 | 120 | if (try_catch.HasCaught()) | 121 | 121 | return Undefined(env()->isolate()); | 122 | 122 | } | @@ -147,7 +147,7 @@ inline v8::Handle<v8::Value> AsyncWrap::MakeDomainCallback( | 147 | 147 |
| 148 | 148 | tick_info->set_in_tick(true); | 149 | 149 |
| 150 | | - env()->tick_callback_function()->Call(process, 0, NULL); | | 150 | + env()->tick_callback_function()->Call(process, 0, nullptr); | 151 | 151 |
| 152 | 152 | tick_info->set_in_tick(false); | 153 | 153 |
| @@ -214,7 +214,7 @@ inline v8::Handle<v8::Value> AsyncWrap::MakeCallback( | 214 | 214 |
| 215 | 215 | tick_info->set_in_tick(true); | 216 | 216 |
| 217 | | - env()->tick_callback_function()->Call(process, 0, NULL); | | 217 | + env()->tick_callback_function()->Call(process, 0, nullptr); | 218 | 218 |
| 219 | 219 | tick_info->set_in_tick(false); | 220 | 220 |
| |
Collapse file Copy file name to clipboardExpand all lines: src/cares_wrap.cc +20-20Lines changed: 20 additions & 20 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -121,9 +121,9 @@ static void ares_poll_close_cb(uv_handle_t* watcher) { | 121 | 121 | static ares_task_t* ares_task_create(Environment* env, ares_socket_t sock) { | 122 | 122 | ares_task_t* task = static_cast<ares_task_t*>(malloc(sizeof(*task))); | 123 | 123 |
| 124 | | - if (task == NULL) { | | 124 | + if (task == nullptr) { | 125 | 125 | /* Out of memory. */ | 126 | | - return NULL; | | 126 | + return nullptr; | 127 | 127 | } | 128 | 128 |
| 129 | 129 | task->env = env; | @@ -132,7 +132,7 @@ static ares_task_t* ares_task_create(Environment* env, ares_socket_t sock) { | 132 | 132 | if (uv_poll_init_socket(env->event_loop(), &task->poll_watcher, sock) < 0) { | 133 | 133 | /* This should never happen. */ | 134 | 134 | free(task); | 135 | | - return NULL; | | 135 | + return nullptr; | 136 | 136 | } | 137 | 137 |
| 138 | 138 | return task; | @@ -163,7 +163,7 @@ static void ares_sockstate_cb(void* data, | 163 | 163 | } | 164 | 164 |
| 165 | 165 | task = ares_task_create(env, sock); | 166 | | - if (task == NULL) { | | 166 | + if (task == nullptr) { | 167 | 167 | /* This should never happen unless we're out of memory or something */ | 168 | 168 | /* is seriously wrong. The socket won't be polled, but the the query */ | 169 | 169 | /* will eventually time out. */ | @@ -202,7 +202,7 @@ static Local<Array> HostentToAddresses(Environment* env, struct hostent* host) { | 202 | 202 | Local<Array> addresses = Array::New(env->isolate()); | 203 | 203 |
| 204 | 204 | 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) { | 206 | 206 | uv_inet_ntop(host->h_addrtype, host->h_addr_list[i], ip, sizeof(ip)); | 207 | 207 | Local<String> address = OneByteString(env->isolate(), ip); | 208 | 208 | addresses->Set(i, address); | @@ -216,7 +216,7 @@ static Local<Array> HostentToNames(Environment* env, struct hostent* host) { | 216 | 216 | EscapableHandleScope scope(env->isolate()); | 217 | 217 | Local<Array> names = Array::New(env->isolate()); | 218 | 218 |
| 219 | | - for (uint32_t i = 0; host->h_aliases[i] != NULL; ++i) { | | 219 | + for (uint32_t i = 0; host->h_aliases[i] != nullptr; ++i) { | 220 | 220 | Local<String> address = OneByteString(env->isolate(), host->h_aliases[i]); | 221 | 221 | names->Set(i, address); | 222 | 222 | } | @@ -375,7 +375,7 @@ class QueryAWrap: public QueryWrap { | 375 | 375 |
| 376 | 376 | struct hostent* host; | 377 | 377 |
| 378 | | - int status = ares_parse_a_reply(buf, len, &host, NULL, NULL); | | 378 | + int status = ares_parse_a_reply(buf, len, &host, nullptr, nullptr); | 379 | 379 | if (status != ARES_SUCCESS) { | 380 | 380 | ParseError(status); | 381 | 381 | return; | @@ -412,7 +412,7 @@ class QueryAaaaWrap: public QueryWrap { | 412 | 412 |
| 413 | 413 | struct hostent* host; | 414 | 414 |
| 415 | | - int status = ares_parse_aaaa_reply(buf, len, &host, NULL, NULL); | | 415 | + int status = ares_parse_aaaa_reply(buf, len, &host, nullptr, nullptr); | 416 | 416 | if (status != ARES_SUCCESS) { | 417 | 417 | ParseError(status); | 418 | 418 | return; | @@ -448,7 +448,7 @@ class QueryCnameWrap: public QueryWrap { | 448 | 448 | Context::Scope context_scope(env()->context()); | 449 | 449 | struct hostent* host; | 450 | 450 |
| 451 | | - int status = ares_parse_a_reply(buf, len, &host, NULL, NULL); | | 451 | + int status = ares_parse_a_reply(buf, len, &host, nullptr, nullptr); | 452 | 452 | if (status != ARES_SUCCESS) { | 453 | 453 | ParseError(status); | 454 | 454 | return; | @@ -498,7 +498,7 @@ class QueryMxWrap: public QueryWrap { | 498 | 498 | Local<String> priority_symbol = env()->priority_string(); | 499 | 499 |
| 500 | 500 | 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) { | 502 | 502 | Local<Object> mx_record = Object::New(env()->isolate()); | 503 | 503 | mx_record->Set(exchange_symbol, | 504 | 504 | OneByteString(env()->isolate(), current->host)); | @@ -583,7 +583,7 @@ class QueryTxtWrap: public QueryWrap { | 583 | 583 |
| 584 | 584 | ares_txt_reply* current = txt_out; | 585 | 585 | 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) { | 587 | 587 | Local<String> txt = OneByteString(env()->isolate(), current->txt); | 588 | 588 | // New record found - write out the current chunk | 589 | 589 | if (current->record_start) { | @@ -639,7 +639,7 @@ class QuerySrvWrap: public QueryWrap { | 639 | 639 | Local<String> weight_symbol = env()->weight_string(); | 640 | 640 |
| 641 | 641 | 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) { | 643 | 643 | Local<Object> srv_record = Object::New(env()->isolate()); | 644 | 644 | srv_record->Set(name_symbol, | 645 | 645 | OneByteString(env()->isolate(), current->host)); | @@ -696,7 +696,7 @@ class QueryNaptrWrap: public QueryWrap { | 696 | 696 | Local<String> preference_symbol = env()->preference_string(); | 697 | 697 |
| 698 | 698 | 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) { | 700 | 700 | Local<Object> naptr_record = Object::New(env()->isolate()); | 701 | 701 | naptr_record->Set(flags_symbol, | 702 | 702 | OneByteString(env()->isolate(), current->flags)); | @@ -1044,7 +1044,7 @@ static void GetAddrInfo(const FunctionCallbackInfo<Value>& args) { | 1044 | 1044 | &req_wrap->req_, | 1045 | 1045 | AfterGetAddrInfo, | 1046 | 1046 | *hostname, | 1047 | | - NULL, | | 1047 | + nullptr, | 1048 | 1048 | &hints); | 1049 | 1049 | req_wrap->Dispatched(); | 1050 | 1050 | if (err) | @@ -1098,7 +1098,7 @@ static void GetServers(const FunctionCallbackInfo<Value>& args) { | 1098 | 1098 |
| 1099 | 1099 | ares_addr_node* cur = servers; | 1100 | 1100 |
| 1101 | | - for (uint32_t i = 0; cur != NULL; ++i, cur = cur->next) { | | 1101 | + for (uint32_t i = 0; cur != nullptr; ++i, cur = cur->next) { | 1102 | 1102 | char ip[INET6_ADDRSTRLEN]; | 1103 | 1103 |
| 1104 | 1104 | const void* caddr = static_cast<const void*>(&cur->addr); | @@ -1125,12 +1125,12 @@ static void SetServers(const FunctionCallbackInfo<Value>& args) { | 1125 | 1125 | uint32_t len = arr->Length(); | 1126 | 1126 |
| 1127 | 1127 | if (len == 0) { | 1128 | | - int rv = ares_set_servers(env->cares_channel(), NULL); | | 1128 | + int rv = ares_set_servers(env->cares_channel(), nullptr); | 1129 | 1129 | return args.GetReturnValue().Set(rv); | 1130 | 1130 | } | 1131 | 1131 |
| 1132 | 1132 | ares_addr_node* servers = new ares_addr_node[len]; | 1133 | | - ares_addr_node* last = NULL; | | 1133 | + ares_addr_node* last = nullptr; | 1134 | 1134 |
| 1135 | 1135 | int err; | 1136 | 1136 |
| @@ -1164,9 +1164,9 @@ static void SetServers(const FunctionCallbackInfo<Value>& args) { | 1164 | 1164 | if (err) | 1165 | 1165 | break; | 1166 | 1166 |
| 1167 | | - cur->next = NULL; | | 1167 | + cur->next = nullptr; | 1168 | 1168 |
| 1169 | | - if (last != NULL) | | 1169 | + if (last != nullptr) | 1170 | 1170 | last->next = cur; | 1171 | 1171 |
| 1172 | 1172 | last = cur; | @@ -1230,7 +1230,7 @@ static void Initialize(Handle<Object> target, | 1230 | 1230 | env->RegisterHandleCleanup( | 1231 | 1231 | reinterpret_cast<uv_handle_t*>(env->cares_timer_handle()), | 1232 | 1232 | CaresTimerClose, | 1233 | | - NULL); | | 1233 | + nullptr); | 1234 | 1234 |
| 1235 | 1235 | env->SetMethod(target, "queryA", Query<QueryAWrap>); | 1236 | 1236 | env->SetMethod(target, "queryAaaa", Query<QueryAaaaWrap>); | |
Collapse file Copy file name to clipboardExpand all lines: src/env-inl.h +4-3Lines changed: 4 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -76,7 +76,7 @@ inline Environment::IsolateData* Environment::IsolateData::Get( | 76 | 76 | inline Environment::IsolateData* Environment::IsolateData::GetOrCreate( | 77 | 77 | v8::Isolate* isolate, uv_loop_t* loop) { | 78 | 78 | IsolateData* isolate_data = Get(isolate); | 79 | | - if (isolate_data == NULL) { | | 79 | + if (isolate_data == nullptr) { | 80 | 80 | isolate_data = new IsolateData(isolate, loop); | 81 | 81 | isolate->SetData(kIsolateSlot, isolate_data); | 82 | 82 | } | @@ -86,7 +86,7 @@ inline Environment::IsolateData* Environment::IsolateData::GetOrCreate( | 86 | 86 |
| 87 | 87 | inline void Environment::IsolateData::Put() { | 88 | 88 | if (--ref_count_ == 0) { | 89 | | - isolate()->SetData(kIsolateSlot, NULL); | | 89 | + isolate()->SetData(kIsolateSlot, nullptr); | 90 | 90 | delete this; | 91 | 91 | } | 92 | 92 | } | @@ -246,7 +246,8 @@ inline Environment::Environment(v8::Local<v8::Context> context, | 246 | 246 | inline Environment::~Environment() { | 247 | 247 | v8::HandleScope handle_scope(isolate()); | 248 | 248 |
| 249 | | - context()->SetAlignedPointerInEmbedderData(kContextEmbedderDataIndex, NULL); | | 249 | + context()->SetAlignedPointerInEmbedderData(kContextEmbedderDataIndex, | | 250 | + nullptr); | 250 | 251 | #define V(PropertyName, TypeName) PropertyName ## _.Reset(); | 251 | 252 | ENVIRONMENT_STRONG_PERSISTENT_PROPERTIES(V) | 252 | 253 | #undef V | |
Collapse file Copy file name to clipboardExpand all lines: src/env.h +6-6Lines changed: 6 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -442,13 +442,13 @@ class Environment { | 442 | 442 | inline void ThrowTypeError(const char* errmsg); | 443 | 443 | inline void ThrowRangeError(const char* errmsg); | 444 | 444 | inline void ThrowErrnoException(int errorno, | 445 | | - const char* syscall = NULL, | 446 | | - const char* message = NULL, | 447 | | - const char* path = NULL); | | 445 | + const char* syscall = nullptr, | | 446 | + const char* message = nullptr, | | 447 | + const char* path = nullptr); | 448 | 448 | inline void ThrowUVException(int errorno, | 449 | | - const char* syscall = NULL, | 450 | | - const char* message = NULL, | 451 | | - const char* path = NULL); | | 449 | + const char* syscall = nullptr, | | 450 | + const char* message = nullptr, | | 451 | + const char* path = nullptr); | 452 | 452 |
| 453 | 453 | // Convenience methods for contextify | 454 | 454 | inline static void ThrowError(v8::Isolate* isolate, const char* errmsg); | |
Collapse file Copy file name to clipboardExpand all lines: src/fs_event_wrap.cc +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -175,7 +175,7 @@ void FSEventWrap::OnEvent(uv_fs_event_t* handle, const char* filename, | 175 | 175 | Null(env->isolate()) | 176 | 176 | }; | 177 | 177 |
| 178 | | - if (filename != NULL) { | | 178 | + if (filename != nullptr) { | 179 | 179 | argv[2] = OneByteString(env->isolate(), filename); | 180 | 180 | } | 181 | 181 |
| @@ -186,7 +186,7 @@ void FSEventWrap::OnEvent(uv_fs_event_t* handle, const char* filename, | 186 | 186 | void FSEventWrap::Close(const FunctionCallbackInfo<Value>& args) { | 187 | 187 | FSEventWrap* wrap = Unwrap<FSEventWrap>(args.Holder()); | 188 | 188 |
| 189 | | - if (wrap == NULL || wrap->initialized_ == false) | | 189 | + if (wrap == nullptr || wrap->initialized_ == false) | 190 | 190 | return; | 191 | 191 | wrap->initialized_ = false; | 192 | 192 |
| |
Collapse file Copy file name to clipboardExpand all lines: src/handle_wrap.cc +7-7Lines changed: 7 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -43,7 +43,7 @@ using v8::Value; | 43 | 43 | void HandleWrap::Ref(const FunctionCallbackInfo<Value>& args) { | 44 | 44 | HandleWrap* wrap = Unwrap<HandleWrap>(args.Holder()); | 45 | 45 |
| 46 | | - if (wrap != NULL && wrap->handle__ != NULL) { | | 46 | + if (wrap != nullptr && wrap->handle__ != nullptr) { | 47 | 47 | uv_ref(wrap->handle__); | 48 | 48 | wrap->flags_ &= ~kUnref; | 49 | 49 | } | @@ -53,7 +53,7 @@ void HandleWrap::Ref(const FunctionCallbackInfo<Value>& args) { | 53 | 53 | void HandleWrap::Unref(const FunctionCallbackInfo<Value>& args) { | 54 | 54 | HandleWrap* wrap = Unwrap<HandleWrap>(args.Holder()); | 55 | 55 |
| 56 | | - if (wrap != NULL && wrap->handle__ != NULL) { | | 56 | + if (wrap != nullptr && wrap->handle__ != nullptr) { | 57 | 57 | uv_unref(wrap->handle__); | 58 | 58 | wrap->flags_ |= kUnref; | 59 | 59 | } | @@ -66,12 +66,12 @@ void HandleWrap::Close(const FunctionCallbackInfo<Value>& args) { | 66 | 66 | HandleWrap* wrap = Unwrap<HandleWrap>(args.Holder()); | 67 | 67 |
| 68 | 68 | // guard against uninitialized handle or double close | 69 | | - if (wrap == NULL || wrap->handle__ == NULL) | | 69 | + if (wrap == nullptr || wrap->handle__ == nullptr) | 70 | 70 | return; | 71 | 71 |
| 72 | 72 | CHECK_EQ(false, wrap->persistent().IsEmpty()); | 73 | 73 | uv_close(wrap->handle__, OnClose); | 74 | | - wrap->handle__ = NULL; | | 74 | + wrap->handle__ = nullptr; | 75 | 75 |
| 76 | 76 | if (args[0]->IsFunction()) { | 77 | 77 | wrap->object()->Set(env->close_string(), args[0]); | @@ -109,17 +109,17 @@ void HandleWrap::OnClose(uv_handle_t* handle) { | 109 | 109 | CHECK_EQ(wrap->persistent().IsEmpty(), false); | 110 | 110 |
| 111 | 111 | // But the handle pointer should be gone. | 112 | | - CHECK_EQ(wrap->handle__, NULL); | | 112 | + CHECK_EQ(wrap->handle__, nullptr); | 113 | 113 |
| 114 | 114 | HandleScope handle_scope(env->isolate()); | 115 | 115 | Context::Scope context_scope(env->context()); | 116 | 116 | Local<Object> object = wrap->object(); | 117 | 117 |
| 118 | 118 | if (wrap->flags_ & kCloseCallback) { | 119 | | - wrap->MakeCallback(env->close_string(), 0, NULL); | | 119 | + wrap->MakeCallback(env->close_string(), 0, nullptr); | 120 | 120 | } | 121 | 121 |
| 122 | | - object->SetAlignedPointerInInternalField(0, NULL); | | 122 | + object->SetAlignedPointerInInternalField(0, nullptr); | 123 | 123 | wrap->persistent().Reset(); | 124 | 124 | delete wrap; | 125 | 125 | } | |
|