Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

48198 node api external strings #48339

Closed
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
bd8045b
node-api: unify string creation
gabrielschulhof Jun 2, 2023
50a2109
node-api: add string creation benchmark
gabrielschulhof Jun 3, 2023
1364872
node-api: implement external strings
gabrielschulhof Jun 3, 2023
a9e24b9
add test
gabrielschulhof Jun 3, 2023
e1127d1
rename to node_api_*
gabrielschulhof Jun 4, 2023
953304c
put back build type
gabrielschulhof Jun 5, 2023
09f7cdf
make linter work
gabrielschulhof Jun 5, 2023
902cb33
rename as requested
gabrielschulhof Jun 6, 2023
754864e
use std::basic_string_view to calc length in case of NAPI_AUTO_LENGTH
gabrielschulhof Jun 6, 2023
95a9971
test for auto-length
gabrielschulhof Jun 7, 2023
b4f383b
format
gabrielschulhof Jun 7, 2023
05317ac
correct length
gabrielschulhof Jun 7, 2023
20ab0fb
doc
gabrielschulhof Jun 7, 2023
ca4c08c
use right length indicator
gabrielschulhof Jun 8, 2023
5de34d4
final adjustment
gabrielschulhof Jun 8, 2023
64f2498
Apply suggestions from code review
gabrielschulhof Jun 8, 2023
cb9d95a
Apply suggestions from code review
gabrielschulhof Jun 8, 2023
ed83494
remove utf8
gabrielschulhof Jun 9, 2023
e063901
handle the case where we copy the string
gabrielschulhof Jun 10, 2023
4ff5e53
implement the non-copying case
gabrielschulhof Jun 10, 2023
402c93e
Unify the two external cases
gabrielschulhof Jun 11, 2023
32a5600
factor out tracking
gabrielschulhof Jun 11, 2023
0b72009
document
gabrielschulhof Jun 11, 2023
50dfa5d
debug ctor dtor
gabrielschulhof Jun 11, 2023
3a96b04
typo
gabrielschulhof Jun 11, 2023
caccb8e
Apply suggestions from code review
gabrielschulhof Jun 11, 2023
5c11c81
Apply suggestions from code review
gabrielschulhof Jun 11, 2023
b651fca
use common distructor
gabrielschulhof Jun 12, 2023
668fd4d
format
gabrielschulhof Jun 12, 2023
c721439
Apply suggestions from code review
gabrielschulhof Jun 12, 2023
7f67a2f
md lint
gabrielschulhof Jun 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
  • Loading branch information
gabrielschulhof authored Jun 8, 2023
commit 64f24984267826e2b8c6baf2506be27ac9e17bd5
7 changes: 4 additions & 3 deletions test/js-native-api/test_string/test_string.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ typedef napi_status (*TwoByteCreateAPI)(napi_env,
typedef napi_status (*TwoByteGetAPI)(
napi_env, napi_value, char16_t*, size_t, size_t*);

// Test passing back the one-byte string we got from JS as an external string.
// Test passing back the one-byte string we got from JS.
static napi_value TestOneByteImpl(napi_env env,
napi_callback_info info,
OneByteGetAPI get_api,
Expand All @@ -85,7 +85,7 @@ static napi_value TestOneByteImpl(napi_env env,
return output;
}

// Test passing back the two-byte string we got from JS as an external string.
// Test passing back the two-byte string we got from JS.
static napi_value TestTwoByteImpl(napi_env env,
napi_callback_info info,
TwoByteGetAPI get_api,
Expand Down Expand Up @@ -169,7 +169,8 @@ static size_t strlen16(const char16_t* string) {
return iter - string;
}
}
return NAPI_AUTO_LENGTH;
// We should never get here.
abort();
}

static napi_status create_external_utf16(napi_env env,
Expand Down