| author | |
| committer | |
| log | 9adcc31ca3dafa4799984ceb3409a85501417288 |
| tree | 7ba7345c6a1d92d7e1eef2197c8759afac2c8e87 |
| parent | fadd268a609aefa155bbe5c7fe9d7c07956e9cda |
20 files changed, 55 insertions(+), 53 deletions(-)
lib/compiler/resinator/main.zig+7-3| ... | ... | @@ -164,13 +164,14 @@ pub fn main() !void { |
| 164 | 164 | } else { |
| 165 | 165 | switch (options.input_source) { |
| 166 | 166 | .stdio => |file| { |
| 167 | break :full_input file.readToEndAlloc(allocator, std.math.maxInt(usize)) catch |err| { | |
| 167 | var file_reader = file.reader(&.{}); | |
| 168 | break :full_input file_reader.interface.allocRemaining(allocator, .unlimited) catch |err| { | |
| 168 | 169 | try error_handler.emitMessage(allocator, .err, "unable to read input from stdin: {s}", .{@errorName(err)}); |
| 169 | 170 | std.process.exit(1); |
| 170 | 171 | }; |
| 171 | 172 | }, |
| 172 | 173 | .filename => |input_filename| { |
| 173 | break :full_input std.fs.cwd().readFileAlloc(allocator, input_filename, std.math.maxInt(usize)) catch |err| { | |
| 174 | break :full_input std.fs.cwd().readFileAlloc(input_filename, allocator, .unlimited) catch |err| { | |
| 174 | 175 | try error_handler.emitMessage(allocator, .err, "unable to read input file path '{s}': {s}", .{ input_filename, @errorName(err) }); |
| 175 | 176 | std.process.exit(1); |
| 176 | 177 | }; |
| ... | ... | @@ -462,7 +463,10 @@ const IoStream = struct { |
| 462 | 463 | pub fn readAll(self: Source, allocator: std.mem.Allocator) !Data { |
| 463 | 464 | return switch (self) { |
| 464 | 465 | inline .file, .stdio => |file| .{ |
| 465 | .bytes = try file.readToEndAlloc(allocator, std.math.maxInt(usize)), | |
| 466 | .bytes = b: { | |
| 467 | var file_reader = file.reader(&.{}); | |
| 468 | break :b try file_reader.interface.allocRemaining(allocator, .unlimited); | |
| 469 | }, | |
| 466 | 470 | .needs_free = true, |
| 467 | 471 | }, |
| 468 | 472 | .memory => |list| .{ .bytes = list.items, .needs_free = false }, |
test/src/check-stack-trace.zig+1-1| ... | ... | @@ -13,7 +13,7 @@ pub fn main() !void { |
| 13 | 13 | const input_path = args[1]; |
| 14 | 14 | const optimize_mode_text = args[2]; |
| 15 | 15 | |
| 16 | const input_bytes = try std.fs.cwd().readFileAlloc(arena, input_path, 5 * 1024 * 1024); | |
| 16 | const input_bytes = try std.fs.cwd().readFileAlloc(input_path, arena, .limited(5 * 1024 * 1024)); | |
| 17 | 17 | const optimize_mode = std.meta.stringToEnum(std.builtin.OptimizeMode, optimize_mode_text).?; |
| 18 | 18 | |
| 19 | 19 | var stderr = input_bytes; |
test/standalone/child_process/main.zig+2-1| ... | ... | @@ -32,7 +32,8 @@ pub fn main() !void { |
| 32 | 32 | |
| 33 | 33 | const hello_stdout = "hello from stdout"; |
| 34 | 34 | var buf: [hello_stdout.len]u8 = undefined; |
| 35 | const n = try child.stdout.?.deprecatedReader().readAll(&buf); | |
| 35 | var stdout_reader = child.stdout.?.reader(&.{}); | |
| 36 | const n = try stdout_reader.interface.readSliceShort(&buf); | |
| 36 | 37 | if (!std.mem.eql(u8, buf[0..n], hello_stdout)) { |
| 37 | 38 | testError("child stdout: '{s}'; want '{s}'", .{ buf[0..n], hello_stdout }); |
| 38 | 39 | } |
test/standalone/cmakedefine/check.zig+2-2| ... | ... | @@ -9,8 +9,8 @@ pub fn main() !void { |
| 9 | 9 | const actual_path = args[1]; |
| 10 | 10 | const expected_path = args[2]; |
| 11 | 11 | |
| 12 | const actual = try std.fs.cwd().readFileAlloc(arena, actual_path, 1024 * 1024); | |
| 13 | const expected = try std.fs.cwd().readFileAlloc(arena, expected_path, 1024 * 1024); | |
| 12 | const actual = try std.fs.cwd().readFileAlloc(actual_path, arena, .limited(1024 * 1024)); | |
| 13 | const expected = try std.fs.cwd().readFileAlloc(expected_path, arena, .limited(1024 * 1024)); | |
| 14 | 14 | |
| 15 | 15 | // The actual output starts with a comment which we should strip out before comparing. |
| 16 | 16 | const comment_str = "/* This file was generated by ConfigHeader using the Zig Build System. */\n"; |
test/standalone/entry_point/check_differ.zig+2-2| ... | ... | @@ -6,8 +6,8 @@ pub fn main() !void { |
| 6 | 6 | const args = try std.process.argsAlloc(arena); |
| 7 | 7 | if (args.len != 3) return error.BadUsage; // usage: 'check_differ <path a> <path b>' |
| 8 | 8 | |
| 9 | const contents_1 = try std.fs.cwd().readFileAlloc(arena, args[1], 1024 * 1024 * 64); // 64 MiB ought to be plenty | |
| 10 | const contents_2 = try std.fs.cwd().readFileAlloc(arena, args[2], 1024 * 1024 * 64); // 64 MiB ought to be plenty | |
| 9 | const contents_1 = try std.fs.cwd().readFileAlloc(args[1], arena, .limited(1024 * 1024 * 64)); // 64 MiB ought to be plenty | |
| 10 | const contents_2 = try std.fs.cwd().readFileAlloc(args[2], arena, .limited(1024 * 1024 * 64)); // 64 MiB ought to be plenty | |
| 11 | 11 | |
| 12 | 12 | if (std.mem.eql(u8, contents_1, contents_2)) { |
| 13 | 13 | return error.FilesMatch; |
tools/docgen.zig+4-5| ... | ... | @@ -77,7 +77,8 @@ pub fn main() !void { |
| 77 | 77 | var code_dir = try fs.cwd().openDir(code_dir_path, .{}); |
| 78 | 78 | defer code_dir.close(); |
| 79 | 79 | |
| 80 | const input_file_bytes = try in_file.deprecatedReader().readAllAlloc(arena, max_doc_file_size); | |
| 80 | var in_file_reader = in_file.reader(&.{}); | |
| 81 | const input_file_bytes = try in_file_reader.interface.allocRemaining(arena, .limited(max_doc_file_size)); | |
| 81 | 82 | |
| 82 | 83 | var tokenizer = Tokenizer.init(input_path, input_file_bytes); |
| 83 | 84 | var toc = try genToc(arena, &tokenizer); |
| ... | ... | @@ -1039,10 +1040,8 @@ fn genHtml( |
| 1039 | 1040 | }); |
| 1040 | 1041 | defer allocator.free(out_basename); |
| 1041 | 1042 | |
| 1042 | const contents = code_dir.readFileAlloc(allocator, out_basename, std.math.maxInt(u32)) catch |err| { | |
| 1043 | return parseError(tokenizer, code.token, "unable to open '{s}': {s}", .{ | |
| 1044 | out_basename, @errorName(err), | |
| 1045 | }); | |
| 1043 | const contents = code_dir.readFileAlloc(out_basename, allocator, .limited(std.math.maxInt(u32))) catch |err| { | |
| 1044 | return parseError(tokenizer, code.token, "unable to open '{s}': {t}", .{ out_basename, err }); | |
| 1046 | 1045 | }; |
| 1047 | 1046 | defer allocator.free(contents); |
| 1048 | 1047 |
tools/doctest.zig+1-1| ... | ... | @@ -70,7 +70,7 @@ pub fn main() !void { |
| 70 | 70 | const zig_path = opt_zig orelse fatal("missing zig compiler path (--zig)", .{}); |
| 71 | 71 | const cache_root = opt_cache_root orelse fatal("missing cache root path (--cache-root)", .{}); |
| 72 | 72 | |
| 73 | const source_bytes = try fs.cwd().readFileAlloc(arena, input_path, std.math.maxInt(u32)); | |
| 73 | const source_bytes = try fs.cwd().readFileAlloc(input_path, arena, .limited(std.math.maxInt(u32))); | |
| 74 | 74 | const code = try parseManifest(arena, source_bytes); |
| 75 | 75 | const source = stripManifest(source_bytes); |
| 76 | 76 |
tools/dump-cov.zig+2-3| ... | ... | @@ -38,10 +38,9 @@ pub fn main() !void { |
| 38 | 38 | defer debug_info.deinit(gpa); |
| 39 | 39 | |
| 40 | 40 | const cov_bytes = cov_path.root_dir.handle.readFileAllocOptions( |
| 41 | arena, | |
| 42 | 41 | cov_path.sub_path, |
| 43 | 1 << 30, | |
| 44 | null, | |
| 42 | arena, | |
| 43 | .limited(1 << 30), | |
| 45 | 44 | .of(SeenPcsHeader), |
| 46 | 45 | null, |
| 47 | 46 | ) catch |err| { |
tools/fetch_them_macos_headers.zig+3-3| ... | ... | @@ -1,6 +1,5 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const fs = std.fs; |
| 3 | const io = std.io; | |
| 4 | 3 | const mem = std.mem; |
| 5 | 4 | const process = std.process; |
| 6 | 5 | const assert = std.debug.assert; |
| ... | ... | @@ -93,7 +92,7 @@ pub fn main() anyerror!void { |
| 93 | 92 | |
| 94 | 93 | var sdk_dir = try std.fs.cwd().openDir(sysroot_path, .{}); |
| 95 | 94 | defer sdk_dir.close(); |
| 96 | const sdk_info = try sdk_dir.readFileAlloc(allocator, "SDKSettings.json", std.math.maxInt(u32)); | |
| 95 | const sdk_info = try sdk_dir.readFileAlloc("SDKSettings.json", allocator, .limited(std.math.maxInt(u32))); | |
| 97 | 96 | |
| 98 | 97 | const parsed_json = try std.json.parseFromSlice(struct { |
| 99 | 98 | DefaultProperties: struct { MACOSX_DEPLOYMENT_TARGET: []const u8 }, |
| ... | ... | @@ -198,7 +197,8 @@ fn fetchTarget( |
| 198 | 197 | var dirs = std.StringHashMap(fs.Dir).init(arena); |
| 199 | 198 | try dirs.putNoClobber(".", dest_dir); |
| 200 | 199 | |
| 201 | const headers_list_str = try headers_list_file.deprecatedReader().readAllAlloc(arena, std.math.maxInt(usize)); | |
| 200 | var headers_list_file_reader = headers_list_file.reader(&.{}); | |
| 201 | const headers_list_str = try headers_list_file_reader.interface.allocRemaining(arena, .unlimited); | |
| 202 | 202 | const prefix = "/usr/include"; |
| 203 | 203 | |
| 204 | 204 | var it = mem.splitScalar(u8, headers_list_str, '\n'); |
tools/gen_spirv_spec.zig+15-15| ... | ... | @@ -136,7 +136,7 @@ fn readExtRegistry(exts: *std.array_list.Managed(Extension), dir: std.fs.Dir, su |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | fn readRegistry(comptime RegistryType: type, dir: std.fs.Dir, path: []const u8) !RegistryType { |
| 139 | const spec = try dir.readFileAlloc(allocator, path, std.math.maxInt(usize)); | |
| 139 | const spec = try dir.readFileAlloc(path, allocator, .unlimited); | |
| 140 | 140 | // Required for json parsing. |
| 141 | 141 | // TODO: ALI |
| 142 | 142 | @setEvalBranchQuota(10000); |
| ... | ... | @@ -189,7 +189,7 @@ fn tagPriorityScore(tag: []const u8) usize { |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | fn render( |
| 192 | writer: *std.io.Writer, | |
| 192 | writer: *std.Io.Writer, | |
| 193 | 193 | registry: CoreRegistry, |
| 194 | 194 | extensions: []const Extension, |
| 195 | 195 | ) !void { |
| ... | ... | @@ -214,7 +214,7 @@ fn render( |
| 214 | 214 | \\ none, |
| 215 | 215 | \\ _, |
| 216 | 216 | \\ |
| 217 | \\ pub fn format(self: Id, writer: *std.io.Writer) std.io.Writer.Error!void { | |
| 217 | \\ pub fn format(self: Id, writer: *std.Io.Writer) std.Io.Writer.Error!void { | |
| 218 | 218 | \\ switch (self) { |
| 219 | 219 | \\ .none => try writer.writeAll("(none)"), |
| 220 | 220 | \\ else => try writer.print("%{d}", .{@intFromEnum(self)}), |
| ... | ... | @@ -327,7 +327,7 @@ fn render( |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | fn renderInstructionSet( |
| 330 | writer: *std.io.Writer, | |
| 330 | writer: *std.Io.Writer, | |
| 331 | 331 | core: CoreRegistry, |
| 332 | 332 | extensions: []const Extension, |
| 333 | 333 | all_operand_kinds: OperandKindMap, |
| ... | ... | @@ -362,7 +362,7 @@ fn renderInstructionSet( |
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | fn renderInstructionsCase( |
| 365 | writer: *std.io.Writer, | |
| 365 | writer: *std.Io.Writer, | |
| 366 | 366 | set_name: []const u8, |
| 367 | 367 | instructions: []const Instruction, |
| 368 | 368 | all_operand_kinds: OperandKindMap, |
| ... | ... | @@ -409,7 +409,7 @@ fn renderInstructionsCase( |
| 409 | 409 | ); |
| 410 | 410 | } |
| 411 | 411 | |
| 412 | fn renderClass(writer: *std.io.Writer, instructions: []const Instruction) !void { | |
| 412 | fn renderClass(writer: *std.Io.Writer, instructions: []const Instruction) !void { | |
| 413 | 413 | var class_map = std.StringArrayHashMap(void).init(allocator); |
| 414 | 414 | |
| 415 | 415 | for (instructions) |inst| { |
| ... | ... | @@ -427,7 +427,7 @@ fn renderClass(writer: *std.io.Writer, instructions: []const Instruction) !void |
| 427 | 427 | const Formatter = struct { |
| 428 | 428 | data: []const u8, |
| 429 | 429 | |
| 430 | fn format(f: Formatter, writer: *std.Io.Writer) std.io.Writer.Error!void { | |
| 430 | fn format(f: Formatter, writer: *std.Io.Writer) std.Io.Writer.Error!void { | |
| 431 | 431 | var id_buf: [128]u8 = undefined; |
| 432 | 432 | var fw: std.Io.Writer = .fixed(&id_buf); |
| 433 | 433 | for (f.data, 0..) |c, i| { |
| ... | ... | @@ -457,7 +457,7 @@ fn formatId(identifier: []const u8) std.fmt.Alt(Formatter, Formatter.format) { |
| 457 | 457 | return .{ .data = .{ .data = identifier } }; |
| 458 | 458 | } |
| 459 | 459 | |
| 460 | fn renderOperandKind(writer: *std.io.Writer, operands: []const OperandKind) !void { | |
| 460 | fn renderOperandKind(writer: *std.Io.Writer, operands: []const OperandKind) !void { | |
| 461 | 461 | try writer.writeAll( |
| 462 | 462 | \\pub const OperandKind = enum { |
| 463 | 463 | \\ opcode, |
| ... | ... | @@ -513,7 +513,7 @@ fn renderOperandKind(writer: *std.io.Writer, operands: []const OperandKind) !voi |
| 513 | 513 | try writer.writeAll("};\n}\n};\n"); |
| 514 | 514 | } |
| 515 | 515 | |
| 516 | fn renderEnumerant(writer: *std.io.Writer, enumerant: Enumerant) !void { | |
| 516 | fn renderEnumerant(writer: *std.Io.Writer, enumerant: Enumerant) !void { | |
| 517 | 517 | try writer.print(".{{.name = \"{s}\", .value = ", .{enumerant.enumerant}); |
| 518 | 518 | switch (enumerant.value) { |
| 519 | 519 | .bitflag => |flag| try writer.writeAll(flag), |
| ... | ... | @@ -530,7 +530,7 @@ fn renderEnumerant(writer: *std.io.Writer, enumerant: Enumerant) !void { |
| 530 | 530 | } |
| 531 | 531 | |
| 532 | 532 | fn renderOpcodes( |
| 533 | writer: *std.io.Writer, | |
| 533 | writer: *std.Io.Writer, | |
| 534 | 534 | opcode_type_name: []const u8, |
| 535 | 535 | want_operands: bool, |
| 536 | 536 | instructions: []const Instruction, |
| ... | ... | @@ -629,7 +629,7 @@ fn renderOpcodes( |
| 629 | 629 | } |
| 630 | 630 | |
| 631 | 631 | fn renderOperandKinds( |
| 632 | writer: *std.io.Writer, | |
| 632 | writer: *std.Io.Writer, | |
| 633 | 633 | kinds: []const OperandKind, |
| 634 | 634 | extended_structs: ExtendedStructSet, |
| 635 | 635 | ) !void { |
| ... | ... | @@ -643,7 +643,7 @@ fn renderOperandKinds( |
| 643 | 643 | } |
| 644 | 644 | |
| 645 | 645 | fn renderValueEnum( |
| 646 | writer: *std.io.Writer, | |
| 646 | writer: *std.Io.Writer, | |
| 647 | 647 | enumeration: OperandKind, |
| 648 | 648 | extended_structs: ExtendedStructSet, |
| 649 | 649 | ) !void { |
| ... | ... | @@ -721,7 +721,7 @@ fn renderValueEnum( |
| 721 | 721 | } |
| 722 | 722 | |
| 723 | 723 | fn renderBitEnum( |
| 724 | writer: *std.io.Writer, | |
| 724 | writer: *std.Io.Writer, | |
| 725 | 725 | enumeration: OperandKind, |
| 726 | 726 | extended_structs: ExtendedStructSet, |
| 727 | 727 | ) !void { |
| ... | ... | @@ -804,7 +804,7 @@ fn renderBitEnum( |
| 804 | 804 | } |
| 805 | 805 | |
| 806 | 806 | fn renderOperand( |
| 807 | writer: *std.io.Writer, | |
| 807 | writer: *std.Io.Writer, | |
| 808 | 808 | kind: enum { |
| 809 | 809 | @"union", |
| 810 | 810 | instruction, |
| ... | ... | @@ -888,7 +888,7 @@ fn renderOperand( |
| 888 | 888 | try writer.writeAll(",\n"); |
| 889 | 889 | } |
| 890 | 890 | |
| 891 | fn renderFieldName(writer: *std.io.Writer, operands: []const Operand, field_index: usize) !void { | |
| 891 | fn renderFieldName(writer: *std.Io.Writer, operands: []const Operand, field_index: usize) !void { | |
| 892 | 892 | const operand = operands[field_index]; |
| 893 | 893 | |
| 894 | 894 | derive_from_kind: { |
tools/gen_stubs.zig+2-3| ... | ... | @@ -299,10 +299,9 @@ pub fn main() !void { |
| 299 | 299 | |
| 300 | 300 | // Read the ELF header. |
| 301 | 301 | const elf_bytes = build_all_dir.readFileAllocOptions( |
| 302 | arena, | |
| 303 | 302 | libc_so_path, |
| 304 | 100 * 1024 * 1024, | |
| 305 | 1 * 1024 * 1024, | |
| 303 | arena, | |
| 304 | .limited(100 * 1024 * 1024), | |
| 306 | 305 | .of(elf.Elf64_Ehdr), |
| 307 | 306 | null, |
| 308 | 307 | ) catch |err| { |
tools/generate_JSONTestSuite.zig+1-1| ... | ... | @@ -32,7 +32,7 @@ pub fn main() !void { |
| 32 | 32 | }).lessThan); |
| 33 | 33 | |
| 34 | 34 | for (names.items) |name| { |
| 35 | const contents = try std.fs.cwd().readFileAlloc(allocator, name, 250001); | |
| 35 | const contents = try std.fs.cwd().readFileAlloc(name, allocator, .limited(250001)); | |
| 36 | 36 | try output.writeAll("test "); |
| 37 | 37 | try writeString(output, name); |
| 38 | 38 | try output.writeAll(" {\n try "); |
tools/generate_linux_syscalls.zig+1-1| ... | ... | @@ -248,7 +248,7 @@ pub fn main() !void { |
| 248 | 248 | try Io.Writer.flush(stdout); |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | fn usage(w: *std.io.Writer, arg0: []const u8) std.io.Writer.Error!void { | |
| 251 | fn usage(w: *std.Io.Writer, arg0: []const u8) std.Io.Writer.Error!void { | |
| 252 | 252 | try w.print( |
| 253 | 253 | \\Usage: {s} /path/to/zig /path/to/linux |
| 254 | 254 | \\Alternative Usage: zig run /path/to/git/zig/tools/generate_linux_syscalls.zig -- /path/to/zig /path/to/linux |
tools/incr-check.zig+2-2| ... | ... | @@ -52,7 +52,7 @@ pub fn main() !void { |
| 52 | 52 | const zig_exe = opt_zig_exe orelse fatal("missing path to zig\n{s}", .{usage}); |
| 53 | 53 | const input_file_name = opt_input_file_name orelse fatal("missing input file\n{s}", .{usage}); |
| 54 | 54 | |
| 55 | const input_file_bytes = try std.fs.cwd().readFileAlloc(arena, input_file_name, std.math.maxInt(u32)); | |
| 55 | const input_file_bytes = try std.fs.cwd().readFileAlloc(input_file_name, arena, .limited(std.math.maxInt(u32))); | |
| 56 | 56 | const case = try Case.parse(arena, input_file_bytes); |
| 57 | 57 | |
| 58 | 58 | // Check now: if there are any targets using the `cbe` backend, we need the lib dir. |
| ... | ... | @@ -226,7 +226,7 @@ const Eval = struct { |
| 226 | 226 | cc_child_args: *std.ArrayListUnmanaged([]const u8), |
| 227 | 227 | |
| 228 | 228 | const StreamEnum = enum { stdout, stderr }; |
| 229 | const Poller = std.io.Poller(StreamEnum); | |
| 229 | const Poller = std.Io.Poller(StreamEnum); | |
| 230 | 230 | |
| 231 | 231 | /// Currently this function assumes the previous updates have already been written. |
| 232 | 232 | fn write(eval: *Eval, update: Case.Update) void { |
tools/migrate_langref.zig+2-2| ... | ... | @@ -1,6 +1,5 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | const io = std.io; | |
| 4 | 3 | const fs = std.fs; |
| 5 | 4 | const print = std.debug.print; |
| 6 | 5 | const mem = std.mem; |
| ... | ... | @@ -29,7 +28,8 @@ pub fn main() !void { |
| 29 | 28 | var out_dir = try fs.cwd().openDir(fs.path.dirname(output_file).?, .{}); |
| 30 | 29 | defer out_dir.close(); |
| 31 | 30 | |
| 32 | const input_file_bytes = try in_file.deprecatedReader().readAllAlloc(arena, std.math.maxInt(u32)); | |
| 31 | var in_file_reader = in_file.reader(&.{}); | |
| 32 | const input_file_bytes = try in_file_reader.interface.allocRemaining(arena, .unlimited); | |
| 33 | 33 | |
| 34 | 34 | var tokenizer = Tokenizer.init(input_file, input_file_bytes); |
| 35 | 35 |
tools/process_headers.zig+1-1| ... | ... | @@ -254,7 +254,7 @@ pub fn main() !void { |
| 254 | 254 | .file, .sym_link => { |
| 255 | 255 | const rel_path = try std.fs.path.relative(allocator, target_include_dir, full_path); |
| 256 | 256 | const max_size = 2 * 1024 * 1024 * 1024; |
| 257 | const raw_bytes = try std.fs.cwd().readFileAlloc(allocator, full_path, max_size); | |
| 257 | const raw_bytes = try std.fs.cwd().readFileAlloc(full_path, allocator, .limited(max_size)); | |
| 258 | 258 | const trimmed = std.mem.trim(u8, raw_bytes, " \r\n\t"); |
| 259 | 259 | total_bytes += raw_bytes.len; |
| 260 | 260 | const hash = try allocator.alloc(u8, 32); |
tools/update-linux-headers.zig+1-1| ... | ... | @@ -206,7 +206,7 @@ pub fn main() !void { |
| 206 | 206 | .file => { |
| 207 | 207 | const rel_path = try std.fs.path.relative(arena, target_include_dir, full_path); |
| 208 | 208 | const max_size = 2 * 1024 * 1024 * 1024; |
| 209 | const raw_bytes = try std.fs.cwd().readFileAlloc(arena, full_path, max_size); | |
| 209 | const raw_bytes = try std.fs.cwd().readFileAlloc(full_path, arena, .limited(max_size)); | |
| 210 | 210 | const trimmed = std.mem.trim(u8, raw_bytes, " \r\n\t"); |
| 211 | 211 | total_bytes += raw_bytes.len; |
| 212 | 212 | const hash = try arena.alloc(u8, 32); |
tools/update_clang_options.zig+1-1| ... | ... | @@ -965,7 +965,7 @@ fn printUsageAndExit(arg0: []const u8) noreturn { |
| 965 | 965 | std.process.exit(1); |
| 966 | 966 | } |
| 967 | 967 | |
| 968 | fn printUsage(w: *std.io.Writer, arg0: []const u8) std.io.Writer.Error!void { | |
| 968 | fn printUsage(w: *std.Io.Writer, arg0: []const u8) std.Io.Writer.Error!void { | |
| 969 | 969 | try w.print( |
| 970 | 970 | \\Usage: {s} /path/to/llvm-tblgen /path/to/git/llvm/llvm-project |
| 971 | 971 | \\Alternative Usage: zig run /path/to/git/zig/tools/update_clang_options.zig -- /path/to/llvm-tblgen /path/to/git/llvm/llvm-project |
tools/update_crc_catalog.zig+1-1| ... | ... | @@ -194,7 +194,7 @@ fn printUsageAndExit(arg0: []const u8) noreturn { |
| 194 | 194 | std.process.exit(1); |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | fn printUsage(w: *std.io.Writer, arg0: []const u8) std.io.Writer.Error!void { | |
| 197 | fn printUsage(w: *std.Io.Writer, arg0: []const u8) std.Io.Writer.Error!void { | |
| 198 | 198 | return w.print( |
| 199 | 199 | \\Usage: {s} /path/git/zig |
| 200 | 200 | \\ |
tools/update_glibc.zig+4-4| ... | ... | @@ -116,9 +116,9 @@ pub fn main() !void { |
| 116 | 116 | const max_file_size = 10 * 1024 * 1024; |
| 117 | 117 | |
| 118 | 118 | const generic_glibc_contents = generic_glibc_dir.readFileAlloc( |
| 119 | arena, | |
| 120 | 119 | entry.path, |
| 121 | max_file_size, | |
| 120 | arena, | |
| 121 | .limited(max_file_size), | |
| 122 | 122 | ) catch |err| switch (err) { |
| 123 | 123 | error.FileNotFound => continue, |
| 124 | 124 | else => |e| fatal("unable to load '{s}/include/{s}': {s}", .{ |
| ... | ... | @@ -126,9 +126,9 @@ pub fn main() !void { |
| 126 | 126 | }), |
| 127 | 127 | }; |
| 128 | 128 | const glibc_include_contents = include_dir.readFileAlloc( |
| 129 | arena, | |
| 130 | 129 | entry.path, |
| 131 | max_file_size, | |
| 130 | arena, | |
| 131 | .limited(max_file_size), | |
| 132 | 132 | ) catch |err| { |
| 133 | 133 | fatal("unable to load '{s}/include/{s}': {s}", .{ |
| 134 | 134 | dest_dir_path, entry.path, @errorName(err), |