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
@@ -276,12 +276,12 @@ inline void THROW_ERR_REQUIRE_ASYNC_MODULE(
if (!parent_filename.IsEmpty() && parent_filename->IsString()) {
Utf8Value utf8(env->isolate(), parent_filename);
message += "\n From ";
message += utf8.out();
message += utf8.ToStringView();
}
if (!filename.IsEmpty() && filename->IsString()) {
Utf8Value utf8(env->isolate(), filename);
message += "\n Requiring ";
message += +utf8.out();
message += utf8.ToStringView();
}
THROW_ERR_REQUIRE_ASYNC_MODULE(env, message.c_str());
}