Skip to content

Commit 7d899eb

Browse files
committed
Respond to review feedback
1 parent 8f34553 commit 7d899eb

File tree

8 files changed

+24
-21
lines changed

8 files changed

+24
-21
lines changed

src/node_api.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class napi_env__ {
8686
auto str_maybe = v8::String::NewFromUtf8( \
8787
(env)->isolate, (str), v8::NewStringType::kInternalized, (len)); \
8888
CHECK_MAYBE_EMPTY((env), str_maybe, napi_generic_failure); \
89-
result = str_maybe.ToLocalChecked(); \
89+
(result) = str_maybe.ToLocalChecked(); \
9090
} while (0)
9191

9292
#define CHECK_NEW_FROM_UTF8(env, result, str) \
@@ -187,7 +187,7 @@ v8::Local<v8::Value> V8LocalValueFromJsValue(napi_value v) {
187187
return local;
188188
}
189189

190-
napi_status V8NameFromPropertyDescriptor(napi_env env,
190+
static inline napi_status V8NameFromPropertyDescriptor(napi_env env,
191191
const napi_property_descriptor* p,
192192
v8::Local<v8::Name>* result) {
193193
if (p->utf8name != nullptr) {
@@ -814,14 +814,14 @@ napi_status napi_define_class(napi_env env,
814814

815815
v8::Local<v8::Name> property_name;
816816
napi_status status =
817-
v8impl::V8NameFromPropertyDescriptor(env, p, &property_name);
817+
v8impl::V8NameFromPropertyDescriptor(env, p, &property_name);
818818

819819
if (status != napi_ok) {
820820
return napi_set_last_error(env, status);
821821
}
822822

823823
v8::PropertyAttribute attributes =
824-
v8impl::V8PropertyAttributesFromDescriptor(p);
824+
v8impl::V8PropertyAttributesFromDescriptor(p);
825825

826826
// This code is similar to that in napi_define_properties(); the
827827
// difference is it applies to a template instead of an object.
@@ -838,7 +838,7 @@ napi_status napi_define_class(napi_env env,
838838
attributes);
839839
} else if (p->method != nullptr) {
840840
v8::Local<v8::Object> cbdata =
841-
v8impl::CreateFunctionCallbackData(env, p->method, p->data);
841+
v8impl::CreateFunctionCallbackData(env, p->method, p->data);
842842

843843
RETURN_STATUS_IF_FALSE(env, !cbdata.IsEmpty(), napi_generic_failure);
844844

@@ -1116,14 +1116,14 @@ napi_status napi_define_properties(napi_env env,
11161116

11171117
v8::Local<v8::Name> property_name;
11181118
napi_status status =
1119-
v8impl::V8NameFromPropertyDescriptor(env, p, &property_name);
1119+
v8impl::V8NameFromPropertyDescriptor(env, p, &property_name);
11201120

11211121
if (status != napi_ok) {
11221122
return napi_set_last_error(env, status);
11231123
}
11241124

11251125
v8::PropertyAttribute attributes =
1126-
v8impl::V8PropertyAttributesFromDescriptor(p);
1126+
v8impl::V8PropertyAttributesFromDescriptor(p);
11271127

11281128
if (p->getter != nullptr || p->setter != nullptr) {
11291129
v8::Local<v8::Object> cbdata = v8impl::CreateAccessorCallbackData(

test/addons-napi/6_object_wrap/myobject.cc

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ napi_value MyObject::New(napi_env env, napi_callback_info info) {
3838
size_t argc = 1;
3939
napi_value args[1];
4040
napi_value _this;
41-
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, &_this, NULL));
41+
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, &_this, nullptr));
4242

4343
if (is_constructor) {
4444
// Invoked as constructor: `new MyObject(...)`
@@ -79,7 +79,8 @@ napi_value MyObject::New(napi_env env, napi_callback_info info) {
7979

8080
napi_value MyObject::GetValue(napi_env env, napi_callback_info info) {
8181
napi_value _this;
82-
NAPI_CALL(env, napi_get_cb_info(env, info, NULL, NULL, &_this, NULL));
82+
NAPI_CALL(env,
83+
napi_get_cb_info(env, info, nullptr, nullptr, &_this, nullptr));
8384

8485
MyObject* obj;
8586
NAPI_CALL(env, napi_unwrap(env, _this, reinterpret_cast<void**>(&obj)));
@@ -94,19 +95,20 @@ napi_value MyObject::SetValue(napi_env env, napi_callback_info info) {
9495
size_t argc = 1;
9596
napi_value args[1];
9697
napi_value _this;
97-
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, &_this, NULL));
98+
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, &_this, nullptr));
9899

99100
MyObject* obj;
100101
NAPI_CALL(env, napi_unwrap(env, _this, reinterpret_cast<void**>(&obj)));
101102

102103
NAPI_CALL(env, napi_get_value_double(env, args[0], &obj->value_));
103104

104-
return NULL;
105+
return nullptr;
105106
}
106107

107108
napi_value MyObject::PlusOne(napi_env env, napi_callback_info info) {
108109
napi_value _this;
109-
NAPI_CALL(env, napi_get_cb_info(env, info, NULL, NULL, &_this, NULL));
110+
NAPI_CALL(env,
111+
napi_get_cb_info(env, info, nullptr, nullptr, &_this, nullptr));
110112

111113
MyObject* obj;
112114
NAPI_CALL(env, napi_unwrap(env, _this, reinterpret_cast<void**>(&obj)));
@@ -123,7 +125,7 @@ napi_value MyObject::Multiply(napi_env env, napi_callback_info info) {
123125
size_t argc = 1;
124126
napi_value args[1];
125127
napi_value _this;
126-
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, &_this, NULL));
128+
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, &_this, nullptr));
127129

128130
double multiple = 1;
129131
if (argc >= 1) {

test/addons-napi/7_factory_wrap/binding.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
napi_value CreateObject(napi_env env, napi_callback_info info) {
55
size_t argc = 1;
66
napi_value args[1];
7-
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL));
7+
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, nullptr, nullptr));
88

