diff options
author | Tobias Nießen <tniessen@tnie.de> | 2018-05-20 18:44:06 +0300 |
---|---|---|
committer | Tobias Nießen <tniessen@tnie.de> | 2018-05-26 13:29:31 +0300 |
commit | 39f209649fc290fe92cc3b87edfffa6a854ecb03 (patch) | |
tree | e7c7c595355c3ce1dbd59d89070a7427572d256f /src/stream_base-inl.h | |
parent | 13493e99bfd208bc6e5381a918384049384cc2ed (diff) |
src: add CHECK_NULL/CHECK_NOT_NULL macros
This change introduces CHECK_NULL and CHECK_NOT_NULL macros
similar to their definition in v8 and replaces instances of
CHECK/CHECK_EQ/CHECK_NE with these where it seems appropriate.
PR-URL: https://github.com/nodejs/node/pull/20914
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'src/stream_base-inl.h')
-rw-r--r-- | src/stream_base-inl.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/stream_base-inl.h b/src/stream_base-inl.h index b1e820b09f7..4509825a60d 100644 --- a/src/stream_base-inl.h +++ b/src/stream_base-inl.h @@ -51,17 +51,17 @@ inline StreamListener::~StreamListener() { } inline void StreamListener::PassReadErrorToPreviousListener(ssize_t nread) { - CHECK_NE(previous_listener_, nullptr); + CHECK_NOT_NULL(previous_listener_); previous_listener_->OnStreamRead(nread, uv_buf_init(nullptr, 0)); } inline void StreamListener::OnStreamAfterShutdown(ShutdownWrap* w, int status) { - CHECK_NE(previous_listener_, nullptr); + CHECK_NOT_NULL(previous_listener_); previous_listener_->OnStreamAfterShutdown(w, status); } inline void StreamListener::OnStreamAfterWrite(WriteWrap* w, int status) { - CHECK_NE(previous_listener_, nullptr); + CHECK_NOT_NULL(previous_listener_); previous_listener_->OnStreamAfterWrite(w, status); } @@ -79,8 +79,8 @@ inline StreamResource::~StreamResource() { } inline void StreamResource::PushStreamListener(StreamListener* listener) { - CHECK_NE(listener, nullptr); - CHECK_EQ(listener->stream_, nullptr); + CHECK_NOT_NULL(listener); + CHECK_NULL(listener->stream_); listener->previous_listener_ = listener_; listener->stream_ = this; @@ -89,7 +89,7 @@ inline void StreamResource::PushStreamListener(StreamListener* listener) { } inline void StreamResource::RemoveStreamListener(StreamListener* listener) { - CHECK_NE(listener, nullptr); + CHECK_NOT_NULL(listener); StreamListener* previous; StreamListener* current; @@ -98,7 +98,7 @@ inline void StreamResource::RemoveStreamListener(StreamListener* listener) { for (current = listener_, previous = nullptr; /* No loop condition because we want a crash if listener is not found */ ; previous = current, current = current->previous_listener_) { - CHECK_NE(current, nullptr); + CHECK_NOT_NULL(current); if (current == listener) { if (previous != nullptr) previous->previous_listener_ = current->previous_listener_; @@ -415,7 +415,7 @@ inline void ShutdownWrap::OnDone(int status) { } inline void WriteWrap::SetAllocatedStorage(char* data, size_t size) { - CHECK_EQ(storage_, nullptr); + CHECK_NULL(storage_); storage_ = data; storage_size_ = size; } |