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_pipe.cc | |
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_pipe.cc')
-rw-r--r-- | src/stream_pipe.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/stream_pipe.cc b/src/stream_pipe.cc index 617a0129cfe..bfe7d429725 100644 --- a/src/stream_pipe.cc +++ b/src/stream_pipe.cc @@ -19,8 +19,8 @@ StreamPipe::StreamPipe(StreamBase* source, : AsyncWrap(source->stream_env(), obj, AsyncWrap::PROVIDER_STREAMPIPE) { MakeWeak(); - CHECK_NE(sink, nullptr); - CHECK_NE(source, nullptr); + CHECK_NOT_NULL(sink); + CHECK_NOT_NULL(source); source->PushStreamListener(&readable_listener_); sink->PushStreamListener(&writable_listener_); @@ -120,7 +120,7 @@ void StreamPipe::ReadableListener::OnStreamRead(ssize_t nread, free(buf.base); pipe->is_eof_ = true; stream()->ReadStop(); - CHECK_NE(previous_listener_, nullptr); + CHECK_NOT_NULL(previous_listener_); previous_listener_->OnStreamRead(nread, uv_buf_init(nullptr, 0)); // If we’re not writing, close now. Otherwise, we’ll do that in // `OnStreamAfterWrite()`. @@ -164,7 +164,7 @@ void StreamPipe::WritableListener::OnStreamAfterWrite(WriteWrap* w, } if (status != 0) { - CHECK_NE(previous_listener_, nullptr); + CHECK_NOT_NULL(previous_listener_); StreamListener* prev = previous_listener_; pipe->Unpipe(); prev->OnStreamAfterWrite(w, status); @@ -175,7 +175,7 @@ void StreamPipe::WritableListener::OnStreamAfterWrite(WriteWrap* w, void StreamPipe::WritableListener::OnStreamAfterShutdown(ShutdownWrap* w, int status) { StreamPipe* pipe = ContainerOf(&StreamPipe::writable_listener_, this); - CHECK_NE(previous_listener_, nullptr); + CHECK_NOT_NULL(previous_listener_); StreamListener* prev = previous_listener_; pipe->Unpipe(); prev->OnStreamAfterShutdown(w, status); @@ -205,13 +205,13 @@ void StreamPipe::WritableListener::OnStreamWantsWrite(size_t suggested_size) { } uv_buf_t StreamPipe::WritableListener::OnStreamAlloc(size_t suggested_size) { - CHECK_NE(previous_listener_, nullptr); + CHECK_NOT_NULL(previous_listener_); return previous_listener_->OnStreamAlloc(suggested_size); } void StreamPipe::WritableListener::OnStreamRead(ssize_t nread, const uv_buf_t& buf) { - CHECK_NE(previous_listener_, nullptr); + CHECK_NOT_NULL(previous_listener_); return previous_listener_->OnStreamRead(nread, buf); } |