From eb4a606f62895e6ddfe537842cb8219a65dbf35c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20Nie=C3=9Fen?= Date: Sun, 4 May 2025 16:32:30 +0100 Subject: [PATCH] src: use String::WriteV2() in TwoByteValue Since `String::Write()` is deprecated, use `String::WriteV2()` instead. --- src/util.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/util.cc b/src/util.cc index 1512f262fd99c7..78326b56eab457 100644 --- a/src/util.cc +++ b/src/util.cc @@ -146,12 +146,10 @@ TwoByteValue::TwoByteValue(Isolate* isolate, Local value) { Local 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); }