99
napi_value instance;
1010
NAPI_CALL(env, MyObject::NewInstance(env, args[0], &instance));

test/addons-napi/7_factory_wrap/myobject.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ napi_value MyObject::New(napi_env env, napi_callback_info info) {
3535
size_t argc = 1;
3636
napi_value args[1];
3737
napi_value _this;
38-
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, &_this, NULL));
38+
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, &_this, nullptr));
3939

4040
napi_valuetype valuetype;
4141
NAPI_CALL(env, napi_typeof(env, args[0], &valuetype));
@@ -79,7 +79,8 @@ napi_status MyObject::NewInstance(napi_env env,
7979

8080
napi_value MyObject::PlusOne(napi_env env, napi_callback_info info) {
8181
napi_value _this;
82-
NAPI_CALL(env, napi_get_cb_info(env, info, NULL, NULL, &_this, NULL));
82+
NAPI_CALL(env,
83+
napi_get_cb_info(env, info, nullptr, nullptr, &_this, nullptr));
8384

8485
MyObject* obj;
8586
NAPI_CALL(env, napi_unwrap(env, _this, reinterpret_cast<void**>(&obj)));

test/addons-napi/8_passing_wrapped/binding.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
napi_value CreateObject(napi_env env, napi_callback_info info) {
55
size_t argc = 1;
66
napi_value args[1];
7-
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL));
7+
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, nullptr, nullptr));
88

99
napi_value instance;
1010
NAPI_CALL(env, MyObject::NewInstance(env, args[0], &instance));
@@ -15,7 +15,7 @@ napi_value CreateObject(napi_env env, napi_callback_info info) {
1515
napi_value Add(napi_env env, napi_callback_info info) {
1616
size_t argc = 2;
1717
napi_value args[2];
18-
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL));
18+
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, nullptr, nullptr));
1919

2020
MyObject* obj1;
2121
NAPI_CALL(env, napi_unwrap(env, args[0], reinterpret_cast<void**>(&obj1)));

test/addons-napi/8_passing_wrapped/myobject.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ napi_value MyObject::New(napi_env env, napi_callback_info info) {
3030
size_t argc = 1;
3131
napi_value args[1];
3232
napi_value _this;
33-
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, &_this, NULL));
33+
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, &_this, nullptr));
3434

3535
MyObject* obj = new MyObject();
3636

test/addons-napi/test_error/test_error.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
napi_value checkError(napi_env env, napi_callback_info info) {
55
size_t argc = 1;
66
napi_value args[1];
7-
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL));
7+
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, nullptr, nullptr));
88

99
bool r;
1010
NAPI_CALL(env, napi_is_error(env, args[0], &r));

test/addons-napi/test_napi_status/test_napi_status.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ napi_value createNapiError(napi_env env, napi_callback_info info) {
1010

1111
NAPI_ASSERT(env, status != napi_ok, "Failed to produce error condition");
1212

13-
return NULL;
13+
return nullptr;
1414
}
1515

1616
napi_value testNapiErrorCleanup(napi_env env, napi_callback_info info) {

0 commit comments

Comments
 (0)