src: use String::WriteV2() in TwoByteValue
Since `String::Write()` is deprecated, use `String::WriteV2()` instead. PR-URL: https://github.com/nodejs/node/pull/58164 Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
e46fb17ecb
commit
8debf0bddc
10
src/util.cc
10
src/util.cc
@ -146,12 +146,10 @@ TwoByteValue::TwoByteValue(Isolate* isolate, Local<Value> value) {
|
||||
Local<String> string;
|
||||
if (!value->ToString(isolate->GetCurrentContext()).ToLocal(&string)) return;
|
||||
|
||||
// Allocate enough space to include the null terminator
|
||||
const size_t storage = string->Length() + 1;
|
||||
AllocateSufficientStorage(storage);
|
||||
|
||||
const int flags = String::NO_NULL_TERMINATION;
|
||||
const int length = string->Write(isolate, out(), 0, storage, flags);
|
||||
// Allocate enough space to include the null terminator.
|
||||
const size_t length = string->Length();
|
||||
AllocateSufficientStorage(length + 1);
|
||||
string->WriteV2(isolate, 0, length, out());
|
||||
SetLengthAndZeroTerminate(length);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user