aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Compilation.zig2
-rw-r--r--src/Package/Fetch.zig5
-rw-r--r--src/Package/Fetch/git.zig4
-rw-r--r--src/link/MachO.zig2
-rw-r--r--src/link/MachO/dyld_info/bind.zig2
-rw-r--r--src/main.zig11
-rw-r--r--src/print_targets.zig4
7 files changed, 14 insertions, 16 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index 12749cd8b5..8645ed42fe 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -6576,7 +6576,7 @@ fn updateWin32Resource(comp: *Compilation, win32_resource: *Win32Resource, win32
// Read depfile and update cache manifest
{
const dep_basename = fs.path.basename(out_dep_path);
- const dep_file_contents = try zig_cache_tmp_dir.readFileAlloc(arena, dep_basename, 50 * 1024 * 1024);
+ const dep_file_contents = try zig_cache_tmp_dir.readFileAlloc(dep_basename, arena, .limited(50 * 1024 * 1024));
defer arena.free(dep_file_contents);
const value = try std.json.parseFromSliceLeaky(std.json.Value, arena, dep_file_contents, .{});
diff --git a/src/Package/Fetch.zig b/src/Package/Fetch.zig
index 18f9a48618..d729a61876 100644
--- a/src/Package/Fetch.zig
+++ b/src/Package/Fetch.zig
@@ -655,10 +655,9 @@ fn loadManifest(f: *Fetch, pkg_root: Cache.Path) RunError!void {
const eb = &f.error_bundle;
const arena = f.arena.allocator();
const manifest_bytes = pkg_root.root_dir.handle.readFileAllocOptions(
- arena,
try fs.path.join(arena, &.{ pkg_root.sub_path, Manifest.basename }),
- Manifest.max_bytes,
- null,
+ arena,
+ .limited(Manifest.max_bytes),
.@"1",
0,
) catch |err| switch (err) {
diff --git a/src/Package/Fetch/git.zig b/src/Package/Fetch/git.zig
index c82a5ab078..df0366c783 100644
--- a/src/Package/Fetch/git.zig
+++ b/src/Package/Fetch/git.zig
@@ -1599,7 +1599,7 @@ fn runRepositoryTest(comptime format: Oid.Format, head_commit: []const u8) !void
const max_file_size = 8192;
if (!skip_checksums) {
- const index_file_data = try git_dir.dir.readFileAlloc(testing.allocator, "testrepo.idx", max_file_size);
+ const index_file_data = try git_dir.dir.readFileAlloc("testrepo.idx", testing.allocator, .limited(max_file_size));
defer testing.allocator.free(index_file_data);
// testrepo.idx is generated by Git. The index created by this file should
// match it exactly. Running `git verify-pack -v testrepo.pack` can verify
@@ -1675,7 +1675,7 @@ fn runRepositoryTest(comptime format: Oid.Format, head_commit: []const u8) !void
\\revision 19
\\
;
- const actual_file_contents = try worktree.dir.readFileAlloc(testing.allocator, "file", max_file_size);
+ const actual_file_contents = try worktree.dir.readFileAlloc("file", testing.allocator, .limited(max_file_size));
defer testing.allocator.free(actual_file_contents);
try testing.expectEqualStrings(expected_file_contents, actual_file_contents);
}
diff --git a/src/link/MachO.zig b/src/link/MachO.zig
index 43be35994f..d8c4a20767 100644
--- a/src/link/MachO.zig
+++ b/src/link/MachO.zig
@@ -4361,7 +4361,7 @@ fn inferSdkVersion(comp: *Compilation, sdk_layout: SdkLayout) ?std.SemanticVersi
// The file/property is also available with vendored libc.
fn readSdkVersionFromSettings(arena: Allocator, dir: []const u8) ![]const u8 {
const sdk_path = try fs.path.join(arena, &.{ dir, "SDKSettings.json" });
- const contents = try fs.cwd().readFileAlloc(arena, sdk_path, std.math.maxInt(u16));
+ const contents = try fs.cwd().readFileAlloc(sdk_path, arena, .limited(std.math.maxInt(u16)));
const parsed = try std.json.parseFromSlice(std.json.Value, arena, contents, .{});
if (parsed.value.object.get("MinimalDisplayName")) |ver| return ver.string;
return error.SdkVersionFailure;
diff --git a/src/link/MachO/dyld_info/bind.zig b/src/link/MachO/dyld_info/bind.zig
index dc3c17ebee..12f8dc0a76 100644
--- a/src/link/MachO/dyld_info/bind.zig
+++ b/src/link/MachO/dyld_info/bind.zig
@@ -647,7 +647,7 @@ fn setDylibOrdinal(ordinal: i16, writer: *std.Io.Writer) !void {
fn setAddend(addend: i64, writer: *std.Io.Writer) !void {
log.debug(">>> set addend: {x}", .{addend});
try writer.writeByte(macho.BIND_OPCODE_SET_ADDEND_SLEB);
- try std.leb.writeIleb128(writer, addend);
+ try writer.writeSleb128(addend);
}
fn doBind(writer: *std.Io.Writer) !void {
diff --git a/src/main.zig b/src/main.zig
index 724db944be..da27b70668 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -5443,7 +5443,7 @@ fn cmdBuild(gpa: Allocator, arena: Allocator, args: []const []const u8) !void {
// that are missing.
const s = fs.path.sep_str;
const tmp_sub_path = "tmp" ++ s ++ results_tmp_file_nonce;
- const stdout = dirs.local_cache.handle.readFileAlloc(arena, tmp_sub_path, 50 * 1024 * 1024) catch |err| {
+ const stdout = dirs.local_cache.handle.readFileAlloc(tmp_sub_path, arena, .limited(50 * 1024 * 1024)) catch |err| {
fatal("unable to read results of configure phase from '{f}{s}': {s}", .{
dirs.local_cache, tmp_sub_path, @errorName(err),
});
@@ -5826,7 +5826,7 @@ const ArgIteratorResponseFile = process.ArgIteratorGeneral(.{ .comments = true,
/// Initialize the arguments from a Response File. "*.rsp"
fn initArgIteratorResponseFile(allocator: Allocator, resp_file_path: []const u8) !ArgIteratorResponseFile {
const max_bytes = 10 * 1024 * 1024; // 10 MiB of command line arguments is a reasonable limit
- const cmd_line = try fs.cwd().readFileAlloc(allocator, resp_file_path, max_bytes);
+ const cmd_line = try fs.cwd().readFileAlloc(resp_file_path, allocator, .limited(max_bytes));
errdefer allocator.free(cmd_line);
return ArgIteratorResponseFile.initTakeOwnership(allocator, cmd_line);
@@ -7350,10 +7350,9 @@ fn loadManifest(
) !struct { Package.Manifest, Ast } {
const manifest_bytes = while (true) {
break options.dir.readFileAllocOptions(
- arena,
Package.Manifest.basename,
- Package.Manifest.max_bytes,
- null,
+ arena,
+ .limited(Package.Manifest.max_bytes),
.@"1",
0,
) catch |err| switch (err) {
@@ -7435,7 +7434,7 @@ const Templates = struct {
}
const max_bytes = 10 * 1024 * 1024;
- const contents = templates.dir.readFileAlloc(arena, template_path, max_bytes) catch |err| {
+ const contents = templates.dir.readFileAlloc(template_path, arena, .limited(max_bytes)) catch |err| {
fatal("unable to read template file '{s}': {s}", .{ template_path, @errorName(err) });
};
templates.buffer.clearRetainingCapacity();
diff --git a/src/print_targets.zig b/src/print_targets.zig
index cc3f8fc5ea..d9118b901b 100644
--- a/src/print_targets.zig
+++ b/src/print_targets.zig
@@ -24,9 +24,9 @@ pub fn cmdTargets(
defer allocator.free(zig_lib_directory.path.?);
const abilists_contents = zig_lib_directory.handle.readFileAlloc(
- allocator,
glibc.abilists_path,
- glibc.abilists_max_size,
+ allocator,
+ .limited(glibc.abilists_max_size),
) catch |err| switch (err) {
error.OutOfMemory => return error.OutOfMemory,
else => fatal("unable to read " ++ glibc.abilists_path ++ ": {s}", .{@errorName(err)}),