src: avoid unnecessary string -> char* -> string round trips

In these places we can just generate `std::string` directly, so
there's no need to convert to an intermediate C string.

PR-URL: https://github.com/nodejs/node/pull/60055
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
This commit is contained in:
Anna Henningsen committed 2025-09-30 15:37:42 +02:00
1 parent e4e859efc3
commit 77cf2efa57
6 files changed
+10 -12

No files matched your search

+2 -2
View File
@@ -284,10 +284,10 @@ ContextifyContext* ContextifyContext::New(Local<Context> v8_context,
options->allow_code_gen_wasm);
Utf8Value name_val(env->isolate(), options->name);
ContextInfo info(*name_val);
ContextInfo info(name_val.ToString());
if (!options->origin.IsEmpty()) {
Utf8Value origin_val(env->isolate(), options->origin);
info.origin = *origin_val;
info.origin = origin_val.ToString();
}
ContextifyContext* result;