summaryrefslogtreecommitdiff
path: root/src/tty_wrap.cc
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2017-08-18 21:58:25 -0700
committerJames M Snell <jasnell@gmail.com>2017-08-23 10:35:19 -0700
commit771a03dfe3dba6ac3136bd4aa25525220e29b0ff (patch)
tree9276a1e18c07fcead1ce87a384a7a47e42f00d79 /src/tty_wrap.cc
parent0ce54a7ec96431a088a15a5e24614428184497f0 (diff)
downloadandroid-node-v8-771a03dfe3dba6ac3136bd4aa25525220e29b0ff.tar.gz
android-node-v8-771a03dfe3dba6ac3136bd4aa25525220e29b0ff.tar.bz2
android-node-v8-771a03dfe3dba6ac3136bd4aa25525220e29b0ff.zip
src: fixup strings, reduce duplication
PR-URL: https://github.com/nodejs/node/pull/14937 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/tty_wrap.cc')
-rw-r--r--src/tty_wrap.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/tty_wrap.cc b/src/tty_wrap.cc
index f3f1edfe5d..88e9a98264 100644
--- a/src/tty_wrap.cc
+++ b/src/tty_wrap.cc
@@ -41,6 +41,7 @@ using v8::FunctionTemplate;
using v8::Integer;
using v8::Local;
using v8::Object;
+using v8::String;
using v8::Value;
@@ -49,8 +50,10 @@ void TTYWrap::Initialize(Local<Object> target,
Local<Context> context) {
Environment* env = Environment::GetCurrent(context);
+ Local<String> ttyString = FIXED_ONE_BYTE_STRING(env->isolate(), "TTY");
+
Local<FunctionTemplate> t = env->NewFunctionTemplate(New);
- t->SetClassName(FIXED_ONE_BYTE_STRING(env->isolate(), "TTY"));
+ t->SetClassName(ttyString);
t->InstanceTemplate()->SetInternalFieldCount(1);
env->SetProtoMethod(t, "getAsyncId", AsyncWrap::GetAsyncId);
@@ -68,7 +71,7 @@ void TTYWrap::Initialize(Local<Object> target,
env->SetMethod(target, "isTTY", IsTTY);
env->SetMethod(target, "guessHandleType", GuessHandleType);
- target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "TTY"), t->GetFunction());
+ target->Set(ttyString, t->GetFunction());
env->set_tty_constructor_template(t);
}