Remove a memcpy (#20261)

Co-authored-by: Jarred-Sumner <709451+Jarred-Sumner@users.noreply.github.com>
This commit is contained in:
Jarred Sumner
2025-06-08 05:07:09 -07:00
committed by GitHub
parent 02a7d71b70
commit 498186764a
41 changed files with 283 additions and 297 deletions

View File

@@ -688,9 +688,9 @@ pub const CreateCommand = struct {
if (package_json_file != null) {
initializeStore();
var source = logger.Source.initPathString("package.json", package_json_contents.list.items);
const source = &logger.Source.initPathString("package.json", package_json_contents.list.items);
var package_json_expr = JSON.parseUTF8(&source, ctx.log, ctx.allocator) catch {
var package_json_expr = JSON.parseUTF8(source, ctx.log, ctx.allocator) catch {
package_json_file = null;
break :process_package_json;
};
@@ -1429,7 +1429,7 @@ pub const CreateCommand = struct {
@TypeOf(&package_json_writer),
&package_json_writer,
package_json_expr,
&source,
source,
.{ .mangled_props = null },
) catch |err| {
Output.prettyErrorln("package.json failed to write due to error {s}", .{@errorName(err)});
@@ -2134,8 +2134,8 @@ pub const Example = struct {
progress.name = "Parsing package.json";
refresher.refresh();
initializeStore();
var source = logger.Source.initPathString("package.json", mutable.list.items);
var expr = JSON.parseUTF8(&source, ctx.log, ctx.allocator) catch |err| {
const source = &logger.Source.initPathString("package.json", mutable.list.items);
var expr = JSON.parseUTF8(source, ctx.log, ctx.allocator) catch |err| {
progress.end();
refresher.refresh();
@@ -2265,8 +2265,8 @@ pub const Example = struct {
}
initializeStore();
var source = logger.Source.initPathString("examples.json", mutable.list.items);
const examples_object = JSON.parseUTF8(&source, ctx.log, ctx.allocator) catch |err| {
const source = &logger.Source.initPathString("examples.json", mutable.list.items);
const examples_object = JSON.parseUTF8(source, ctx.log, ctx.allocator) catch |err| {
if (ctx.log.errors > 0) {
try ctx.log.print(Output.errorWriter());
Global.exit(1);