mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -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
+5
-5
@@ -1964,7 +1964,7 @@ static void DLOpen(const FunctionCallbackInfo<Value>& args) {
|
||||
Environment* env = Environment::GetCurrent(args);
|
||||
auto context = env->context();
|
||||
|
||||
CHECK_EQ(modpending, nullptr);
|
||||
CHECK_NULL(modpending);
|
||||
|
||||
if (args.Length() < 2) {
|
||||
env->ThrowError("process.dlopen needs at least 2 arguments.");
|
||||
@@ -2231,8 +2231,8 @@ static Local<Object> InitModule(Environment* env,
|
||||
Local<String> module) {
|
||||
Local<Object> exports = Object::New(env->isolate());
|
||||
// Internal bindings don't have a "module" object, only exports.
|
||||
CHECK_EQ(mod->nm_register_func, nullptr);
|
||||
CHECK_NE(mod->nm_context_register_func, nullptr);
|
||||
CHECK_NULL(mod->nm_register_func);
|
||||
CHECK_NOT_NULL(mod->nm_context_register_func);
|
||||
Local<Value> unused = Undefined(env->isolate());
|
||||
mod->nm_context_register_func(exports,
|
||||
unused,
|
||||
@@ -4075,7 +4075,7 @@ void AtExit(void (*cb)(void* arg), void* arg) {
|
||||
|
||||
|
||||
void AtExit(Environment* env, void (*cb)(void* arg), void* arg) {
|
||||
CHECK_NE(env, nullptr);
|
||||
CHECK_NOT_NULL(env);
|
||||
env->AtExit(cb, arg);
|
||||
}
|
||||
|
||||
@@ -4336,7 +4336,7 @@ inline int Start(uv_loop_t* event_loop,
|
||||
|
||||
{
|
||||
Mutex::ScopedLock scoped_lock(node_isolate_mutex);
|
||||
CHECK_EQ(node_isolate, nullptr);
|
||||
CHECK_NULL(node_isolate);
|
||||
node_isolate = isolate;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user