From e7e8256d35fdbfb76d0acc972aba77b67ede43f8 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Tue, 29 Apr 2025 13:24:42 -0400 Subject: [PATCH] buffer: avoid creating unnecessary environment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/58053 Reviewed-By: Juan José Arboleda Reviewed-By: James M Snell Reviewed-By: Robert Nagy Reviewed-By: Chengzhong Wu Reviewed-By: Marco Ippolito --- src/node_buffer.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node_buffer.cc b/src/node_buffer.cc index 912b7d11d01..7cfb2a0c2fa 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -736,11 +736,11 @@ void StringWrite(const FunctionCallbackInfo& args) { } void SlowByteLengthUtf8(const FunctionCallbackInfo& args) { - Environment* env = Environment::GetCurrent(args); CHECK(args[0]->IsString()); // Fast case: avoid StringBytes on UTF8 string. Jump to v8. - args.GetReturnValue().Set(args[0].As()->Utf8Length(env->isolate())); + args.GetReturnValue().Set( + args[0].As()->Utf8Length(args.GetIsolate())); } uint32_t FastByteLengthUtf8(Local receiver,