diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2014-10-22 03:29:32 +0200 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2014-10-23 22:49:58 +0200 |
commit | 2d82cdf670d88f2f5acc7d1b759cf0cbb3f99962 (patch) | |
tree | a6957d0fa3f6cc76e100ae279e389447b5055029 /src/handle_wrap.cc | |
parent | b2b59febe8bf1d411e7d8faacd23789784aac1f0 (diff) | |
download | node-new-2d82cdf670d88f2f5acc7d1b759cf0cbb3f99962.tar.gz |
src: replace NULL with nullptr
Now that we are building with C++11 features enabled, replace use
of NULL with nullptr.
The benefit of using nullptr is that it can never be confused for
an integral type because it does not support implicit conversions
to integral types except boolean - unlike NULL, which is defined
as a literal `0`.
Diffstat (limited to 'src/handle_wrap.cc')
-rw-r--r-- | src/handle_wrap.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/handle_wrap.cc b/src/handle_wrap.cc index ecca915c43..595ea7d3a5 100644 --- a/src/handle_wrap.cc +++ b/src/handle_wrap.cc @@ -43,7 +43,7 @@ using v8::Value; void HandleWrap::Ref(const FunctionCallbackInfo<Value>& args) { HandleWrap* wrap = Unwrap<HandleWrap>(args.Holder()); - if (wrap != NULL && wrap->handle__ != NULL) { + if (wrap != nullptr && wrap->handle__ != nullptr) { uv_ref(wrap->handle__); wrap->flags_ &= ~kUnref; } @@ -53,7 +53,7 @@ void HandleWrap::Ref(const FunctionCallbackInfo<Value>& args) { void HandleWrap::Unref(const FunctionCallbackInfo<Value>& args) { HandleWrap* wrap = Unwrap<HandleWrap>(args.Holder()); - if (wrap != NULL && wrap->handle__ != NULL) { + if (wrap != nullptr && wrap->handle__ != nullptr) { uv_unref(wrap->handle__); wrap->flags_ |= kUnref; } @@ -66,12 +66,12 @@ void HandleWrap::Close(const FunctionCallbackInfo<Value>& args) { HandleWrap* wrap = Unwrap<HandleWrap>(args.Holder()); // guard against uninitialized handle or double close - if (wrap == NULL || wrap->handle__ == NULL) + if (wrap == nullptr || wrap->handle__ == nullptr) return; CHECK_EQ(false, wrap->persistent().IsEmpty()); uv_close(wrap->handle__, OnClose); - wrap->handle__ = NULL; + wrap->handle__ = nullptr; if (args[0]->IsFunction()) { wrap->object()->Set(env->close_string(), args[0]); @@ -109,17 +109,17 @@ void HandleWrap::OnClose(uv_handle_t* handle) { CHECK_EQ(wrap->persistent().IsEmpty(), false); // But the handle pointer should be gone. - CHECK_EQ(wrap->handle__, NULL); + CHECK_EQ(wrap->handle__, nullptr); HandleScope handle_scope(env->isolate()); Context::Scope context_scope(env->context()); Local<Object> object = wrap->object(); if (wrap->flags_ & kCloseCallback) { - wrap->MakeCallback(env->close_string(), 0, NULL); + wrap->MakeCallback(env->close_string(), 0, nullptr); } - object->SetAlignedPointerInInternalField(0, NULL); + object->SetAlignedPointerInInternalField(0, nullptr); wrap->persistent().Reset(); delete wrap; } |