From 4df7266b7fcf29158ff3cbf889b1fef0b85fea78 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Sun, 27 Apr 2025 13:21:37 -0400 Subject: [PATCH] buffer: avoid creating unnecessary environment --- 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 3507f5e3e2943a..524156ec5daa0f 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -721,11 +721,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,