Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2020-03-13 11:44:53 +0300
committerAnna Henningsen <anna@addaleax.net>2020-03-20 16:20:12 +0300
commitc0115424849e4bf193efd2341b6cc017e70971c8 (patch)
tree88a6aac757ccb2f37813270ad257f5c5f8b18b93 /src/node_native_module.cc
parentf7771fffd012d32dcdeba1405e207934618a3fa7 (diff)
src: prefer OnScopeLeave over shared_ptr<void>
They do the same thing, but OnScopeLeave avoids an extra heap allocation and is more explicit about what it does. PR-URL: https://github.com/nodejs/node/pull/32247 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Matheus Marchini <mat@mmarchini.me>
Diffstat (limited to 'src/node_native_module.cc')
-rw-r--r--src/node_native_module.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/node_native_module.cc b/src/node_native_module.cc
index 680c585d0fb..1b916d645d8 100644
--- a/src/node_native_module.cc
+++ b/src/node_native_module.cc
@@ -202,7 +202,7 @@ MaybeLocal<String> NativeModuleLoader::LoadBuiltinModuleSource(Isolate* isolate,
CHECK_GE(req.result, 0);
uv_fs_req_cleanup(&req);
- std::shared_ptr<void> defer_close(nullptr, [file](...) {
+ auto defer_close = OnScopeLeave([file]() {
uv_fs_t close_req;
CHECK_EQ(0, uv_fs_close(nullptr, &close_req, file, nullptr));
uv_fs_req_cleanup(&close_req);