Skip to content

Commit b05f224

Browse files
committed
fixups on readFileAllocZ
1 parent ff75fa6 commit b05f224

2 files changed

Lines changed: 8 additions & 11 deletions

File tree

src/buildrunner/BuildSerialize.zig

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -329,13 +329,10 @@ else
329329

330330
pub fn minimumZigVersion(b: *Build) !?[]const u8 {
331331
const zon_path = try std.fs.path.join(b.allocator, &.{ b.build_root.path.?, "build.zig.zon" });
332-
const zon_file = std.fs.cwd().readFileAllocOptions(
333-
b.allocator,
332+
const zon_file = @import("zonparse.zig").cwdReadFileAllocZ(
334333
zon_path,
334+
b.allocator,
335335
std.math.maxInt(u32),
336-
null,
337-
align_one,
338-
0,
339336
) catch |err| switch (err) {
340337
error.FileNotFound => return null,
341338
else => return err,

src/buildrunner/zonparse.zig

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,20 @@ pub fn cwdReadFileAllocZ(
4242
max_bytes: usize,
4343
) ![:0]const u8 {
4444
const cwd = std.fs.cwd();
45-
if (comptime later_than_zig_15) {
45+
if (comptime later_than_zig_14) {
4646
return cwd.readFileAllocOptions(
47-
subpath,
4847
allocator,
49-
std.Io.Limit.limited(max_bytes),
48+
subpath,
49+
max_bytes,
50+
null,
5051
align_one,
5152
0,
5253
);
5354
} else {
5455
return cwd.readFileAllocOptions(
55-
allocator,
5656
subpath,
57-
max_bytes,
58-
null,
57+
allocator,
58+
std.Io.Limit.limited(max_bytes),
5959
align_one,
6060
0,
6161
);

0 commit comments

Comments
 (0)