mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
crypto: avoid std::function
Using a template type lets the compiler choose an appropriate type that likely is more efficient than std::function since the lambda expressions at the call sites do not capture any values from surrounding scopes. PR-URL: https://github.com/nodejs/node/pull/53683 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
This commit is contained in:
1 parent
e1b80a5fb3
commit
e6e6c916b5
1 file changed
+5
-6
@@ -75,12 +75,11 @@ void GetKeyFormatAndTypeFromJs(
|
||||
*offset += 2;
|
||||
}
|
||||
|
||||
ParseKeyResult TryParsePublicKey(
|
||||
EVPKeyPointer* pkey,
|
||||
const BIOPointer& bp,
|
||||
const char* name,
|
||||
// NOLINTNEXTLINE(runtime/int)
|
||||
const std::function<EVP_PKEY*(const unsigned char** p, long l)>& parse) {
|
||||
template <typename F>
|
||||
ParseKeyResult TryParsePublicKey(EVPKeyPointer* pkey,
|
||||
const BIOPointer& bp,
|
||||
const char* name,
|
||||
F&& parse) {
|
||||
unsigned char* der_data;
|
||||
long der_len; // NOLINT(runtime/int)
|
||||
|
||||
|
||||
Reference in new issue
Block a user