From 7d77068c786d81fa43b6b6d80ac97e1bd53be4c8 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Tue, 22 May 2018 01:09:47 +0200 Subject: [PATCH] src: move DeleteFnPtr into util.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is more generally useful than just in a crypto context. PR-URL: https://github.com/nodejs/node/pull/20885 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Michaël Zasso Reviewed-By: Joyee Cheung Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Tobias Nießen --- src/node_crypto.h | 9 --------- src/util.h | 9 +++++++++ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/node_crypto.h b/src/node_crypto.h index ee933ede1f83fb..06b76b42ff5cdf 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h @@ -75,15 +75,6 @@ struct MarkPopErrorOnReturn { ~MarkPopErrorOnReturn() { ERR_pop_to_mark(); } }; -template -struct FunctionDeleter { - void operator()(T* pointer) const { function(pointer); } - typedef std::unique_ptr Pointer; -}; - -template -using DeleteFnPtr = typename FunctionDeleter::Pointer; - // Define smart pointers for the most commonly used OpenSSL types: using X509Pointer = DeleteFnPtr; using BIOPointer = DeleteFnPtr; diff --git a/src/util.h b/src/util.h index 0e6fd5dd067c73..26654f15a1a626 100644 --- a/src/util.h +++ b/src/util.h @@ -456,6 +456,15 @@ struct is_callable::value >::type> : std::true_type { }; +template +struct FunctionDeleter { + void operator()(T* pointer) const { function(pointer); } + typedef std::unique_ptr Pointer; +}; + +template +using DeleteFnPtr = typename FunctionDeleter::Pointer; + } // namespace node #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS