Skip to content

Commit

Permalink
n-api: fix object test
Browse files Browse the repository at this point in the history
Passing a pointer to a static integer is sufficient for the test.

PR-URL: #19039
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Hitesh Kanwathirtha <[email protected]>
  • Loading branch information
Gabriel Schulhof committed Mar 2, 2018
1 parent f7e5b38 commit c698017
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions test/addons-napi/test_object/test_object.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include <node_api.h>
#include "../common.h"
#include <string.h>
#include <stdlib.h>

static int test_value = 3;

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit c698017

Please sign in to comment.