mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
n-api: fix object test
Passing a pointer to a static integer is sufficient for the test. PR-URL: https://github.com/nodejs/node/pull/19039 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Hitesh Kanwathirtha <hiteshk@microsoft.com>
This commit is contained in:
1 parent
08b83ee27a
commit
1b32fc3276
1 file changed
+1
-4
@@ -1,7 +1,6 @@
|
||||
#include <node_api.h>
|
||||
#include "../common.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static int test_value = 3;
|
||||
|
||||
@@ -199,9 +198,7 @@ napi_value Wrap(napi_env env, napi_callback_info info) {
|
||||
napi_value arg;
|
||||
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, &arg, NULL, NULL));
|
||||
|
||||
int32_t* data = malloc(sizeof(int32_t));
|
||||
*data = test_value;
|
||||
NAPI_CALL(env, napi_wrap(env, arg, data, NULL, NULL, NULL));
|
||||
NAPI_CALL(env, napi_wrap(env, arg, &test_value, NULL, NULL, NULL));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user