mirror of https://github.com/nodejs/node.git
doc: fix n-api example string
- 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: https://github.com/nodejs/node/pull/19205 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>pull/19568/head
parent
2289267fc2
commit
7921e53ac5
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue