From b239591ed8ddbfb073aa522dd68b2e25f805dc05 Mon Sep 17 00:00:00 2001 From: Gabriel Schulhof Date: Mon, 23 Apr 2018 22:20:47 -0400 Subject: [PATCH] n-api,test: make methods static PR-URL: https://github.com/nodejs/node/pull/20243 Reviewed-By: Colin Ihrig Reviewed-By: Trivikram Kamat --- test/addons-napi/1_hello_world/binding.c | 2 +- .../2_function_arguments/binding.c | 4 +-- test/addons-napi/3_callbacks/binding.c | 6 ++-- test/addons-napi/4_object_factory/binding.c | 4 +-- test/addons-napi/5_function_factory/binding.c | 6 ++-- test/addons-napi/test_array/test_array.c | 12 +++---- test/addons-napi/test_buffer/test_buffer.c | 16 ++++----- .../test_constructor/test_constructor.c | 12 +++---- .../test_constructor/test_constructor_name.c | 4 +-- .../test_conversions/test_conversions.c | 22 ++++++------ .../addons-napi/test_dataview/test_dataview.c | 6 ++-- .../test_env_sharing/compare_env.c | 4 +-- test/addons-napi/test_env_sharing/store_env.c | 2 +- test/addons-napi/test_fatal/test_fatal.c | 6 ++-- .../test_fatal_exception.c | 4 +-- .../addons-napi/test_function/test_function.c | 6 ++-- test/addons-napi/test_general/test_general.c | 36 +++++++++---------- .../test_handle_scope/test_handle_scope.c | 10 +++--- test/addons-napi/test_make_callback/binding.c | 3 +- test/addons-napi/test_new_target/binding.c | 8 ++--- test/addons-napi/test_number/test_number.c | 8 ++--- test/addons-napi/test_object/test_object.c | 20 +++++------ test/addons-napi/test_promise/test_promise.c | 9 ++--- .../test_properties/test_properties.c | 10 +++--- .../test_reference/test_reference.c | 21 +++++------ test/addons-napi/test_string/test_string.c | 21 +++++------ test/addons-napi/test_symbol/test_symbol.c | 6 ++-- .../test_typedarray/test_typedarray.c | 8 ++--- 28 files changed, 139 insertions(+), 137 deletions(-) diff --git a/test/addons-napi/1_hello_world/binding.c b/test/addons-napi/1_hello_world/binding.c index 6efc14ee66e18f..02cd5dd2f19418 100644 --- a/test/addons-napi/1_hello_world/binding.c +++ b/test/addons-napi/1_hello_world/binding.c @@ -2,7 +2,7 @@ #include "../common.h" #include -napi_value Method(napi_env env, napi_callback_info info) { +static napi_value Method(napi_env env, napi_callback_info info) { napi_value world; const char* str = "world"; size_t str_len = strlen(str); diff --git a/test/addons-napi/2_function_arguments/binding.c b/test/addons-napi/2_function_arguments/binding.c index c45ca0871db8ec..7d88c3d9e4ff19 100644 --- a/test/addons-napi/2_function_arguments/binding.c +++ b/test/addons-napi/2_function_arguments/binding.c @@ -1,7 +1,7 @@ #include #include "../common.h" -napi_value Add(napi_env env, napi_callback_info info) { +static napi_value Add(napi_env env, napi_callback_info info) { size_t argc = 2; napi_value args[2]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -29,7 +29,7 @@ napi_value Add(napi_env env, napi_callback_info info) { return sum; } -napi_value Init(napi_env env, napi_value exports) { +static napi_value Init(napi_env env, napi_value exports) { napi_property_descriptor desc = DECLARE_NAPI_PROPERTY("add", Add); NAPI_CALL(env, napi_define_properties(env, exports, 1, &desc)); return exports; diff --git a/test/addons-napi/3_callbacks/binding.c b/test/addons-napi/3_callbacks/binding.c index 7ebacf1d0653e9..1c0dd8126ce4ef 100644 --- a/test/addons-napi/3_callbacks/binding.c +++ b/test/addons-napi/3_callbacks/binding.c @@ -2,7 +2,7 @@ #include "../common.h" #include -napi_value RunCallback(napi_env env, napi_callback_info info) { +static napi_value RunCallback(napi_env env, napi_callback_info info) { size_t argc = 2; napi_value args[2]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -34,7 +34,7 @@ napi_value RunCallback(napi_env env, napi_callback_info info) { return NULL; } -napi_value RunCallbackWithRecv(napi_env env, napi_callback_info info) { +static napi_value RunCallbackWithRecv(napi_env env, napi_callback_info info) { size_t argc = 2; napi_value args[2]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -45,7 +45,7 @@ napi_value RunCallbackWithRecv(napi_env env, napi_callback_info info) { return NULL; } -napi_value Init(napi_env env, napi_value exports) { +static napi_value Init(napi_env env, napi_value exports) { napi_property_descriptor desc[2] = { DECLARE_NAPI_PROPERTY("RunCallback", RunCallback), DECLARE_NAPI_PROPERTY("RunCallbackWithRecv", RunCallbackWithRecv), diff --git a/test/addons-napi/4_object_factory/binding.c b/test/addons-napi/4_object_factory/binding.c index 38b8ec8e1cab48..0ed95e93512a0b 100644 --- a/test/addons-napi/4_object_factory/binding.c +++ b/test/addons-napi/4_object_factory/binding.c @@ -1,7 +1,7 @@ #include #include "../common.h" -napi_value CreateObject(napi_env env, napi_callback_info info) { +static napi_value CreateObject(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -14,7 +14,7 @@ napi_value CreateObject(napi_env env, napi_callback_info info) { return obj; } -napi_value Init(napi_env env, napi_value exports) { +static napi_value Init(napi_env env, napi_value exports) { NAPI_CALL(env, napi_create_function(env, "exports", -1, CreateObject, NULL, &exports)); return exports; diff --git a/test/addons-napi/5_function_factory/binding.c b/test/addons-napi/5_function_factory/binding.c index 8cc41f6aac5c3d..19460b9ddc55f2 100644 --- a/test/addons-napi/5_function_factory/binding.c +++ b/test/addons-napi/5_function_factory/binding.c @@ -1,20 +1,20 @@ #include #include "../common.h" -napi_value MyFunction(napi_env env, napi_callback_info info) { +static napi_value MyFunction(napi_env env, napi_callback_info info) { napi_value str; NAPI_CALL(env, napi_create_string_utf8(env, "hello world", -1, &str)); return str; } -napi_value CreateFunction(napi_env env, napi_callback_info info) { +static napi_value CreateFunction(napi_env env, napi_callback_info info) { napi_value fn; NAPI_CALL(env, napi_create_function(env, "theFunction", -1, MyFunction, NULL, &fn)); return fn; } -napi_value Init(napi_env env, napi_value exports) { +static napi_value Init(napi_env env, napi_value exports) { NAPI_CALL(env, napi_create_function(env, "exports", -1, CreateFunction, NULL, &exports)); return exports; diff --git a/test/addons-napi/test_array/test_array.c b/test/addons-napi/test_array/test_array.c index f13867ca74f848..bd4f867c0c9117 100644 --- a/test/addons-napi/test_array/test_array.c +++ b/test/addons-napi/test_array/test_array.c @@ -2,7 +2,7 @@ #include #include "../common.h" -napi_value TestGetElement(napi_env env, napi_callback_info info) { +static napi_value TestGetElement(napi_env env, napi_callback_info info) { size_t argc = 2; napi_value args[2]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -45,7 +45,7 @@ napi_value TestGetElement(napi_env env, napi_callback_info info) { return ret; } -napi_value TestHasElement(napi_env env, napi_callback_info info) { +static napi_value TestHasElement(napi_env env, napi_callback_info info) { size_t argc = 2; napi_value args[2]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -84,7 +84,7 @@ napi_value TestHasElement(napi_env env, napi_callback_info info) { return ret; } -napi_value TestDeleteElement(napi_env env, napi_callback_info info) { +static napi_value TestDeleteElement(napi_env env, napi_callback_info info) { size_t argc = 2; napi_value args[2]; @@ -119,7 +119,7 @@ napi_value TestDeleteElement(napi_env env, napi_callback_info info) { return ret; } -napi_value New(napi_env env, napi_callback_info info) { +static napi_value New(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -147,7 +147,7 @@ napi_value New(napi_env env, napi_callback_info info) { return ret; } -napi_value NewWithLength(napi_env env, napi_callback_info info) { +static napi_value NewWithLength(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -169,7 +169,7 @@ napi_value NewWithLength(napi_env env, napi_callback_info info) { return ret; } -napi_value Init(napi_env env, napi_value exports) { +static napi_value Init(napi_env env, napi_value exports) { napi_property_descriptor descriptors[] = { DECLARE_NAPI_PROPERTY("TestGetElement", TestGetElement), DECLARE_NAPI_PROPERTY("TestHasElement", TestHasElement), diff --git a/test/addons-napi/test_buffer/test_buffer.c b/test/addons-napi/test_buffer/test_buffer.c index 657eb7b3a051bf..552d280615739f 100644 --- a/test/addons-napi/test_buffer/test_buffer.c +++ b/test/addons-napi/test_buffer/test_buffer.c @@ -20,7 +20,7 @@ static void noopDeleter(napi_env env, void* data, void* finalize_hint) { deleterCallCount++; } -napi_value newBuffer(napi_env env, napi_callback_info info) { +static napi_value newBuffer(napi_env env, napi_callback_info info) { napi_value theBuffer; char* theCopy; const unsigned int kBufferSize = sizeof(theText); @@ -37,7 +37,7 @@ napi_value newBuffer(napi_env env, napi_callback_info info) { return theBuffer; } -napi_value newExternalBuffer(napi_env env, napi_callback_info info) { +static napi_value newExternalBuffer(napi_env env, napi_callback_info info) { napi_value theBuffer; char* theCopy = strdup(theText); NAPI_ASSERT(env, theCopy, "Failed to copy static text for newExternalBuffer"); @@ -53,20 +53,20 @@ napi_value newExternalBuffer(napi_env env, napi_callback_info info) { return theBuffer; } -napi_value getDeleterCallCount(napi_env env, napi_callback_info info) { +static napi_value getDeleterCallCount(napi_env env, napi_callback_info info) { napi_value callCount; NAPI_CALL(env, napi_create_int32(env, deleterCallCount, &callCount)); return callCount; } -napi_value copyBuffer(napi_env env, napi_callback_info info) { +static napi_value copyBuffer(napi_env env, napi_callback_info info) { napi_value theBuffer; NAPI_CALL(env, napi_create_buffer_copy( env, sizeof(theText), theText, NULL, &theBuffer)); return theBuffer; } -napi_value bufferHasInstance(napi_env env, napi_callback_info info) { +static napi_value bufferHasInstance(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -85,7 +85,7 @@ napi_value bufferHasInstance(napi_env env, napi_callback_info info) { return returnValue; } -napi_value bufferInfo(napi_env env, napi_callback_info info) { +static napi_value bufferInfo(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -106,7 +106,7 @@ napi_value bufferInfo(napi_env env, napi_callback_info info) { return returnValue; } -napi_value staticBuffer(napi_env env, napi_callback_info info) { +static napi_value staticBuffer(napi_env env, napi_callback_info info) { napi_value theBuffer; NAPI_CALL( env, @@ -119,7 +119,7 @@ napi_value staticBuffer(napi_env env, napi_callback_info info) { return theBuffer; } -napi_value Init(napi_env env, napi_value exports) { +static napi_value Init(napi_env env, napi_value exports) { napi_value theValue; NAPI_CALL(env, diff --git a/test/addons-napi/test_constructor/test_constructor.c b/test/addons-napi/test_constructor/test_constructor.c index 4ee8323dd6ed40..8cc092049aef10 100644 --- a/test/addons-napi/test_constructor/test_constructor.c +++ b/test/addons-napi/test_constructor/test_constructor.c @@ -4,7 +4,7 @@ static double value_ = 1; static double static_value_ = 10; -napi_value GetValue(napi_env env, napi_callback_info info) { +static napi_value GetValue(napi_env env, napi_callback_info info) { size_t argc = 0; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, NULL, NULL, NULL)); @@ -16,7 +16,7 @@ napi_value GetValue(napi_env env, napi_callback_info info) { return number; } -napi_value SetValue(napi_env env, napi_callback_info info) { +static napi_value SetValue(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -28,7 +28,7 @@ napi_value SetValue(napi_env env, napi_callback_info info) { return NULL; } -napi_value Echo(napi_env env, napi_callback_info info) { +static napi_value Echo(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -38,14 +38,14 @@ napi_value Echo(napi_env env, napi_callback_info info) { return args[0]; } -napi_value New(napi_env env, napi_callback_info info) { +static napi_value New(napi_env env, napi_callback_info info) { napi_value _this; NAPI_CALL(env, napi_get_cb_info(env, info, NULL, NULL, &_this, NULL)); return _this; } -napi_value GetStaticValue(napi_env env, napi_callback_info info) { +static napi_value GetStaticValue(napi_env env, napi_callback_info info) { size_t argc = 0; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, NULL, NULL, NULL)); @@ -58,7 +58,7 @@ napi_value GetStaticValue(napi_env env, napi_callback_info info) { } -napi_value Init(napi_env env, napi_value exports) { +static napi_value Init(napi_env env, napi_value exports) { napi_value number; NAPI_CALL(env, napi_create_double(env, value_, &number)); diff --git a/test/addons-napi/test_constructor/test_constructor_name.c b/test/addons-napi/test_constructor/test_constructor_name.c index a5c89791f0f0cd..b30ea4333747d3 100644 --- a/test/addons-napi/test_constructor/test_constructor_name.c +++ b/test/addons-napi/test_constructor/test_constructor_name.c @@ -3,14 +3,14 @@ napi_ref constructor_; -napi_value New(napi_env env, napi_callback_info info) { +static napi_value New(napi_env env, napi_callback_info info) { napi_value _this; NAPI_CALL(env, napi_get_cb_info(env, info, NULL, NULL, &_this, NULL)); return _this; } -napi_value Init(napi_env env, napi_value exports) { +static napi_value Init(napi_env env, napi_value exports) { napi_value cons; NAPI_CALL(env, napi_define_class( env, "MyObject_Extra", 8, New, NULL, 0, NULL, &cons)); diff --git a/test/addons-napi/test_conversions/test_conversions.c b/test/addons-napi/test_conversions/test_conversions.c index 4f92bafa35b79d..845b7e7c56d7df 100644 --- a/test/addons-napi/test_conversions/test_conversions.c +++ b/test/addons-napi/test_conversions/test_conversions.c @@ -1,7 +1,7 @@ #include #include "../common.h" -napi_value AsBool(napi_env env, napi_callback_info info) { +static napi_value AsBool(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -15,7 +15,7 @@ napi_value AsBool(napi_env env, napi_callback_info info) { return output; } -napi_value AsInt32(napi_env env, napi_callback_info info) { +static napi_value AsInt32(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -29,7 +29,7 @@ napi_value AsInt32(napi_env env, napi_callback_info info) { return output; } -napi_value AsUInt32(napi_env env, napi_callback_info info) { +static napi_value AsUInt32(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -43,7 +43,7 @@ napi_value AsUInt32(napi_env env, napi_callback_info info) { return output; } -napi_value AsInt64(napi_env env, napi_callback_info info) { +static napi_value AsInt64(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -57,7 +57,7 @@ napi_value AsInt64(napi_env env, napi_callback_info info) { return output; } -napi_value AsDouble(napi_env env, napi_callback_info info) { +static napi_value AsDouble(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -71,7 +71,7 @@ napi_value AsDouble(napi_env env, napi_callback_info info) { return output; } -napi_value AsString(napi_env env, napi_callback_info info) { +static napi_value AsString(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -87,7 +87,7 @@ napi_value AsString(napi_env env, napi_callback_info info) { return output; } -napi_value ToBool(napi_env env, napi_callback_info info) { +static napi_value ToBool(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -98,7 +98,7 @@ napi_value ToBool(napi_env env, napi_callback_info info) { return output; } -napi_value ToNumber(napi_env env, napi_callback_info info) { +static napi_value ToNumber(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -109,7 +109,7 @@ napi_value ToNumber(napi_env env, napi_callback_info info) { return output; } -napi_value ToObject(napi_env env, napi_callback_info info) { +static napi_value ToObject(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -120,7 +120,7 @@ napi_value ToObject(napi_env env, napi_callback_info info) { return output; } -napi_value ToString(napi_env env, napi_callback_info info) { +static napi_value ToString(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -131,7 +131,7 @@ napi_value ToString(napi_env env, napi_callback_info info) { return output; } -napi_value Init(napi_env env, napi_value exports) { +static napi_value Init(napi_env env, napi_value exports) { napi_property_descriptor descriptors[] = { DECLARE_NAPI_PROPERTY("asBool", AsBool), DECLARE_NAPI_PROPERTY("asInt32", AsInt32), diff --git a/test/addons-napi/test_dataview/test_dataview.c b/test/addons-napi/test_dataview/test_dataview.c index 4d29ed07e9e6f7..8d29743522022f 100644 --- a/test/addons-napi/test_dataview/test_dataview.c +++ b/test/addons-napi/test_dataview/test_dataview.c @@ -2,7 +2,7 @@ #include #include "../common.h" -napi_value CreateDataView(napi_env env, napi_callback_info info) { +static napi_value CreateDataView(napi_env env, napi_callback_info info) { size_t argc = 3; napi_value args [3]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -49,7 +49,7 @@ napi_value CreateDataView(napi_env env, napi_callback_info info) { return output_dataview; } -napi_value CreateDataViewFromJSDataView(napi_env env, napi_callback_info info) { +static napi_value CreateDataViewFromJSDataView(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args [1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -85,7 +85,7 @@ napi_value CreateDataViewFromJSDataView(napi_env env, napi_callback_info info) { return output_dataview; } -napi_value Init(napi_env env, napi_value exports) { +static napi_value Init(napi_env env, napi_value exports) { napi_property_descriptor descriptors[] = { DECLARE_NAPI_PROPERTY("CreateDataView", CreateDataView), DECLARE_NAPI_PROPERTY("CreateDataViewFromJSDataView", diff --git a/test/addons-napi/test_env_sharing/compare_env.c b/test/addons-napi/test_env_sharing/compare_env.c index 6a93ce52c64025..3326a34067219a 100644 --- a/test/addons-napi/test_env_sharing/compare_env.c +++ b/test/addons-napi/test_env_sharing/compare_env.c @@ -1,7 +1,7 @@ #include #include "../common.h" -napi_value compare(napi_env env, napi_callback_info info) { +static napi_value compare(napi_env env, napi_callback_info info) { napi_value external; size_t argc = 1; void* data; @@ -14,7 +14,7 @@ napi_value compare(napi_env env, napi_callback_info info) { return return_value; } -napi_value Init(napi_env env, napi_value exports) { +static napi_value Init(napi_env env, napi_value exports) { NAPI_CALL(env, napi_create_function( env, "exports", NAPI_AUTO_LENGTH, compare, NULL, &exports)); return exports; diff --git a/test/addons-napi/test_env_sharing/store_env.c b/test/addons-napi/test_env_sharing/store_env.c index 809f5f7a4b2eed..0559b178cba68b 100644 --- a/test/addons-napi/test_env_sharing/store_env.c +++ b/test/addons-napi/test_env_sharing/store_env.c @@ -1,7 +1,7 @@ #include #include "../common.h" -napi_value Init(napi_env env, napi_value exports) { +static napi_value Init(napi_env env, napi_value exports) { napi_value external; NAPI_CALL(env, napi_create_external(env, env, NULL, NULL, &external)); return external; diff --git a/test/addons-napi/test_fatal/test_fatal.c b/test/addons-napi/test_fatal/test_fatal.c index add8bebf3be7e3..b9248d40d49e6a 100644 --- a/test/addons-napi/test_fatal/test_fatal.c +++ b/test/addons-napi/test_fatal/test_fatal.c @@ -1,18 +1,18 @@ #include #include "../common.h" -napi_value Test(napi_env env, napi_callback_info info) { +static napi_value Test(napi_env env, napi_callback_info info) { napi_fatal_error("test_fatal::Test", NAPI_AUTO_LENGTH, "fatal message", NAPI_AUTO_LENGTH); return NULL; } -napi_value TestStringLength(napi_env env, napi_callback_info info) { +static napi_value TestStringLength(napi_env env, napi_callback_info info) { napi_fatal_error("test_fatal::TestStringLength", 16, "fatal message", 13); return NULL; } -napi_value Init(napi_env env, napi_value exports) { +static napi_value Init(napi_env env, napi_value exports) { napi_property_descriptor properties[] = { DECLARE_NAPI_PROPERTY("Test", Test), DECLARE_NAPI_PROPERTY("TestStringLength", TestStringLength), diff --git a/test/addons-napi/test_fatal_exception/test_fatal_exception.c b/test/addons-napi/test_fatal_exception/test_fatal_exception.c index fd81c56d856db8..3cc810ccc0d10c 100644 --- a/test/addons-napi/test_fatal_exception/test_fatal_exception.c +++ b/test/addons-napi/test_fatal_exception/test_fatal_exception.c @@ -1,7 +1,7 @@ #include #include "../common.h" -napi_value Test(napi_env env, napi_callback_info info) { +static napi_value Test(napi_env env, napi_callback_info info) { napi_value err; size_t argc = 1; @@ -12,7 +12,7 @@ napi_value Test(napi_env env, napi_callback_info info) { return NULL; } -napi_value Init(napi_env env, napi_value exports) { +static napi_value Init(napi_env env, napi_value exports) { napi_property_descriptor properties[] = { DECLARE_NAPI_PROPERTY("Test", Test), }; diff --git a/test/addons-napi/test_function/test_function.c b/test/addons-napi/test_function/test_function.c index b0350e6ee22876..2c361933cfa071 100644 --- a/test/addons-napi/test_function/test_function.c +++ b/test/addons-napi/test_function/test_function.c @@ -1,7 +1,7 @@ #include #include "../common.h" -napi_value TestCallFunction(napi_env env, napi_callback_info info) { +static napi_value TestCallFunction(napi_env env, napi_callback_info info) { size_t argc = 10; napi_value args[10]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -26,11 +26,11 @@ napi_value TestCallFunction(napi_env env, napi_callback_info info) { return result; } -napi_value TestFunctionName(napi_env env, napi_callback_info info) { +static napi_value TestFunctionName(napi_env env, napi_callback_info info) { return NULL; } -napi_value Init(napi_env env, napi_value exports) { +static napi_value Init(napi_env env, napi_value exports) { napi_value fn1; NAPI_CALL(env, napi_create_function( env, NULL, NAPI_AUTO_LENGTH, TestCallFunction, NULL, &fn1)); diff --git a/test/addons-napi/test_general/test_general.c b/test/addons-napi/test_general/test_general.c index 05cdd76e3c1e64..8f429f939fb89e 100644 --- a/test/addons-napi/test_general/test_general.c +++ b/test/addons-napi/test_general/test_general.c @@ -2,7 +2,7 @@ #include #include "../common.h" -napi_value testStrictEquals(napi_env env, napi_callback_info info) { +static napi_value testStrictEquals(napi_env env, napi_callback_info info) { size_t argc = 2; napi_value args[2]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -15,7 +15,7 @@ napi_value testStrictEquals(napi_env env, napi_callback_info info) { return result; } -napi_value testGetPrototype(napi_env env, napi_callback_info info) { +static napi_value testGetPrototype(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -26,7 +26,7 @@ napi_value testGetPrototype(napi_env env, napi_callback_info info) { return result; } -napi_value testGetVersion(napi_env env, napi_callback_info info) { +static napi_value testGetVersion(napi_env env, napi_callback_info info) { uint32_t version; napi_value result; NAPI_CALL(env, napi_get_version(env, &version)); @@ -34,7 +34,7 @@ napi_value testGetVersion(napi_env env, napi_callback_info info) { return result; } -napi_value testGetNodeVersion(napi_env env, napi_callback_info info) { +static napi_value testGetNodeVersion(napi_env env, napi_callback_info info) { const napi_node_version* node_version; napi_value result, major, minor, patch, release; NAPI_CALL(env, napi_get_node_version(env, &node_version)); @@ -53,7 +53,7 @@ napi_value testGetNodeVersion(napi_env env, napi_callback_info info) { return result; } -napi_value doInstanceOf(napi_env env, napi_callback_info info) { +static napi_value doInstanceOf(napi_env env, napi_callback_info info) { size_t argc = 2; napi_value args[2]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -67,19 +67,19 @@ napi_value doInstanceOf(napi_env env, napi_callback_info info) { return result; } -napi_value getNull(napi_env env, napi_callback_info info) { +static napi_value getNull(napi_env env, napi_callback_info info) { napi_value result; NAPI_CALL(env, napi_get_null(env, &result)); return result; } -napi_value getUndefined(napi_env env, napi_callback_info info) { +static napi_value getUndefined(napi_env env, napi_callback_info info) { napi_value result; NAPI_CALL(env, napi_get_undefined(env, &result)); return result; } -napi_value createNapiError(napi_env env, napi_callback_info info) { +static napi_value createNapiError(napi_env env, napi_callback_info info) { napi_value value; NAPI_CALL(env, napi_create_string_utf8(env, "xyz", 3, &value)); @@ -99,7 +99,7 @@ napi_value createNapiError(napi_env env, napi_callback_info info) { return NULL; } -napi_value testNapiErrorCleanup(napi_env env, napi_callback_info info) { +static napi_value testNapiErrorCleanup(napi_env env, napi_callback_info info) { const napi_extended_error_info *error_info = 0; NAPI_CALL(env, napi_get_last_error_info(env, &error_info)); @@ -110,7 +110,7 @@ napi_value testNapiErrorCleanup(napi_env env, napi_callback_info info) { return result; } -napi_value testNapiTypeof(napi_env env, napi_callback_info info) { +static napi_value testNapiTypeof(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -157,7 +157,7 @@ static void deref_item(napi_env env, void* data, void* hint) { deref_item_called = true; } -napi_value deref_item_was_called(napi_env env, napi_callback_info info) { +static napi_value deref_item_was_called(napi_env env, napi_callback_info info) { napi_value it_was_called; NAPI_CALL(env, napi_get_boolean(env, deref_item_called, &it_was_called)); @@ -165,7 +165,7 @@ napi_value deref_item_was_called(napi_env env, napi_callback_info info) { return it_was_called; } -napi_value wrap(napi_env env, napi_callback_info info) { +static napi_value wrap(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value to_wrap; @@ -177,7 +177,7 @@ napi_value wrap(napi_env env, napi_callback_info info) { return NULL; } -napi_value remove_wrap(napi_env env, napi_callback_info info) { +static napi_value remove_wrap(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value wrapped; void* data; @@ -193,7 +193,7 @@ static void test_finalize(napi_env env, void* data, void* hint) { finalize_called = true; } -napi_value test_finalize_wrap(napi_env env, napi_callback_info info) { +static napi_value test_finalize_wrap(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value js_object; @@ -203,7 +203,7 @@ napi_value test_finalize_wrap(napi_env env, napi_callback_info info) { return NULL; } -napi_value finalize_was_called(napi_env env, napi_callback_info info) { +static napi_value finalize_was_called(napi_env env, napi_callback_info info) { napi_value it_was_called; NAPI_CALL(env, napi_get_boolean(env, finalize_called, &it_was_called)); @@ -211,7 +211,7 @@ napi_value finalize_was_called(napi_env env, napi_callback_info info) { return it_was_called; } -napi_value testAdjustExternalMemory(napi_env env, napi_callback_info info) { +static napi_value testAdjustExternalMemory(napi_env env, napi_callback_info info) { napi_value result; int64_t adjustedValue; @@ -221,7 +221,7 @@ napi_value testAdjustExternalMemory(napi_env env, napi_callback_info info) { return result; } -napi_value testNapiRun(napi_env env, napi_callback_info info) { +static napi_value testNapiRun(napi_env env, napi_callback_info info) { napi_value script, result; size_t argc = 1; @@ -232,7 +232,7 @@ napi_value testNapiRun(napi_env env, napi_callback_info info) { return result; } -napi_value Init(napi_env env, napi_value exports) { +static napi_value Init(napi_env env, napi_value exports) { napi_property_descriptor descriptors[] = { DECLARE_NAPI_PROPERTY("testStrictEquals", testStrictEquals), DECLARE_NAPI_PROPERTY("testGetPrototype", testGetPrototype), diff --git a/test/addons-napi/test_handle_scope/test_handle_scope.c b/test/addons-napi/test_handle_scope/test_handle_scope.c index 31efbcf3dd4d7b..76f31f7882b61b 100644 --- a/test/addons-napi/test_handle_scope/test_handle_scope.c +++ b/test/addons-napi/test_handle_scope/test_handle_scope.c @@ -7,7 +7,7 @@ // the right right thing would be quite hard so we keep it // simple for now. -napi_value NewScope(napi_env env, napi_callback_info info) { +static napi_value NewScope(napi_env env, napi_callback_info info) { napi_handle_scope scope; napi_value output = NULL; @@ -17,7 +17,7 @@ napi_value NewScope(napi_env env, napi_callback_info info) { return NULL; } -napi_value NewScopeEscape(napi_env env, napi_callback_info info) { +static napi_value NewScopeEscape(napi_env env, napi_callback_info info) { napi_escapable_handle_scope scope; napi_value output = NULL; napi_value escapee = NULL; @@ -29,7 +29,7 @@ napi_value NewScopeEscape(napi_env env, napi_callback_info info) { return escapee; } -napi_value NewScopeEscapeTwice(napi_env env, napi_callback_info info) { +static napi_value NewScopeEscapeTwice(napi_env env, napi_callback_info info) { napi_escapable_handle_scope scope; napi_value output = NULL; napi_value escapee = NULL; @@ -44,7 +44,7 @@ napi_value NewScopeEscapeTwice(napi_env env, napi_callback_info info) { return NULL; } -napi_value NewScopeWithException(napi_env env, napi_callback_info info) { +static napi_value NewScopeWithException(napi_env env, napi_callback_info info) { napi_handle_scope scope; size_t argc; napi_value exception_function; @@ -68,7 +68,7 @@ napi_value NewScopeWithException(napi_env env, napi_callback_info info) { return NULL; } -napi_value Init(napi_env env, napi_value exports) { +static napi_value Init(napi_env env, napi_value exports) { napi_property_descriptor properties[] = { DECLARE_NAPI_PROPERTY("NewScope", NewScope), DECLARE_NAPI_PROPERTY("NewScopeEscape", NewScopeEscape), diff --git a/test/addons-napi/test_make_callback/binding.c b/test/addons-napi/test_make_callback/binding.c index 23750f56b838fc..8eedd5b1b3b167 100644 --- a/test/addons-napi/test_make_callback/binding.c +++ b/test/addons-napi/test_make_callback/binding.c @@ -3,8 +3,7 @@ #define MAX_ARGUMENTS 10 -static -napi_value MakeCallback(napi_env env, napi_callback_info info) { +static napi_value MakeCallback(napi_env env, napi_callback_info info) { size_t argc = MAX_ARGUMENTS; size_t n; napi_value args[MAX_ARGUMENTS]; diff --git a/test/addons-napi/test_new_target/binding.c b/test/addons-napi/test_new_target/binding.c index a74d4bb2f877be..0c542ebaba693d 100644 --- a/test/addons-napi/test_new_target/binding.c +++ b/test/addons-napi/test_new_target/binding.c @@ -1,7 +1,7 @@ #include #include "../common.h" -napi_value BaseClass(napi_env env, napi_callback_info info) { +static napi_value BaseClass(napi_env env, napi_callback_info info) { napi_value newTargetArg; NAPI_CALL(env, napi_get_new_target(env, info, &newTargetArg)); napi_value thisArg; @@ -22,7 +22,7 @@ napi_value BaseClass(napi_env env, napi_callback_info info) { return thisArg; } -napi_value Constructor(napi_env env, napi_callback_info info) { +static napi_value Constructor(napi_env env, napi_callback_info info) { bool result; napi_value newTargetArg; NAPI_CALL(env, napi_get_new_target(env, info, &newTargetArg)); @@ -45,7 +45,7 @@ napi_value Constructor(napi_env env, napi_callback_info info) { return thisArg; } -napi_value OrdinaryFunction(napi_env env, napi_callback_info info) { +static napi_value OrdinaryFunction(napi_env env, napi_callback_info info) { napi_value newTargetArg; NAPI_CALL(env, napi_get_new_target(env, info, &newTargetArg)); @@ -56,7 +56,7 @@ napi_value OrdinaryFunction(napi_env env, napi_callback_info info) { return _true; } -napi_value Init(napi_env env, napi_value exports) { +static napi_value Init(napi_env env, napi_value exports) { const napi_property_descriptor desc[] = { DECLARE_NAPI_PROPERTY("BaseClass", BaseClass), DECLARE_NAPI_PROPERTY("OrdinaryFunction", OrdinaryFunction), diff --git a/test/addons-napi/test_number/test_number.c b/test/addons-napi/test_number/test_number.c index a1a70950083324..19b0ae83f051df 100644 --- a/test/addons-napi/test_number/test_number.c +++ b/test/addons-napi/test_number/test_number.c @@ -1,7 +1,7 @@ #include #include "../common.h" -napi_value Test(napi_env env, napi_callback_info info) { +static napi_value Test(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -23,7 +23,7 @@ napi_value Test(napi_env env, napi_callback_info info) { return output; } -napi_value TestInt32Truncation(napi_env env, napi_callback_info info) { +static napi_value TestInt32Truncation(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -45,7 +45,7 @@ napi_value TestInt32Truncation(napi_env env, napi_callback_info info) { return output; } -napi_value TestInt64Truncation(napi_env env, napi_callback_info info) { +static napi_value TestInt64Truncation(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -67,7 +67,7 @@ napi_value TestInt64Truncation(napi_env env, napi_callback_info info) { return output; } -napi_value Init(napi_env env, napi_value exports) { +static napi_value Init(napi_env env, napi_value exports) { napi_property_descriptor descriptors[] = { DECLARE_NAPI_PROPERTY("Test", Test), DECLARE_NAPI_PROPERTY("TestInt32Truncation", TestInt32Truncation), diff --git a/test/addons-napi/test_object/test_object.c b/test/addons-napi/test_object/test_object.c index ccf1573114a6f1..046f71fa414735 100644 --- a/test/addons-napi/test_object/test_object.c +++ b/test/addons-napi/test_object/test_object.c @@ -4,7 +4,7 @@ static int test_value = 3; -napi_value Get(napi_env env, napi_callback_info info) { +static napi_value Get(napi_env env, napi_callback_info info) { size_t argc = 2; napi_value args[2]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -30,7 +30,7 @@ napi_value Get(napi_env env, napi_callback_info info) { return output; } -napi_value Set(napi_env env, napi_callback_info info) { +static napi_value Set(napi_env env, napi_callback_info info) { size_t argc = 3; napi_value args[3]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -57,7 +57,7 @@ napi_value Set(napi_env env, napi_callback_info info) { return valuetrue; } -napi_value Has(napi_env env, napi_callback_info info) { +static napi_value Has(napi_env env, napi_callback_info info) { size_t argc = 2; napi_value args[2]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -85,7 +85,7 @@ napi_value Has(napi_env env, napi_callback_info info) { return ret; } -napi_value HasOwn(napi_env env, napi_callback_info info) { +static napi_value HasOwn(napi_env env, napi_callback_info info) { size_t argc = 2; napi_value args[2]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -113,7 +113,7 @@ napi_value HasOwn(napi_env env, napi_callback_info info) { return ret; } -napi_value Delete(napi_env env, napi_callback_info info) { +static napi_value Delete(napi_env env, napi_callback_info info) { size_t argc = 2; napi_value args[2]; @@ -138,7 +138,7 @@ napi_value Delete(napi_env env, napi_callback_info info) { return ret; } -napi_value New(napi_env env, napi_callback_info info) { +static napi_value New(napi_env env, napi_callback_info info) { napi_value ret; NAPI_CALL(env, napi_create_object(env, &ret)); @@ -157,7 +157,7 @@ napi_value New(napi_env env, napi_callback_info info) { return ret; } -napi_value Inflate(napi_env env, napi_callback_info info) { +static napi_value Inflate(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -193,7 +193,7 @@ napi_value Inflate(napi_env env, napi_callback_info info) { return obj; } -napi_value Wrap(napi_env env, napi_callback_info info) { +static napi_value Wrap(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value arg; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, &arg, NULL, NULL)); @@ -202,7 +202,7 @@ napi_value Wrap(napi_env env, napi_callback_info info) { return NULL; } -napi_value Unwrap(napi_env env, napi_callback_info info) { +static napi_value Unwrap(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value arg; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, &arg, NULL, NULL)); @@ -216,7 +216,7 @@ napi_value Unwrap(napi_env env, napi_callback_info info) { return result; } -napi_value Init(napi_env env, napi_value exports) { +static napi_value Init(napi_env env, napi_value exports) { napi_property_descriptor descriptors[] = { DECLARE_NAPI_PROPERTY("Get", Get), DECLARE_NAPI_PROPERTY("Set", Set), diff --git a/test/addons-napi/test_promise/test_promise.c b/test/addons-napi/test_promise/test_promise.c index aa89c022bc1a4a..3e2ec48572af4c 100644 --- a/test/addons-napi/test_promise/test_promise.c +++ b/test/addons-napi/test_promise/test_promise.c @@ -3,7 +3,7 @@ napi_deferred deferred = NULL; -napi_value createPromise(napi_env env, napi_callback_info info) { +static napi_value createPromise(napi_env env, napi_callback_info info) { napi_value promise; // We do not overwrite an existing deferred. @@ -16,7 +16,8 @@ napi_value createPromise(napi_env env, napi_callback_info info) { return promise; } -napi_value concludeCurrentPromise(napi_env env, napi_callback_info info) { +static napi_value +concludeCurrentPromise(napi_env env, napi_callback_info info) { napi_value argv[2]; size_t argc = 2; bool resolution; @@ -34,7 +35,7 @@ napi_value concludeCurrentPromise(napi_env env, napi_callback_info info) { return NULL; } -napi_value isPromise(napi_env env, napi_callback_info info) { +static napi_value isPromise(napi_env env, napi_callback_info info) { napi_value promise, result; size_t argc = 1; bool is_promise; @@ -46,7 +47,7 @@ napi_value isPromise(napi_env env, napi_callback_info info) { return result; } -napi_value Init(napi_env env, napi_value exports) { +static napi_value Init(napi_env env, napi_value exports) { napi_property_descriptor descriptors[] = { DECLARE_NAPI_PROPERTY("createPromise", createPromise), DECLARE_NAPI_PROPERTY("concludeCurrentPromise", concludeCurrentPromise), diff --git a/test/addons-napi/test_properties/test_properties.c b/test/addons-napi/test_properties/test_properties.c index a95c7013c2cabb..2754812f4dad27 100644 --- a/test/addons-napi/test_properties/test_properties.c +++ b/test/addons-napi/test_properties/test_properties.c @@ -3,7 +3,7 @@ static double value_ = 1; -napi_value GetValue(napi_env env, napi_callback_info info) { +static napi_value GetValue(napi_env env, napi_callback_info info) { size_t argc = 0; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, NULL, NULL, NULL)); @@ -15,7 +15,7 @@ napi_value GetValue(napi_env env, napi_callback_info info) { return number; } -napi_value SetValue(napi_env env, napi_callback_info info) { +static napi_value SetValue(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -27,7 +27,7 @@ napi_value SetValue(napi_env env, napi_callback_info info) { return NULL; } -napi_value Echo(napi_env env, napi_callback_info info) { +static napi_value Echo(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -37,7 +37,7 @@ napi_value Echo(napi_env env, napi_callback_info info) { return args[0]; } -napi_value HasNamedProperty(napi_env env, napi_callback_info info) { +static napi_value HasNamedProperty(napi_env env, napi_callback_info info) { size_t argc = 2; napi_value args[2]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -59,7 +59,7 @@ napi_value HasNamedProperty(napi_env env, napi_callback_info info) { return result; } -napi_value Init(napi_env env, napi_value exports) { +static napi_value Init(napi_env env, napi_value exports) { napi_value number; NAPI_CALL(env, napi_create_double(env, value_, &number)); diff --git a/test/addons-napi/test_reference/test_reference.c b/test/addons-napi/test_reference/test_reference.c index f34adc6693b6fe..641b1cb82ba8e1 100644 --- a/test/addons-napi/test_reference/test_reference.c +++ b/test/addons-napi/test_reference/test_reference.c @@ -5,7 +5,7 @@ static int test_value = 1; static int finalize_count = 0; static napi_ref test_reference = NULL; -napi_value GetFinalizeCount(napi_env env, napi_callback_info info) { +static napi_value GetFinalizeCount(napi_env env, napi_callback_info info) { napi_value result; NAPI_CALL(env, napi_create_int32(env, finalize_count, &result)); return result; @@ -18,7 +18,7 @@ void FinalizeExternal(napi_env env, void* data, void* hint) { finalize_count++; } -napi_value CreateExternal(napi_env env, napi_callback_info info) { +static napi_value CreateExternal(napi_env env, napi_callback_info info) { int* data = &test_value; napi_value result; @@ -33,7 +33,8 @@ napi_value CreateExternal(napi_env env, napi_callback_info info) { return result; } -napi_value CreateExternalWithFinalize(napi_env env, napi_callback_info info) { +static napi_value +CreateExternalWithFinalize(napi_env env, napi_callback_info info) { napi_value result; NAPI_CALL(env, napi_create_external(env, @@ -46,7 +47,7 @@ napi_value CreateExternalWithFinalize(napi_env env, napi_callback_info info) { return result; } -napi_value CheckExternal(napi_env env, napi_callback_info info) { +static napi_value CheckExternal(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value arg; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, &arg, NULL, NULL)); @@ -67,7 +68,7 @@ napi_value CheckExternal(napi_env env, napi_callback_info info) { return NULL; } -napi_value CreateReference(napi_env env, napi_callback_info info) { +static napi_value CreateReference(napi_env env, napi_callback_info info) { NAPI_ASSERT(env, test_reference == NULL, "The test allows only one reference at a time."); @@ -88,7 +89,7 @@ napi_value CreateReference(napi_env env, napi_callback_info info) { return NULL; } -napi_value DeleteReference(napi_env env, napi_callback_info info) { +static napi_value DeleteReference(napi_env env, napi_callback_info info) { NAPI_ASSERT(env, test_reference != NULL, "A reference must have been created."); @@ -97,7 +98,7 @@ napi_value DeleteReference(napi_env env, napi_callback_info info) { return NULL; } -napi_value IncrementRefcount(napi_env env, napi_callback_info info) { +static napi_value IncrementRefcount(napi_env env, napi_callback_info info) { NAPI_ASSERT(env, test_reference != NULL, "A reference must have been created."); @@ -109,7 +110,7 @@ napi_value IncrementRefcount(napi_env env, napi_callback_info info) { return result; } -napi_value DecrementRefcount(napi_env env, napi_callback_info info) { +static napi_value DecrementRefcount(napi_env env, napi_callback_info info) { NAPI_ASSERT(env, test_reference != NULL, "A reference must have been created."); @@ -121,7 +122,7 @@ napi_value DecrementRefcount(napi_env env, napi_callback_info info) { return result; } -napi_value GetReferenceValue(napi_env env, napi_callback_info info) { +static napi_value GetReferenceValue(napi_env env, napi_callback_info info) { NAPI_ASSERT(env, test_reference != NULL, "A reference must have been created."); @@ -130,7 +131,7 @@ napi_value GetReferenceValue(napi_env env, napi_callback_info info) { return result; } -napi_value Init(napi_env env, napi_value exports) { +static napi_value Init(napi_env env, napi_value exports) { napi_property_descriptor descriptors[] = { DECLARE_NAPI_GETTER("finalizeCount", GetFinalizeCount), DECLARE_NAPI_PROPERTY("createExternal", CreateExternal), diff --git a/test/addons-napi/test_string/test_string.c b/test/addons-napi/test_string/test_string.c index 99a3f7d3545a20..4e6da7bf86849f 100644 --- a/test/addons-napi/test_string/test_string.c +++ b/test/addons-napi/test_string/test_string.c @@ -2,7 +2,7 @@ #include #include "../common.h" -napi_value TestLatin1(napi_env env, napi_callback_info info) { +static napi_value TestLatin1(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -28,7 +28,7 @@ napi_value TestLatin1(napi_env env, napi_callback_info info) { return output; } -napi_value TestUtf8(napi_env env, napi_callback_info info) { +static napi_value TestUtf8(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -54,7 +54,7 @@ napi_value TestUtf8(napi_env env, napi_callback_info info) { return output; } -napi_value TestUtf16(napi_env env, napi_callback_info info) { +static napi_value TestUtf16(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -80,7 +80,8 @@ napi_value TestUtf16(napi_env env, napi_callback_info info) { return output; } -napi_value TestLatin1Insufficient(napi_env env, napi_callback_info info) { +static napi_value +TestLatin1Insufficient(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -106,7 +107,7 @@ napi_value TestLatin1Insufficient(napi_env env, napi_callback_info info) { return output; } -napi_value TestUtf8Insufficient(napi_env env, napi_callback_info info) { +static napi_value TestUtf8Insufficient(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -132,7 +133,7 @@ napi_value TestUtf8Insufficient(napi_env env, napi_callback_info info) { return output; } -napi_value TestUtf16Insufficient(napi_env env, napi_callback_info info) { +static napi_value TestUtf16Insufficient(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -158,7 +159,7 @@ napi_value TestUtf16Insufficient(napi_env env, napi_callback_info info) { return output; } -napi_value Utf16Length(napi_env env, napi_callback_info info) { +static napi_value Utf16Length(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -180,7 +181,7 @@ napi_value Utf16Length(napi_env env, napi_callback_info info) { return output; } -napi_value Utf8Length(napi_env env, napi_callback_info info) { +static napi_value Utf8Length(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -202,7 +203,7 @@ napi_value Utf8Length(napi_env env, napi_callback_info info) { return output; } -napi_value TestLargeUtf8(napi_env env, napi_callback_info info) { +static napi_value TestLargeUtf8(napi_env env, napi_callback_info info) { napi_value output; if (SIZE_MAX > INT_MAX) { NAPI_CALL(env, napi_create_string_utf8(env, "", ((size_t)INT_MAX) + 1, &output)); @@ -215,7 +216,7 @@ napi_value TestLargeUtf8(napi_env env, napi_callback_info info) { return output; } -napi_value Init(napi_env env, napi_value exports) { +static napi_value Init(napi_env env, napi_value exports) { napi_property_descriptor properties[] = { DECLARE_NAPI_PROPERTY("TestLatin1", TestLatin1), DECLARE_NAPI_PROPERTY("TestLatin1Insufficient", TestLatin1Insufficient), diff --git a/test/addons-napi/test_symbol/test_symbol.c b/test/addons-napi/test_symbol/test_symbol.c index c91b6ae54f4932..18cb4b405fb76d 100644 --- a/test/addons-napi/test_symbol/test_symbol.c +++ b/test/addons-napi/test_symbol/test_symbol.c @@ -1,7 +1,7 @@ #include #include "../common.h" -napi_value Test(napi_env env, napi_callback_info info) { +static napi_value Test(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -26,7 +26,7 @@ napi_value Test(napi_env env, napi_callback_info info) { return output; } -napi_value New(napi_env env, napi_callback_info info) { +static napi_value New(napi_env env, napi_callback_info info) { size_t argc = 1; napi_value args[1]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -48,7 +48,7 @@ napi_value New(napi_env env, napi_callback_info info) { return symbol; } -napi_value Init(napi_env env, napi_value exports) { +static napi_value Init(napi_env env, napi_value exports) { napi_property_descriptor properties[] = { DECLARE_NAPI_PROPERTY("New", New), }; diff --git a/test/addons-napi/test_typedarray/test_typedarray.c b/test/addons-napi/test_typedarray/test_typedarray.c index 2758a6f53298fe..a0ac02665864f1 100644 --- a/test/addons-napi/test_typedarray/test_typedarray.c +++ b/test/addons-napi/test_typedarray/test_typedarray.c @@ -2,7 +2,7 @@ #include #include "../common.h" -napi_value Multiply(napi_env env, napi_callback_info info) { +static napi_value Multiply(napi_env env, napi_callback_info info) { size_t argc = 2; napi_value args[2]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -73,7 +73,7 @@ napi_value Multiply(napi_env env, napi_callback_info info) { return output_array; } -napi_value External(napi_env env, napi_callback_info info) { +static napi_value External(napi_env env, napi_callback_info info) { static int8_t externalData[] = {0, 1, 2}; napi_value output_buffer; @@ -96,7 +96,7 @@ napi_value External(napi_env env, napi_callback_info info) { return output_array; } -napi_value CreateTypedArray(napi_env env, napi_callback_info info) { +static napi_value CreateTypedArray(napi_env env, napi_callback_info info) { size_t argc = 4; napi_value args[4]; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL)); @@ -165,7 +165,7 @@ napi_value CreateTypedArray(napi_env env, napi_callback_info info) { return output_array; } -napi_value Init(napi_env env, napi_value exports) { +static napi_value Init(napi_env env, napi_value exports) { napi_property_descriptor descriptors[] = { DECLARE_NAPI_PROPERTY("Multiply", Multiply), DECLARE_NAPI_PROPERTY("External", External),