mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
buffer: cache Environment::GetCurrent to avoid repeated calls
PR-URL: https://github.com/nodejs/node/pull/59043 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: theanarkh <theratliter@gmail.com> Reviewed-By: Dario Piotrowicz <dario.piotrowicz@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
This commit is contained in:
parent
3a9aca91c6
commit
8615ea6db0
1 changed files with 3 additions and 2 deletions
|
@ -1046,8 +1046,9 @@ void IndexOfBuffer(const FunctionCallbackInfo<Value>& args) {
|
|||
|
||||
enum encoding enc = static_cast<enum encoding>(args[3].As<Int32>()->Value());
|
||||
|
||||
THROW_AND_RETURN_UNLESS_BUFFER(Environment::GetCurrent(args), args[0]);
|
||||
THROW_AND_RETURN_UNLESS_BUFFER(Environment::GetCurrent(args), args[1]);
|
||||
Environment* env = Environment::GetCurrent(args);
|
||||
THROW_AND_RETURN_UNLESS_BUFFER(env, args[0]);
|
||||
THROW_AND_RETURN_UNLESS_BUFFER(env, args[1]);
|
||||
ArrayBufferViewContents<char> haystack_contents(args[0]);
|
||||
ArrayBufferViewContents<char> needle_contents(args[1]);
|
||||
int64_t offset_i64 = args[2].As<Integer>()->Value();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue