Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4cf7dcf

Browse filesBrowse files
shigekiMylesBorins
authored andcommitted
crypto: remove unnecessary variables of alpn/npn
The Local variables of `npn_buffer` and `alpn_buffer` are not necessary to be created from `args[0]`. Remove and fold them into the subsequent call. PR-URL: #10831 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
1 parent a67ada7 commit 4cf7dcf
Copy full SHA for 4cf7dcf

File tree

Expand file treeCollapse file tree

1 file changed

+4
-5
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-5
lines changed
Open diff view settings
Collapse file

‎src/node_crypto.cc‎

Copy file name to clipboardExpand all lines: src/node_crypto.cc
+4-5Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2073,8 +2073,8 @@ void SSLWrap<Base>::SetNPNProtocols(const FunctionCallbackInfo<Value>& args) {
20732073
if (args.Length() < 1 || !Buffer::HasInstance(args[0]))
20742074
return env->ThrowTypeError("Must give a Buffer as first argument");
20752075

2076-
Local<Value> npn_buffer = Local<Value>::New(env->isolate(), args[0]);
2077-
bool r = w->object()->SetHiddenValue(env->npn_buffer_string(), npn_buffer);
2076+
bool r = w->object()->SetHiddenValue(env->npn_buffer_string(), args[0]);
2077+
20782078
CHECK(r);
20792079
}
20802080
#endif // OPENSSL_NPN_NEGOTIATED
@@ -2156,9 +2156,8 @@ void SSLWrap<Base>::SetALPNProtocols(
21562156
int r = SSL_set_alpn_protos(w->ssl_, alpn_protos, alpn_protos_len);
21572157
CHECK_EQ(r, 0);
21582158
} else {
2159-
Local<Value> alpn_buffer = Local<Value>::New(env->isolate(), args[0]);
2160-
bool ret = w->object()->SetHiddenValue(env->alpn_buffer_string(),
2161-
alpn_buffer);
2159+
bool ret = w->object()->SetHiddenValue(env->alpn_buffer_string(), args[0]);
2160+
21622161
CHECK(ret);
21632162
// Server should select ALPN protocol from list of advertised by client
21642163
SSL_CTX_set_alpn_select_cb(w->ssl_->ctx, SelectALPNCallback, nullptr);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.