mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
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>
This commit is contained in:
33 files changed
+124
-122
No files matched your search
@@ -266,7 +266,7 @@ namespace {
|
||||
void DecodeData(const FunctionCallbackInfo<Value>& args) {
|
||||
StringDecoder* decoder =
|
||||
reinterpret_cast<StringDecoder*>(Buffer::Data(args[0]));
|
||||
CHECK_NE(decoder, nullptr);
|
||||
CHECK_NOT_NULL(decoder);
|
||||
size_t nread = Buffer::Length(args[1]);
|
||||
MaybeLocal<String> ret =
|
||||
decoder->DecodeData(args.GetIsolate(), Buffer::Data(args[1]), &nread);
|
||||
@@ -277,7 +277,7 @@ void DecodeData(const FunctionCallbackInfo<Value>& args) {
|
||||
void FlushData(const FunctionCallbackInfo<Value>& args) {
|
||||
StringDecoder* decoder =
|
||||
reinterpret_cast<StringDecoder*>(Buffer::Data(args[0]));
|
||||
CHECK_NE(decoder, nullptr);
|
||||
CHECK_NOT_NULL(decoder);
|
||||
MaybeLocal<String> ret = decoder->FlushData(args.GetIsolate());
|
||||
if (!ret.IsEmpty())
|
||||
args.GetReturnValue().Set(ret.ToLocalChecked());
|
||||
|
||||
Reference in new issue
Block a user