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>2019-10-26 19:29:46 +0300
committerMyles Borins <mylesborins@google.com>2019-11-17 10:59:10 +0300
commit058a8d53631df7aba5fbbff8859ebc8e88fade49 (patch)
tree62e675c12684a8c4f09b68ea26fa8a45baab2330 /src/node_http_parser.cc
parent31a3b724f0ec4d246f6bf2538e2c401af8dc1552 (diff)
src: do not use `std::function` for `OnScopeLeave`
Using `std::function` adds an extra layer of indirection, and in particular, heap allocations that are not necessary in our use case here. PR-URL: https://github.com/nodejs/node/pull/30134 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_http_parser.cc')
-rw-r--r--src/node_http_parser.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/node_http_parser.cc b/src/node_http_parser.cc
index bfc1582b468..c6136702c7c 100644
--- a/src/node_http_parser.cc
+++ b/src/node_http_parser.cc
@@ -586,7 +586,7 @@ class Parser : public AsyncWrap, public StreamListener {
// Once we’re done here, either indicate that the HTTP parser buffer
// is free for re-use, or free() the data if it didn’t come from there
// in the first place.
- OnScopeLeave on_scope_leave([&]() {
+ auto on_scope_leave = OnScopeLeave([&]() {
if (buf.base == env()->http_parser_buffer())
env()->set_http_parser_buffer_in_use(false);
else