mirror of
https://github.com/oven-sh/bun
synced 2026-02-16 13:51:47 +00:00
Remove a memcpy (#20261)
Co-authored-by: Jarred-Sumner <709451+Jarred-Sumner@users.noreply.github.com>
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user