From 257be5a3f559dd97a6864ef6f092a324f2feaf9e Mon Sep 17 00:00:00 2001 From: gengjiawen Date: Wed, 20 Mar 2019 21:15:38 +0800 Subject: [PATCH 1/6] src: delete unreachable code in heap_utils.cc --- src/heap_utils.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/heap_utils.cc b/src/heap_utils.cc index 6690abc78d6c67..340960359d1475 100644 --- a/src/heap_utils.cc +++ b/src/heap_utils.cc @@ -280,7 +280,6 @@ class HeapSnapshotStream : public AsyncWrap, int DoShutdown(ShutdownWrap* req_wrap) override { UNREACHABLE(); - return 0; } int DoWrite(WriteWrap* w, @@ -288,7 +287,6 @@ class HeapSnapshotStream : public AsyncWrap, size_t count, uv_stream_t* send_handle) override { UNREACHABLE(); - return 0; } bool IsAlive() override { return snapshot_ != nullptr; } From 431363c79d8123093300db0f71d86fba6f3ab8f1 Mon Sep 17 00:00:00 2001 From: gengjiawen Date: Wed, 20 Mar 2019 21:16:47 +0800 Subject: [PATCH 2/6] src: tidy up include headers in env.cc --- src/env.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/env.cc b/src/env.cc index 768e14d796d5bf..697a03ae2a226f 100644 --- a/src/env.cc +++ b/src/env.cc @@ -8,7 +8,6 @@ #include "node_internals.h" #include "node_native_module.h" #include "node_options-inl.h" -#include "node_platform.h" #include "node_process.h" #include "node_v8_platform-inl.h" #include "node_worker.h" From 555cfe2f4528592310ca2b80e4fc06f34a863730 Mon Sep 17 00:00:00 2001 From: gengjiawen Date: Wed, 20 Mar 2019 21:18:01 +0800 Subject: [PATCH 3/6] src: delete unused field in class ModuleWrap --- src/module_wrap.h | 1 - 1 file changed, 1 deletion(-) diff --git a/src/module_wrap.h b/src/module_wrap.h index dc34685fedadbc..0fdd9b39abe296 100644 --- a/src/module_wrap.h +++ b/src/module_wrap.h @@ -36,7 +36,6 @@ v8::Maybe Resolve(Environment* env, class ModuleWrap : public BaseObject { public: - static const std::string EXTENSIONS[]; static void Initialize(v8::Local target, v8::Local unused, v8::Local context, From 9d724fd842865f23e3268d625b5b4d1ff1705f90 Mon Sep 17 00:00:00 2001 From: gengjiawen Date: Wed, 20 Mar 2019 21:21:30 +0800 Subject: [PATCH 4/6] src: use deleted function for class BaseObject --- src/base_object.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/base_object.h b/src/base_object.h index 090bb70aebeaf8..bc4c2aaf039547 100644 --- a/src/base_object.h +++ b/src/base_object.h @@ -40,6 +40,8 @@ class BaseObject : public MemoryRetainer { inline BaseObject(Environment* env, v8::Local object); inline ~BaseObject() override; + BaseObject() = delete; + // Returns the wrapped object. Returns an empty handle when // persistent.IsEmpty() is true. inline v8::Local object() const; @@ -74,8 +76,6 @@ class BaseObject : public MemoryRetainer { Environment* env); private: - BaseObject(); - v8::Local WrappedObject() const override; bool IsRootNode() const override; static void DeleteMe(void* data); From ba40403bd85410a9860b834bad3adac2e1f0aee4 Mon Sep 17 00:00:00 2001 From: gengjiawen Date: Wed, 20 Mar 2019 22:50:35 +0800 Subject: [PATCH 5/6] src: fix task release in cares_wrap.cc --- src/cares_wrap.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 12d712811dc28b..683d9c9728b7e8 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -307,7 +307,7 @@ node_ares_task* ares_task_create(ChannelWrap* channel, ares_socket_t sock) { if (uv_poll_init_socket(channel->env()->event_loop(), &task->poll_watcher, sock) < 0) { /* This should never happen. */ - free(task); + delete task; return nullptr; } From 3a885a8c9e07923647527022470cef8299f0f60c Mon Sep 17 00:00:00 2001 From: gengjiawen Date: Wed, 20 Mar 2019 22:54:11 +0800 Subject: [PATCH 6/6] src: delete useless code in cares_wrap.cc --- src/cares_wrap.cc | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index 683d9c9728b7e8..aeb525b33e7efa 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -296,11 +296,6 @@ void node_ares_task::MemoryInfo(MemoryTracker* tracker) const { node_ares_task* ares_task_create(ChannelWrap* channel, ares_socket_t sock) { auto task = new node_ares_task(); - if (task == nullptr) { - /* Out of memory. */ - return nullptr; - } - task->channel = channel; task->sock = sock;