From 6072e01c938e22498cd46c3d8a2c21a16a632456 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 26 Oct 2019 18:29:46 +0200 Subject: 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 Reviewed-By: Colin Ihrig Reviewed-By: David Carlier Reviewed-By: Franziska Hinkelmann Reviewed-By: James M Snell --- src/node_i18n.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/node_i18n.cc') diff --git a/src/node_i18n.cc b/src/node_i18n.cc index ecc0528e76..c68e01e107 100644 --- a/src/node_i18n.cc +++ b/src/node_i18n.cc @@ -217,7 +217,7 @@ class ConverterObject : public BaseObject, Converter { result.AllocateSufficientStorage(limit); UBool flush = (flags & CONVERTER_FLAGS_FLUSH) == CONVERTER_FLAGS_FLUSH; - OnScopeLeave cleanup([&]() { + auto cleanup = OnScopeLeave([&]() { if (flush) { // Reset the converter state. converter->bomSeen_ = false; -- cgit v1.2.3