diff options
author | James M Snell <jasnell@gmail.com> | 2017-08-19 07:58:25 +0300 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2017-08-23 20:35:19 +0300 |
commit | 771a03dfe3dba6ac3136bd4aa25525220e29b0ff (patch) | |
tree | 9276a1e18c07fcead1ce87a384a7a47e42f00d79 /src/signal_wrap.cc | |
parent | 0ce54a7ec96431a088a15a5e24614428184497f0 (diff) |
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/signal_wrap.cc')
-rw-r--r-- | src/signal_wrap.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/signal_wrap.cc b/src/signal_wrap.cc index 1af98a9311f..eed010b388d 100644 --- a/src/signal_wrap.cc +++ b/src/signal_wrap.cc @@ -37,6 +37,7 @@ using v8::HandleScope; using v8::Integer; using v8::Local; using v8::Object; +using v8::String; using v8::Value; namespace { @@ -49,7 +50,9 @@ class SignalWrap : public HandleWrap { Environment* env = Environment::GetCurrent(context); Local<FunctionTemplate> constructor = env->NewFunctionTemplate(New); constructor->InstanceTemplate()->SetInternalFieldCount(1); - constructor->SetClassName(FIXED_ONE_BYTE_STRING(env->isolate(), "Signal")); + Local<String> signalString = + FIXED_ONE_BYTE_STRING(env->isolate(), "Signal"); + constructor->SetClassName(signalString); env->SetProtoMethod(constructor, "getAsyncId", AsyncWrap::GetAsyncId); env->SetProtoMethod(constructor, "close", HandleWrap::Close); @@ -59,8 +62,7 @@ class SignalWrap : public HandleWrap { env->SetProtoMethod(constructor, "start", Start); env->SetProtoMethod(constructor, "stop", Stop); - target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "Signal"), - constructor->GetFunction()); + target->Set(signalString, constructor->GetFunction()); } size_t self_size() const override { return sizeof(*this); } |