benchmark: use non-deprecated WriteUtf8V2 method

PR-URL: https://github.com/nodejs/node/pull/60173
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
Reviewed-By: Richard Lau <richard.lau@ibm.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Michaël Zasso
2025-10-11 09:57:05 +02:00
committed by GitHub
parent bab752d4db
commit 2e675c4fa3

View File

@@ -23,7 +23,8 @@ void CallWithString(const FunctionCallbackInfo<Value>& args) {
Local<String> str = args[0].As<String>();
const size_t length = str->Utf8LengthV2(args.GetIsolate()) + 1;
char* buf = new char[length];
str->WriteUtf8(args.GetIsolate(), buf, length);
str->WriteUtf8V2(
args.GetIsolate(), buf, length, String::WriteFlags::kNullTerminate);
delete[] buf;
}
}