@@ -16,21 +16,20 @@ var writer_buf: [1024]u8 = undefined;
1616
1717pub fn main (init : std.process.Init ) ! void {
1818 const io = init .io ;
19- const gpa = init .gpa ;
20- const arena = init .arena ;
19+ const arena = init .arena .allocator ();
2120
22- const args = try init .minimal .args .toSlice (arena . allocator () );
21+ const args = try init .minimal .args .toSlice (arena );
2322 if (args .len < 3 or args .len > 4 ) {
2423 return error .UsageError ;
2524 }
2625
2726 const json_args = args [1 ];
2827 const output_path = args [2 ];
2928
30- const parsed_args = try std .json .parseFromSliceLeaky (Args , gpa , json_args , .{});
29+ const parsed_args = try std .json .parseFromSliceLeaky (Args , arena , json_args , .{});
3130
3231 const maybe_user_linker_script = if (args .len == 4 )
33- try std .Io .Dir .cwd ().readFileAlloc (io , args [3 ], gpa , .limited (100 * 1024 * 1024 ))
32+ try std .Io .Dir .cwd ().readFileAlloc (io , args [3 ], arena , .limited (100 * 1024 * 1024 ))
3433 else
3534 null ;
3635
@@ -51,14 +50,14 @@ pub fn main(init: std.process.Init) !void {
5150 });
5251
5352 // name all unnamed regions
54- const region_names : [][]const u8 = try gpa .alloc ([]const u8 , parsed_args .memory_regions .len );
53+ const region_names : [][]const u8 = try arena .alloc ([]const u8 , parsed_args .memory_regions .len );
5554 {
5655 var counters : [5 ]usize = @splat (0 );
5756 for (region_names , parsed_args .memory_regions ) | * region_name , region | {
5857 if (region .name ) | name | {
59- region_name .* = try gpa .dupe (u8 , name );
58+ region_name .* = try arena .dupe (u8 , name );
6059 } else {
61- region_name .* = try std .fmt .allocPrint (gpa , "{s}{}" , .{
60+ region_name .* = try std .fmt .allocPrint (arena , "{s}{}" , .{
6261 @tagName (region .tag ),
6362 counters [@intFromEnum (region .tag )],
6463 });
@@ -249,7 +248,7 @@ pub fn main(init: std.process.Init) !void {
249248 \\
250249 , .{
251250 if (! parsed_args .ram_image )
252- try std .fmt .allocPrint (gpa , "{s} AT> {s}" , .{ ram_region_name , flash_region_name })
251+ try std .fmt .allocPrint (arena , "{s} AT> {s}" , .{ ram_region_name , flash_region_name })
253252 else
254253 ram_region_name ,
255254 ram_region_name ,
0 commit comments