GeezerVison is showing github.com — src: add CHECK_NULL/CHECK_NOT_NULL macros · inre/node@39f2096
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: src/async_wrap.cc +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -310,7 +310,7 @@ static void PromiseHook(PromiseHookType type, Local<Promise> promise, | 310 | 310 | } | 311 | 311 | } | 312 | 312 |
| 313 | | - CHECK_NE(wrap, nullptr); | | 313 | + CHECK_NOT_NULL(wrap); | 314 | 314 | if (type == PromiseHookType::kBefore) { | 315 | 315 | env->async_hooks()->push_async_ids( | 316 | 316 | wrap->get_async_id(), wrap->get_trigger_async_id()); | |
Collapse file Copy file name to clipboardExpand all lines: src/connection_wrap.cc +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -34,7 +34,7 @@ template <typename WrapType, typename UVType> | 34 | 34 | void ConnectionWrap<WrapType, UVType>::OnConnection(uv_stream_t* handle, | 35 | 35 | int status) { | 36 | 36 | WrapType* wrap_data = static_cast<WrapType*>(handle->data); | 37 | | - CHECK_NE(wrap_data, nullptr); | | 37 | + CHECK_NOT_NULL(wrap_data); | 38 | 38 | CHECK_EQ(&wrap_data->handle_, reinterpret_cast<UVType*>(handle)); | 39 | 39 |
| 40 | 40 | Environment* env = wrap_data->env(); | @@ -78,7 +78,7 @@ template <typename WrapType, typename UVType> | 78 | 78 | void ConnectionWrap<WrapType, UVType>::AfterConnect(uv_connect_t* req, | 79 | 79 | int status) { | 80 | 80 | ConnectWrap* req_wrap = static_cast<ConnectWrap*>(req->data); | 81 | | - CHECK_NE(req_wrap, nullptr); | | 81 | + CHECK_NOT_NULL(req_wrap); | 82 | 82 | WrapType* wrap = static_cast<WrapType*>(req->handle->data); | 83 | 83 | CHECK_EQ(req_wrap->env(), wrap->env()); | 84 | 84 | Environment* env = wrap->env(); | |
Collapse file Copy file name to clipboardExpand all lines: src/env-inl.h +5-5Lines changed: 5 additions & 5 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -473,22 +473,22 @@ inline double Environment::get_default_trigger_async_id() { | 473 | 473 | } | 474 | 474 |
| 475 | 475 | inline double* Environment::heap_statistics_buffer() const { | 476 | | - CHECK_NE(heap_statistics_buffer_, nullptr); | | 476 | + CHECK_NOT_NULL(heap_statistics_buffer_); | 477 | 477 | return heap_statistics_buffer_; | 478 | 478 | } | 479 | 479 |
| 480 | 480 | inline void Environment::set_heap_statistics_buffer(double* pointer) { | 481 | | - CHECK_EQ(heap_statistics_buffer_, nullptr); // Should be set only once. | | 481 | + CHECK_NULL(heap_statistics_buffer_); // Should be set only once. | 482 | 482 | heap_statistics_buffer_ = pointer; | 483 | 483 | } | 484 | 484 |
| 485 | 485 | inline double* Environment::heap_space_statistics_buffer() const { | 486 | | - CHECK_NE(heap_space_statistics_buffer_, nullptr); | | 486 | + CHECK_NOT_NULL(heap_space_statistics_buffer_); | 487 | 487 | return heap_space_statistics_buffer_; | 488 | 488 | } | 489 | 489 |
| 490 | 490 | inline void Environment::set_heap_space_statistics_buffer(double* pointer) { | 491 | | - CHECK_EQ(heap_space_statistics_buffer_, nullptr); // Should be set only once. | | 491 | + CHECK_NULL(heap_space_statistics_buffer_); // Should be set only once. | 492 | 492 | heap_space_statistics_buffer_ = pointer; | 493 | 493 | } | 494 | 494 |
| @@ -497,7 +497,7 @@ inline char* Environment::http_parser_buffer() const { | 497 | 497 | } | 498 | 498 |
| 499 | 499 | inline void Environment::set_http_parser_buffer(char* buffer) { | 500 | | - CHECK_EQ(http_parser_buffer_, nullptr); // Should be set only once. | | 500 | + CHECK_NULL(http_parser_buffer_); // Should be set only once. | 501 | 501 | http_parser_buffer_ = buffer; | 502 | 502 | } | 503 | 503 |
| |
Collapse file Copy file name to clipboardExpand all lines: src/env.cc +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -80,7 +80,7 @@ IsolateData::~IsolateData() { | 80 | 80 | v8::CpuProfiler* IsolateData::GetCpuProfiler() { | 81 | 81 | if (cpu_profiler_ != nullptr) return cpu_profiler_; | 82 | 82 | cpu_profiler_ = v8::CpuProfiler::New(isolate()); | 83 | | - CHECK_NE(cpu_profiler_, nullptr); | | 83 | + CHECK_NOT_NULL(cpu_profiler_); | 84 | 84 | return cpu_profiler_; | 85 | 85 | } | 86 | 86 |
| |
Collapse file Copy file name to clipboardExpand all lines: src/fs_event_wrap.cc +4-4Lines changed: 4 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -88,7 +88,7 @@ FSEventWrap::~FSEventWrap() { | 88 | 88 |
| 89 | 89 | void FSEventWrap::GetInitialized(const FunctionCallbackInfo<Value>& args) { | 90 | 90 | FSEventWrap* wrap = Unwrap<FSEventWrap>(args.This()); | 91 | | - CHECK(wrap != nullptr); | | 91 | + CHECK_NOT_NULL(wrap); | 92 | 92 | args.GetReturnValue().Set(wrap->initialized_); | 93 | 93 | } | 94 | 94 |
| @@ -133,14 +133,14 @@ void FSEventWrap::Start(const FunctionCallbackInfo<Value>& args) { | 133 | 133 | Environment* env = Environment::GetCurrent(args); | 134 | 134 |
| 135 | 135 | FSEventWrap* wrap = Unwrap<FSEventWrap>(args.This()); | 136 | | - CHECK_NE(wrap, nullptr); | | 136 | + CHECK_NOT_NULL(wrap); | 137 | 137 | CHECK(!wrap->initialized_); | 138 | 138 |
| 139 | 139 | const int argc = args.Length(); | 140 | 140 | CHECK_GE(argc, 4); | 141 | 141 |
| 142 | 142 | BufferValue path(env->isolate(), args[0]); | 143 | | - CHECK_NE(*path, nullptr); | | 143 | + CHECK_NOT_NULL(*path); | 144 | 144 |
| 145 | 145 | unsigned int flags = 0; | 146 | 146 | if (args[2]->IsTrue()) | @@ -233,7 +233,7 @@ void FSEventWrap::OnEvent(uv_fs_event_t* handle, const char* filename, | 233 | 233 |
| 234 | 234 | void FSEventWrap::Close(const FunctionCallbackInfo<Value>& args) { | 235 | 235 | FSEventWrap* wrap = Unwrap<FSEventWrap>(args.Holder()); | 236 | | - CHECK_NE(wrap, nullptr); | | 236 | + CHECK_NOT_NULL(wrap); | 237 | 237 | CHECK(wrap->initialized_); | 238 | 238 |
| 239 | 239 | wrap->initialized_ = false; | |
Collapse file Copy file name to clipboardExpand all lines: src/inspector_agent.cc +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -317,7 +317,7 @@ class InspectorTimerHandle { | 317 | 317 | InspectorTimerHandle(const InspectorTimerHandle&) = delete; | 318 | 318 |
| 319 | 319 | ~InspectorTimerHandle() { | 320 | | - CHECK_NE(timer_, nullptr); | | 320 | + CHECK_NOT_NULL(timer_); | 321 | 321 | timer_->Stop(); | 322 | 322 | timer_ = nullptr; | 323 | 323 | } | @@ -562,7 +562,7 @@ bool Agent::StartIoThread(bool wait_for_connect) { | 562 | 562 | if (io_ != nullptr) | 563 | 563 | return true; | 564 | 564 |
| 565 | | - CHECK_NE(client_, nullptr); | | 565 | + CHECK_NOT_NULL(client_); | 566 | 566 |
| 567 | 567 | io_ = std::unique_ptr<InspectorIo>( | 568 | 568 | new InspectorIo(parent_env_, platform_, path_, debug_options_, | @@ -613,7 +613,7 @@ std::unique_ptr<InspectorSession> Agent::Connect( | 613 | 613 | } | 614 | 614 |
| 615 | 615 | void Agent::WaitForDisconnect() { | 616 | | - CHECK_NE(client_, nullptr); | | 616 | + CHECK_NOT_NULL(client_); | 617 | 617 | // TODO(addaleax): Maybe this should use an at-exit hook for the Environment | 618 | 618 | // or something similar? | 619 | 619 | client_->contextDestroyed(parent_env_->context()); | |
Collapse file Copy file name to clipboardExpand all lines: src/inspector_io.cc +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -34,7 +34,7 @@ std::string ScriptPath(uv_loop_t* loop, const std::string& script_name) { | 34 | 34 | uv_fs_t req; | 35 | 35 | req.ptr = nullptr; | 36 | 36 | if (0 == uv_fs_realpath(loop, &req, script_name.c_str(), nullptr)) { | 37 | | - CHECK_NE(req.ptr, nullptr); | | 37 | + CHECK_NOT_NULL(req.ptr); | 38 | 38 | script_path = std::string(static_cast<char*>(req.ptr)); | 39 | 39 | } | 40 | 40 | uv_fs_req_cleanup(&req); | |
Collapse file Copy file name to clipboardExpand all lines: src/inspector_socket.cc +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -599,7 +599,7 @@ class HttpHandler : public ProtocolHandler { | 599 | 599 | ProtocolHandler::ProtocolHandler(InspectorSocket* inspector, | 600 | 600 | TcpHolder::Pointer tcp) | 601 | 601 | : inspector_(inspector), tcp_(std::move(tcp)) { | 602 | | - CHECK_NE(nullptr, tcp_); | | 602 | + CHECK_NOT_NULL(tcp_); | 603 | 603 | tcp_->SetHandler(this); | 604 | 604 | } | 605 | 605 |
| |
Collapse file Copy file name to clipboardExpand all lines: src/js_stream.cc +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -104,7 +104,7 @@ int JSStream::DoWrite(WriteWrap* w, | 104 | 104 | uv_buf_t* bufs, | 105 | 105 | size_t count, | 106 | 106 | uv_stream_t* send_handle) { | 107 | | - CHECK_EQ(send_handle, nullptr); | | 107 | + CHECK_NULL(send_handle); | 108 | 108 |
| 109 | 109 | HandleScope scope(env()->isolate()); | 110 | 110 | Context::Scope context_scope(env()->context()); | |
Collapse file Copy file name to clipboardExpand all lines: src/module_wrap.cc +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -106,7 +106,7 @@ void ModuleWrap::New(const FunctionCallbackInfo<Value>& args) { | 106 | 106 | ContextifyContext* sandbox = | 107 | 107 | ContextifyContext::ContextFromContextifiedSandbox( | 108 | 108 | env, args[2].As<Object>()); | 109 | | - CHECK_NE(sandbox, nullptr); | | 109 | + CHECK_NOT_NULL(sandbox); | 110 | 110 | context = sandbox->context(); | 111 | 111 | } | 112 | 112 |
| |
|