diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2025-08-29 20:49:18 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2025-08-30 00:48:50 -0700 |
| commit | 9adcc31ca3dafa4799984ceb3409a85501417288 (patch) | |
| tree | 7ba7345c6a1d92d7e1eef2197c8759afac2c8e87 /lib | |
| parent | fadd268a609aefa155bbe5c7fe9d7c07956e9cda (diff) | |
| download | zig-9adcc31ca3dafa4799984ceb3409a85501417288.tar.gz zig-9adcc31ca3dafa4799984ceb3409a85501417288.zip | |
update tools and other miscellaneous things to new APIs
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/compiler/resinator/main.zig | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/compiler/resinator/main.zig b/lib/compiler/resinator/main.zig index c0e7aad3cb..1d87f21d2b 100644 --- a/lib/compiler/resinator/main.zig +++ b/lib/compiler/resinator/main.zig @@ -164,13 +164,14 @@ pub fn main() !void { } else { switch (options.input_source) { .stdio => |file| { - break :full_input file.readToEndAlloc(allocator, std.math.maxInt(usize)) catch |err| { + var file_reader = file.reader(&.{}); + break :full_input file_reader.interface.allocRemaining(allocator, .unlimited) catch |err| { try error_handler.emitMessage(allocator, .err, "unable to read input from stdin: {s}", .{@errorName(err)}); std.process.exit(1); }; }, .filename => |input_filename| { - break :full_input std.fs.cwd().readFileAlloc(allocator, input_filename, std.math.maxInt(usize)) catch |err| { + break :full_input std.fs.cwd().readFileAlloc(input_filename, allocator, .unlimited) catch |err| { try error_handler.emitMessage(allocator, .err, "unable to read input file path '{s}': {s}", .{ input_filename, @errorName(err) }); std.process.exit(1); }; @@ -462,7 +463,10 @@ const IoStream = struct { pub fn readAll(self: Source, allocator: std.mem.Allocator) !Data { return switch (self) { inline .file, .stdio => |file| .{ - .bytes = try file.readToEndAlloc(allocator, std.math.maxInt(usize)), + .bytes = b: { + var file_reader = file.reader(&.{}); + break :b try file_reader.interface.allocRemaining(allocator, .unlimited); + }, .needs_free = true, }, .memory => |list| .{ .bytes = list.items, .needs_free = false }, |
