Skip to content

Commit

Permalink
src: replace autos in node_api.cc
Browse files Browse the repository at this point in the history
PR-URL: #38852
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
  • Loading branch information
XadillaX committed Jun 1, 2021
1 parent f52dc17 commit 46acbb0
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/node_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,8 @@ struct napi_async_cleanup_hook_handle__ {
}

static void Hook(void* data, void (*done_cb)(void*), void* done_data) {
auto handle = static_cast<napi_async_cleanup_hook_handle__*>(data);
napi_async_cleanup_hook_handle__* handle =
static_cast<napi_async_cleanup_hook_handle__*>(data);
handle->done_cb_ = done_cb;
handle->done_data_ = done_data;
handle->user_hook_(handle, handle->user_data_);
Expand Down Expand Up @@ -832,7 +833,7 @@ napi_status napi_async_init(napi_env env,
v8::Local<v8::String> v8_resource_name;
CHECK_TO_STRING(env, context, v8_resource_name, async_resource_name);

auto async_context =
v8impl::AsyncContext* async_context =
new v8impl::AsyncContext(reinterpret_cast<node_napi_env>(env),
v8_resource,
v8_resource_name,
Expand Down Expand Up @@ -888,7 +889,7 @@ napi_status napi_make_callback(napi_env env,
reinterpret_cast<v8::Local<v8::Value>*>(const_cast<napi_value*>(argv)),
{0, 0});
} else {
auto node_async_context =
v8impl::AsyncContext* node_async_context =
reinterpret_cast<v8impl::AsyncContext*>(async_context);
callback_result = node_async_context->MakeCallback(
v8recv,
Expand Down Expand Up @@ -917,7 +918,7 @@ napi_status napi_create_buffer(napi_env env,
NAPI_PREAMBLE(env);
CHECK_ARG(env, result);

auto maybe = node::Buffer::New(env->isolate, length);
v8::MaybeLocal<v8::Object> maybe = node::Buffer::New(env->isolate, length);

CHECK_MAYBE_EMPTY(env, maybe, napi_generic_failure);

Expand Down Expand Up @@ -948,11 +949,12 @@ napi_status napi_create_external_buffer(napi_env env,
env, finalize_cb, nullptr, finalize_hint,
v8impl::Finalizer::kKeepEnvReference);

auto maybe = node::Buffer::New(isolate,
static_cast<char*>(data),
length,
v8impl::BufferFinalizer::FinalizeBufferCallback,
finalizer);
v8::MaybeLocal<v8::Object> maybe = node::Buffer::New(
isolate,
static_cast<char*>(data),
length,
v8impl::BufferFinalizer::FinalizeBufferCallback,
finalizer);

CHECK_MAYBE_EMPTY(env, maybe, napi_generic_failure);

Expand All @@ -972,8 +974,9 @@ napi_status napi_create_buffer_copy(napi_env env,
NAPI_PREAMBLE(env);
CHECK_ARG(env, result);

auto maybe = node::Buffer::Copy(env->isolate,
static_cast<const char*>(data), length);
v8::MaybeLocal<v8::Object> maybe = node::Buffer::Copy(
env->isolate,
static_cast<const char*>(data), length);

CHECK_MAYBE_EMPTY(env, maybe, napi_generic_failure);

Expand Down

0 comments on commit 46acbb0

Please sign in to comment.