Skip to content

Commit

Permalink
doc: fix n-api example string
Browse files Browse the repository at this point in the history
- using a length of 6 for `"hello"` includes a terminating null yielding
  `"hello\u0000"`
- length of 5 would work,
but comparing to the N-API docs gives `NAPI_AUTO_LENGTH` instead

PR-URL: #19205
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Daniel Bevenius <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
  • Loading branch information
srl295 authored and tniessen committed Mar 24, 2018
1 parent 2289267 commit 7921e53
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion doc/api/addons.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ napi_value Method(napi_env env, napi_callback_info args) {
napi_value greeting;
napi_status status;

status = napi_create_string_utf8(env, "hello", 6, &greeting);
status = napi_create_string_utf8(env, "hello", NAPI_AUTO_LENGTH, &greeting);
if (status != napi_ok) return nullptr;
return greeting;
}
Expand Down

0 comments on commit 7921e53

Please sign in to comment.