summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArtem Maksimov <temamaksimov@gmail.com>2019-11-06 15:35:21 +0300
committerRich Trott <rtrott@gmail.com>2019-11-08 04:44:12 -0800
commit632caddf2ca9b9c9c3a9834482fd25395e12075f (patch)
treeb89646ed4ba2865d147933c8937a974c9e8e4120 /src
parent55f4db183f7cf1fdd64b4ab1da138548265e419e (diff)
downloadandroid-node-v8-632caddf2ca9b9c9c3a9834482fd25395e12075f.tar.gz
android-node-v8-632caddf2ca9b9c9c3a9834482fd25395e12075f.tar.bz2
android-node-v8-632caddf2ca9b9c9c3a9834482fd25395e12075f.zip
tls: refactor tls_wrap.cc
Store the result of excetuting the function in variable. Instead of excetuting it for multiple times. PR-URL: https://github.com/nodejs/node/pull/30303 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'src')
-rw-r--r--src/tls_wrap.cc9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/tls_wrap.cc b/src/tls_wrap.cc
index 2d36c1a265..42b9469e38 100644
--- a/src/tls_wrap.cc
+++ b/src/tls_wrap.cc
@@ -1141,12 +1141,11 @@ void TLSWrap::Initialize(Local<Object> target,
env->SetProtoMethod(t, "getServername", GetServername);
env->SetProtoMethod(t, "setServername", SetServername);
- env->set_tls_wrap_constructor_function(
- t->GetFunction(env->context()).ToLocalChecked());
+ Local<Function> fn = t->GetFunction(env->context()).ToLocalChecked();
- target->Set(env->context(),
- tlsWrapString,
- t->GetFunction(env->context()).ToLocalChecked()).Check();
+ env->set_tls_wrap_constructor_function(fn);
+
+ target->Set(env->context(), tlsWrapString, fn).Check();
}
} // namespace node