| author | |
| committer | |
| log | 36dd7e9c375d73e73a1717a451943579a4694c2e |
| tree | ba750654873c7937ef9ac94b69d422d77f5d8377 |
| parent | 8bb70dbc3f0bb7a33c7fde534ca1661f169c0989 |
This PR doesn't touch usages inside `lib/compiler/aro`
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/36263
Reviewed-by: Ryan Liptak <squeek502@noreply.codeberg.org>59 files changed, 118 insertions(+), 118 deletions(-)
doc/langref/test_slices.zig+2-2| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const expectEqual = std.testing.expectEqual; |
| 3 | 3 | const expectEqualStrings = std.testing.expectEqualStrings; |
| 4 | const fmt = std.fmt; | |
| 4 | const mem = std.mem; | |
| 5 | 5 | |
| 6 | 6 | test "using slices for strings" { |
| 7 | 7 | // Zig has no concept of strings. String literals are const pointers |
| ... | ... | @@ -18,7 +18,7 @@ test "using slices for strings" { |
| 18 | 18 | _ = &start; |
| 19 | 19 | const all_together_slice = all_together[start..]; |
| 20 | 20 | // String concatenation example. |
| 21 | const hello_world = try fmt.bufPrint(all_together_slice, "{s} {s}", .{ hello, world }); | |
| 21 | const hello_world = try mem.print(all_together_slice, "{s} {s}", .{ hello, world }); | |
| 22 | 22 | |
| 23 | 23 | // Generally, you can use UTF-8 and not worry about whether something is a |
| 24 | 24 | // string. If you don't need to deal with individual characters, no need |
lib/build-web/main.zig+2-2| ... | ... | @@ -56,7 +56,7 @@ fn logFn( |
| 56 | 56 | const level_txt = comptime message_level.asText(); |
| 57 | 57 | const prefix2 = if (scope == .default) ": " else "(" ++ @tagName(scope) ++ "): "; |
| 58 | 58 | var buf: [500]u8 = undefined; |
| 59 | const line = std.fmt.bufPrint(&buf, level_txt ++ prefix2 ++ format, args) catch l: { | |
| 59 | const line = std.mem.print(&buf, level_txt ++ prefix2 ++ format, args) catch l: { | |
| 60 | 60 | buf[buf.len - 3 ..][0..3].* = "...".*; |
| 61 | 61 | break :l &buf; |
| 62 | 62 | }; |
| ... | ... | @@ -116,7 +116,7 @@ pub fn Slice(T: type) type { |
| 116 | 116 | |
| 117 | 117 | pub fn fatal(comptime format: []const u8, args: anytype) noreturn { |
| 118 | 118 | var buf: [500]u8 = undefined; |
| 119 | const line = std.fmt.bufPrint(&buf, format, args) catch l: { | |
| 119 | const line = std.mem.print(&buf, format, args) catch l: { | |
| 120 | 120 | buf[buf.len - 3 ..][0..3].* = "...".*; |
| 121 | 121 | break :l &buf; |
| 122 | 122 | }; |
lib/compiler/Maker.zig+1-1| ... | ... | @@ -959,7 +959,7 @@ pub fn main(init: process.Init.Minimal) !void { |
| 959 | 959 | // trigger a rebuild on all steps with modified inputs, as well as their |
| 960 | 960 | // recursive dependants. |
| 961 | 961 | var caption_buf: [std.Progress.Node.max_name_len]u8 = undefined; |
| 962 | const caption = std.fmt.bufPrint(&caption_buf, "watching {d} directories, {d} processes", .{ | |
| 962 | const caption = std.mem.print(&caption_buf, "watching {d} directories, {d} processes", .{ | |
| 963 | 963 | w.dir_count, countSubProcesses(&maker), |
| 964 | 964 | }) catch &caption_buf; |
| 965 | 965 | var debouncing_node = main_progress_node.start(caption, 0); |
lib/compiler/Maker/Fetch.zig+2-2| ... | ... | @@ -362,7 +362,7 @@ pub const JobQueue = struct { |
| 362 | 362 | var dest_sub_path_buf: ["p/".len + Package.Hash.max_len + ".tar.gz".len]u8 = undefined; |
| 363 | 363 | const dest_path: Path = .{ |
| 364 | 364 | .root_dir = jq.global_cache, |
| 365 | .sub_path = std.fmt.bufPrint(&dest_sub_path_buf, "p/{s}.tar.gz", .{pkg_hash_slice}) catch unreachable, | |
| 365 | .sub_path = std.mem.print(&dest_sub_path_buf, "p/{s}.tar.gz", .{pkg_hash_slice}) catch unreachable, | |
| 366 | 366 | }; |
| 367 | 367 | |
| 368 | 368 | const gpa = jq.http_client.allocator; |
| ... | ... | @@ -843,7 +843,7 @@ pub fn computedPackageHash(f: *const Fetch) Package.Hash { |
| 843 | 843 | if (f.have_manifest) { |
| 844 | 844 | const man = &f.manifest; |
| 845 | 845 | var version_buffer: [32]u8 = undefined; |
| 846 | const version: []const u8 = std.fmt.bufPrint(&version_buffer, "{f}", .{man.version}) catch &version_buffer; | |
| 846 | const version: []const u8 = std.mem.print(&version_buffer, "{f}", .{man.version}) catch &version_buffer; | |
| 847 | 847 | return .init(f.computed_hash.digest, man.name, version, man.id, saturated_size); |
| 848 | 848 | } |
| 849 | 849 | // In the future build.zig.zon fields will be added to allow overriding these values |
lib/compiler/Maker/Fetch/git.zig+1-1| ... | ... | @@ -1008,7 +1008,7 @@ pub const Session = struct { |
| 1008 | 1008 | } |
| 1009 | 1009 | for (wants) |want| { |
| 1010 | 1010 | var buf: [Packet.max_data_length]u8 = undefined; |
| 1011 | const arg = std.fmt.bufPrint(&buf, "want {s}\n", .{want}) catch unreachable; | |
| 1011 | const arg = std.mem.print(&buf, "want {s}\n", .{want}) catch unreachable; | |
| 1012 | 1012 | try Packet.write(.{ .data = arg }, &body); |
| 1013 | 1013 | } |
| 1014 | 1014 | try Packet.write(.{ .data = "done\n" }, &body); |
lib/compiler/Maker/Package.zig+1-1| ... | ... | @@ -130,7 +130,7 @@ pub const Hash = struct { |
| 130 | 130 | } |
| 131 | 131 | var bin_digest: [Algo.digest_length]u8 = undefined; |
| 132 | 132 | Algo.hash(sub_path, &bin_digest, .{}); |
| 133 | _ = std.fmt.bufPrint(result.bytes[i..], "{x}", .{&bin_digest}) catch unreachable; | |
| 133 | _ = std.mem.print(result.bytes[i..], "{x}", .{&bin_digest}) catch unreachable; | |
| 134 | 134 | return result; |
| 135 | 135 | } |
| 136 | 136 |
lib/compiler/Maker/Step/Compile.zig+1-1| ... | ... | @@ -892,7 +892,7 @@ fn lowerZigArgs( |
| 892 | 892 | var args_hash: [Sha256.digest_length]u8 = undefined; |
| 893 | 893 | Sha256.hash(args, &args_hash, .{}); |
| 894 | 894 | var args_hex_hash: [Sha256.digest_length * 2]u8 = undefined; |
| 895 | _ = std.fmt.bufPrint(&args_hex_hash, "{x}", .{&args_hash}) catch unreachable; | |
| 895 | _ = std.mem.print(&args_hex_hash, "{x}", .{&args_hash}) catch unreachable; | |
| 896 | 896 | |
| 897 | 897 | const args_file = "args" ++ Dir.path.sep_str ++ args_hex_hash; |
| 898 | 898 | local_cache_root.handle.access(io, args_file, .{}) catch { |
lib/compiler/Maker/Step/Run.zig+1-1| ... | ... | @@ -971,7 +971,7 @@ const FuzzTestRunner = struct { |
| 971 | 971 | i += 1; |
| 972 | 972 | }) { |
| 973 | 973 | const name_prefix = "f" ++ Dir.path.sep_str ++ "in"; |
| 974 | in_name = std.fmt.bufPrint(&in_name_buf, name_prefix ++ "{x}", .{i}) catch unreachable; | |
| 974 | in_name = std.mem.print(&in_name_buf, name_prefix ++ "{x}", .{i}) catch unreachable; | |
| 975 | 975 | in_f = cache_root.handle.openFile(io, in_name, .{ |
| 976 | 976 | .lock = .exclusive, |
| 977 | 977 | .lock_nonblocking = true, |
lib/compiler/Maker/Watch.zig+1-1| ... | ... | @@ -145,7 +145,7 @@ const Os = switch (builtin.os.tag) { |
| 145 | 145 | fn getDirHandle(gpa: Allocator, path: std.Build.Cache.Path, mount_id: *MountId) !FileHandle { |
| 146 | 146 | var file_handle_buffer: [@sizeOf(std.os.linux.file_handle) + 128]u8 align(@alignOf(std.os.linux.file_handle)) = undefined; |
| 147 | 147 | var buf: [std.fs.max_path_bytes]u8 = undefined; |
| 148 | const adjusted_path = if (path.sub_path.len == 0) "./" else std.fmt.bufPrint(&buf, "{s}/", .{ | |
| 148 | const adjusted_path = if (path.sub_path.len == 0) "./" else std.mem.print(&buf, "{s}/", .{ | |
| 149 | 149 | path.sub_path, |
| 150 | 150 | }) catch return error.NameTooLong; |
| 151 | 151 | const stack_ptr: *std.os.linux.file_handle = @ptrCast(&file_handle_buffer); |
lib/compiler/objcopy.zig+1-1| ... | ... | @@ -615,7 +615,7 @@ const HexWriter = struct { |
| 615 | 615 | const payload_bytes = self.getPayloadBytes(); |
| 616 | 616 | assert(payload_bytes.len <= max_payload_len); |
| 617 | 617 | |
| 618 | const line = try std.fmt.bufPrint(&outbuf, ":{0X:0>2}{1X:0>4}{2X:0>2}{3X}{4X:0>2}" ++ linesep, .{ | |
| 618 | const line = try std.mem.print(&outbuf, ":{0X:0>2}{1X:0>4}{2X:0>2}{3X}{4X:0>2}" ++ linesep, .{ | |
| 619 | 619 | @as(u8, @intCast(payload_bytes.len)), |
| 620 | 620 | self.address, |
| 621 | 621 | @backingInt(self.payload), |
lib/compiler/resinator/cvtres.zig+1-1| ... | ... | @@ -883,7 +883,7 @@ const ResourceTree = struct { |
| 883 | 883 | std.mem.writeInt(u32, name_buf[0..4], 0, .little); |
| 884 | 884 | std.mem.writeInt(u32, name_buf[4..8], string_table_offset, .little); |
| 885 | 885 | } else { |
| 886 | const name_slice = std.fmt.bufPrint(&name_buf, "$R{X:0>6}", .{relocation.data_offset}) catch unreachable; | |
| 886 | const name_slice = std.mem.print(&name_buf, "$R{X:0>6}", .{relocation.data_offset}) catch unreachable; | |
| 887 | 887 | std.debug.assert(name_slice.len == 8); |
| 888 | 888 | } |
| 889 | 889 |
lib/compiler/translate-c/MacroTranslator.zig+1-1| ... | ... | @@ -583,7 +583,7 @@ fn escapeUnprintables(mt: *MacroTranslator) ![]const u8 { |
| 583 | 583 | const formatter = std.ascii.hexEscape(zigified, .lower); |
| 584 | 584 | const encoded_size = @as(usize, @intCast(std.fmt.count("{f}", .{formatter}))); |
| 585 | 585 | const output = try mt.t.arena.alloc(u8, encoded_size); |
| 586 | return std.fmt.bufPrint(output, "{f}", .{formatter}) catch |err| switch (err) { | |
| 586 | return std.mem.print(output, "{f}", .{formatter}) catch |err| switch (err) { | |
| 587 | 587 | error.NoSpaceLeft => unreachable, |
| 588 | 588 | else => |e| return e, |
| 589 | 589 | }; |
lib/docs/wasm/main.zig+1-1| ... | ... | @@ -48,7 +48,7 @@ fn logFn( |
| 48 | 48 | ) void { |
| 49 | 49 | const prefix = if (scope == .default) "" else @tagName(scope) ++ ": "; |
| 50 | 50 | var buf: [500]u8 = undefined; |
| 51 | const line = std.fmt.bufPrint(&buf, prefix ++ format, args) catch l: { | |
| 51 | const line = std.mem.print(&buf, prefix ++ format, args) catch l: { | |
| 52 | 52 | buf[buf.len - 3 ..][0..3].* = "...".*; |
| 53 | 53 | break :l &buf; |
| 54 | 54 | }; |
lib/fuzzer.zig+3-3| ... | ... | @@ -242,7 +242,7 @@ const Executable = struct { |
| 242 | 242 | /// Asserts `buf[0..2]` is "in" |
| 243 | 243 | fn inputFileName(buf: *[10]u8, i: u32) []u8 { |
| 244 | 244 | assert(buf[0..2].* == "in".*); |
| 245 | const hex = std.fmt.bufPrint(buf[2..], "{x}", .{i}) catch unreachable; | |
| 245 | const hex = std.mem.print(buf[2..], "{x}", .{i}) catch unreachable; | |
| 246 | 246 | return buf[0 .. 2 + hex.len]; |
| 247 | 247 | } |
| 248 | 248 | |
| ... | ... | @@ -763,7 +763,7 @@ const Fuzzer = struct { |
| 763 | 763 | const input_f = while (true) { |
| 764 | 764 | var name_buf: [10]u8 = undefined; |
| 765 | 765 | name_buf[0..2].* = "in".*; |
| 766 | const hex = std.fmt.bufPrint(name_buf[2..], "{x}", .{input_i}) catch unreachable; | |
| 766 | const hex = std.mem.print(name_buf[2..], "{x}", .{input_i}) catch unreachable; | |
| 767 | 767 | const name = name_buf[0 .. 2 + hex.len]; |
| 768 | 768 | |
| 769 | 769 | if (exec.cache_f.createFile(io, name, .{ |
| ... | ... | @@ -998,7 +998,7 @@ const Fuzzer = struct { |
| 998 | 998 | } |
| 999 | 999 | |
| 1000 | 1000 | pub fn inputName(n: *CorpusFileName, i: u32) []u8 { |
| 1001 | const hex = std.fmt.bufPrint(n.buf[Test.dirname_len + 1 ..][0..8], "{x}", .{i}) catch unreachable; | |
| 1001 | const hex = std.mem.print(n.buf[Test.dirname_len + 1 ..][0..8], "{x}", .{i}) catch unreachable; | |
| 1002 | 1002 | return n.buf[0 .. Test.dirname_len + 1 + hex.len]; |
| 1003 | 1003 | } |
| 1004 | 1004 | }; |
lib/std/Build/Cache/Path.zig+9-9| ... | ... | @@ -61,7 +61,7 @@ pub fn joinStringZ(p: Path, gpa: Allocator, sub_path: []const u8) Allocator.Erro |
| 61 | 61 | pub fn openFile(p: Path, io: Io, sub_path: []const u8, flags: Io.Dir.OpenFileOptions) !Io.File { |
| 62 | 62 | var buf: [Io.Dir.max_path_bytes]u8 = undefined; |
| 63 | 63 | const joined_path = if (p.sub_path.len == 0) sub_path else p: { |
| 64 | break :p std.fmt.bufPrint(&buf, "{s}" ++ Io.Dir.path.sep_str ++ "{s}", .{ | |
| 64 | break :p std.mem.print(&buf, "{s}" ++ Io.Dir.path.sep_str ++ "{s}", .{ | |
| 65 | 65 | p.sub_path, sub_path, |
| 66 | 66 | }) catch return error.NameTooLong; |
| 67 | 67 | }; |
| ... | ... | @@ -76,7 +76,7 @@ pub fn openDir( |
| 76 | 76 | ) Io.Dir.OpenError!Io.Dir { |
| 77 | 77 | var buf: [Io.Dir.max_path_bytes]u8 = undefined; |
| 78 | 78 | const joined_path = if (p.sub_path.len == 0) sub_path else p: { |
| 79 | break :p std.fmt.bufPrint(&buf, "{s}" ++ Io.Dir.path.sep_str ++ "{s}", .{ | |
| 79 | break :p std.mem.print(&buf, "{s}" ++ Io.Dir.path.sep_str ++ "{s}", .{ | |
| 80 | 80 | p.sub_path, sub_path, |
| 81 | 81 | }) catch return error.NameTooLong; |
| 82 | 82 | }; |
| ... | ... | @@ -86,7 +86,7 @@ pub fn openDir( |
| 86 | 86 | pub fn createDirPathOpen(p: Path, io: Io, sub_path: []const u8, opts: Io.Dir.CreateDirPathOpenOptions) !Io.Dir { |
| 87 | 87 | var buf: [Io.Dir.max_path_bytes]u8 = undefined; |
| 88 | 88 | const joined_path = if (p.sub_path.len == 0) sub_path else p: { |
| 89 | break :p std.fmt.bufPrint(&buf, "{s}" ++ Io.Dir.path.sep_str ++ "{s}", .{ | |
| 89 | break :p std.mem.print(&buf, "{s}" ++ Io.Dir.path.sep_str ++ "{s}", .{ | |
| 90 | 90 | p.sub_path, sub_path, |
| 91 | 91 | }) catch return error.NameTooLong; |
| 92 | 92 | }; |
| ... | ... | @@ -96,7 +96,7 @@ pub fn createDirPathOpen(p: Path, io: Io, sub_path: []const u8, opts: Io.Dir.Cre |
| 96 | 96 | pub fn statFile(p: Path, io: Io, sub_path: []const u8) !Io.Dir.Stat { |
| 97 | 97 | var buf: [Io.Dir.max_path_bytes]u8 = undefined; |
| 98 | 98 | const joined_path = if (p.sub_path.len == 0) sub_path else p: { |
| 99 | break :p std.fmt.bufPrint(&buf, "{s}" ++ Io.Dir.path.sep_str ++ "{s}", .{ | |
| 99 | break :p std.mem.print(&buf, "{s}" ++ Io.Dir.path.sep_str ++ "{s}", .{ | |
| 100 | 100 | p.sub_path, sub_path, |
| 101 | 101 | }) catch return error.NameTooLong; |
| 102 | 102 | }; |
| ... | ... | @@ -111,7 +111,7 @@ pub fn atomicFile( |
| 111 | 111 | buf: *[Io.Dir.max_path_bytes]u8, |
| 112 | 112 | ) !Io.File.Atomic { |
| 113 | 113 | const joined_path = if (p.sub_path.len == 0) sub_path else p: { |
| 114 | break :p std.fmt.bufPrint(buf, "{s}" ++ Io.Dir.path.sep_str ++ "{s}", .{ | |
| 114 | break :p std.mem.print(buf, "{s}" ++ Io.Dir.path.sep_str ++ "{s}", .{ | |
| 115 | 115 | p.sub_path, sub_path, |
| 116 | 116 | }) catch return error.NameTooLong; |
| 117 | 117 | }; |
| ... | ... | @@ -121,7 +121,7 @@ pub fn atomicFile( |
| 121 | 121 | pub fn access(p: Path, io: Io, sub_path: []const u8, flags: Io.Dir.AccessOptions) !void { |
| 122 | 122 | var buf: [Io.Dir.max_path_bytes]u8 = undefined; |
| 123 | 123 | const joined_path = if (p.sub_path.len == 0) sub_path else p: { |
| 124 | break :p std.fmt.bufPrint(&buf, "{s}" ++ Io.Dir.path.sep_str ++ "{s}", .{ | |
| 124 | break :p std.mem.print(&buf, "{s}" ++ Io.Dir.path.sep_str ++ "{s}", .{ | |
| 125 | 125 | p.sub_path, sub_path, |
| 126 | 126 | }) catch return error.NameTooLong; |
| 127 | 127 | }; |
| ... | ... | @@ -131,7 +131,7 @@ pub fn access(p: Path, io: Io, sub_path: []const u8, flags: Io.Dir.AccessOptions |
| 131 | 131 | pub fn createDirPath(p: Path, io: Io, sub_path: []const u8) !void { |
| 132 | 132 | var buf: [Io.Dir.max_path_bytes]u8 = undefined; |
| 133 | 133 | const joined_path = if (p.sub_path.len == 0) sub_path else p: { |
| 134 | break :p std.fmt.bufPrint(&buf, "{s}" ++ Io.Dir.path.sep_str ++ "{s}", .{ | |
| 134 | break :p std.mem.print(&buf, "{s}" ++ Io.Dir.path.sep_str ++ "{s}", .{ | |
| 135 | 135 | p.sub_path, sub_path, |
| 136 | 136 | }) catch return error.NameTooLong; |
| 137 | 137 | }; |
| ... | ... | @@ -139,11 +139,11 @@ pub fn createDirPath(p: Path, io: Io, sub_path: []const u8) !void { |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | pub fn toString(p: Path, allocator: Allocator) Allocator.Error![]u8 { |
| 142 | return std.fmt.allocPrint(allocator, "{f}", .{p}); | |
| 142 | return allocator.print("{f}", .{p}); | |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | pub fn toStringZ(p: Path, allocator: Allocator) Allocator.Error![:0]u8 { |
| 146 | return std.fmt.allocPrintSentinel(allocator, "{f}", .{p}, 0); | |
| 146 | return allocator.printSentinel("{f}", .{p}, 0); | |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | pub fn fmtEscapeString(path: Path) std.fmt.Alt(Path, formatEscapeString) { |
lib/std/Io/Threaded.zig+5-5| ... | ... | @@ -7067,7 +7067,7 @@ fn realPathPosix(fd: posix.fd_t, out_buffer: []u8) File.RealPathError!usize { |
| 7067 | 7067 | .linux, .serenity, .illumos => { |
| 7068 | 7068 | var procfs_buf: ["/proc/self/path/-2147483648\x00".len]u8 = undefined; |
| 7069 | 7069 | const template = if (native_os == .illumos) "/proc/self/path/{d}" else "/proc/self/fd/{d}"; |
| 7070 | const proc_path = std.fmt.bufPrintSentinel(&procfs_buf, template, .{fd}, 0) catch unreachable; | |
| 7070 | const proc_path = std.mem.printSentinel(&procfs_buf, template, .{fd}, 0) catch unreachable; | |
| 7071 | 7071 | const syscall: Syscall = try .start(); |
| 7072 | 7072 | while (true) { |
| 7073 | 7073 | const rc = posix.system.readlink(proc_path, out_buffer.ptr, out_buffer.len); |
| ... | ... | @@ -7155,7 +7155,7 @@ fn fileHardLink( |
| 7155 | 7155 | error.FileNotFound => { |
| 7156 | 7156 | if (options.follow_symlinks) return error.FileNotFound; |
| 7157 | 7157 | var proc_buf: ["/proc/self/fd/-2147483648\x00".len]u8 = undefined; |
| 7158 | const proc_path = std.fmt.bufPrintSentinel(&proc_buf, "/proc/self/fd/{d}", .{file.handle}, 0) catch | |
| 7158 | const proc_path = std.mem.printSentinel(&proc_buf, "/proc/self/fd/{d}", .{file.handle}, 0) catch | |
| 7159 | 7159 | unreachable; |
| 7160 | 7160 | return linkat(posix.AT.FDCWD, proc_path, new_dir.handle, new_sub_path_posix, posix.AT.SYMLINK_FOLLOW); |
| 7161 | 7161 | }, |
| ... | ... | @@ -8633,7 +8633,7 @@ fn fchmodatFallback( |
| 8633 | 8633 | return error.OperationUnsupported; |
| 8634 | 8634 | |
| 8635 | 8635 | var procfs_buf: ["/proc/self/fd/-2147483648\x00".len]u8 = undefined; |
| 8636 | const proc_path = std.fmt.bufPrintSentinel(&procfs_buf, "/proc/self/fd/{d}", .{path_fd}, 0) catch unreachable; | |
| 8636 | const proc_path = std.mem.printSentinel(&procfs_buf, "/proc/self/fd/{d}", .{path_fd}, 0) catch unreachable; | |
| 8637 | 8637 | const syscall: Syscall = try .start(); |
| 8638 | 8638 | while (true) { |
| 8639 | 8639 | switch (posix.errno(posix.system.chmod(proc_path, mode))) { |
| ... | ... | @@ -10633,7 +10633,7 @@ fn processExecutablePath(userdata: ?*anyopaque, out_buffer: []u8) process.Execut |
| 10633 | 10633 | var it = std.mem.tokenizeScalar(u8, PATH, ':'); |
| 10634 | 10634 | it: while (it.next()) |dir| { |
| 10635 | 10635 | var resolved_path_buf: [std.c.PATH_MAX]u8 = undefined; |
| 10636 | const resolved_path = std.fmt.bufPrintSentinel(&resolved_path_buf, "{s}/{s}", .{ | |
| 10636 | const resolved_path = std.mem.printSentinel(&resolved_path_buf, "{s}/{s}", .{ | |
| 10637 | 10637 | dir, argv0, |
| 10638 | 10638 | }, 0) catch continue; |
| 10639 | 10639 | |
| ... | ... | @@ -14002,7 +14002,7 @@ fn netLookupFallible( |
| 14002 | 14002 | const name_c = name_buffer[0..name.len :0]; |
| 14003 | 14003 | |
| 14004 | 14004 | var port_buffer: [8]u8 = undefined; |
| 14005 | const port_c = std.fmt.bufPrintSentinel(&port_buffer, "{d}", .{options.port}, 0) catch unreachable; | |
| 14005 | const port_c = std.mem.printSentinel(&port_buffer, "{d}", .{options.port}, 0) catch unreachable; | |
| 14006 | 14006 | |
| 14007 | 14007 | const family: i32 = if (options.family) |f| switch (f) { |
| 14008 | 14008 | .ip4 => posix.AF.INET, |
lib/std/Io/Uring.zig+1-1| ... | ... | @@ -5793,7 +5793,7 @@ fn realPath( |
| 5793 | 5793 | ) File.RealPathError!usize { |
| 5794 | 5794 | _ = ev; |
| 5795 | 5795 | var procfs_buf: [std.fmt.count("/proc/self/fd/{d}\x00", .{std.math.minInt(fd_t)})]u8 = undefined; |
| 5796 | const proc_path = std.fmt.bufPrintSentinel(&procfs_buf, "/proc/self/fd/{d}", .{fd}, 0) catch | |
| 5796 | const proc_path = std.mem.printSentinel(&procfs_buf, "/proc/self/fd/{d}", .{fd}, 0) catch | |
| 5797 | 5797 | unreachable; |
| 5798 | 5798 | while (true) { |
| 5799 | 5799 | try sync.cancel_region.await(.nothing); |
lib/std/Io/net.zig+1-1| ... | ... | @@ -1504,7 +1504,7 @@ fn testIp6ParseTransform(expected: []const u8, input: []const u8) !void { |
| 1504 | 1504 | }, |
| 1505 | 1505 | }; |
| 1506 | 1506 | var buffer: [100]u8 = undefined; |
| 1507 | const result = try std.fmt.bufPrint(&buffer, "{f}", .{ua}); | |
| 1507 | const result = try std.mem.print(&buffer, "{f}", .{ua}); | |
| 1508 | 1508 | try std.testing.expectEqualStrings(expected, result); |
| 1509 | 1509 | } |
| 1510 | 1510 |
lib/std/Io/net/test.zig+2-2| ... | ... | @@ -65,7 +65,7 @@ test "parse and render IPv6 addresses" { |
| 65 | 65 | fn testParseAndRenderIp6Address(input: []const u8, expected_output: []const u8) !void { |
| 66 | 66 | var buffer: [100]u8 = undefined; |
| 67 | 67 | const parsed = net.Ip6Address.Unresolved.parse(input); |
| 68 | const actual_printed = try std.fmt.bufPrint(&buffer, "{f}", .{parsed.success}); | |
| 68 | const actual_printed = try std.mem.print(&buffer, "{f}", .{parsed.success}); | |
| 69 | 69 | try testing.expectEqualStrings(expected_output, actual_printed); |
| 70 | 70 | } |
| 71 | 71 | |
| ... | ... | @@ -115,7 +115,7 @@ test "parse and render IPv4 addresses" { |
| 115 | 115 | fn testIp4ParseAndRender(text: []const u8) !void { |
| 116 | 116 | var buffer: [18]u8 = undefined; |
| 117 | 117 | const addr = try net.IpAddress.parseIp4(text, 0); |
| 118 | const rendered = try std.fmt.bufPrint(&buffer, "{f}", .{addr}); | |
| 118 | const rendered = try std.mem.print(&buffer, "{f}", .{addr}); | |
| 119 | 119 | const without_port = rendered[0 .. rendered.len - 2]; |
| 120 | 120 | try testing.expectEqualStrings(text, without_port); |
| 121 | 121 | } |
lib/std/Progress.zig+6-6| ... | ... | @@ -308,7 +308,7 @@ pub const Node = struct { |
| 308 | 308 | |
| 309 | 309 | pub fn startFmt(node: Node, estimated_total_items: usize, comptime format: []const u8, args: anytype) Node { |
| 310 | 310 | var buffer: [max_name_len]u8 = undefined; |
| 311 | const name = std.fmt.bufPrint(&buffer, format, args) catch &buffer; | |
| 311 | const name = std.mem.print(&buffer, format, args) catch &buffer; | |
| 312 | 312 | return Node.start(node, name, estimated_total_items); |
| 313 | 313 | } |
| 314 | 314 | |
| ... | ... | @@ -1355,7 +1355,7 @@ fn computeRedraw(io: Io, serialized_buffer: *Serialized.Buffer) !struct { []u8, |
| 1355 | 1355 | i += progress_pulsing.len; |
| 1356 | 1356 | } else { |
| 1357 | 1357 | const percent = @as(u64, completed_items) * 100 / estimated_total; |
| 1358 | if (std.fmt.bufPrint(buf[i..], @"progress_normal {d}", .{percent})) |b| { | |
| 1358 | if (std.mem.print(buf[i..], @"progress_normal {d}", .{percent})) |b| { | |
| 1359 | 1359 | i += b.len; |
| 1360 | 1360 | } else |_| {} |
| 1361 | 1361 | } |
| ... | ... | @@ -1374,7 +1374,7 @@ fn computeRedraw(io: Io, serialized_buffer: *Serialized.Buffer) !struct { []u8, |
| 1374 | 1374 | i += progress_pulsing_error.len; |
| 1375 | 1375 | } else { |
| 1376 | 1376 | const percent = @as(u64, completed_items) * 100 / estimated_total; |
| 1377 | if (std.fmt.bufPrint(buf[i..], @"progress_error {d}", .{percent})) |b| { | |
| 1377 | if (std.mem.print(buf[i..], @"progress_error {d}", .{percent})) |b| { | |
| 1378 | 1378 | i += b.len; |
| 1379 | 1379 | } else |_| {} |
| 1380 | 1380 | } |
| ... | ... | @@ -1475,16 +1475,16 @@ fn computeNode( |
| 1475 | 1475 | if (!is_empty_root) { |
| 1476 | 1476 | if (name.len != 0 or estimated_total > 0) { |
| 1477 | 1477 | if (estimated_total > 0) { |
| 1478 | if (std.fmt.bufPrint(buf[i..], "[{d}/{d}] ", .{ completed_items, estimated_total })) |b| { | |
| 1478 | if (std.mem.print(buf[i..], "[{d}/{d}] ", .{ completed_items, estimated_total })) |b| { | |
| 1479 | 1479 | i += b.len; |
| 1480 | 1480 | } else |_| {} |
| 1481 | 1481 | } else if (completed_items != 0) { |
| 1482 | if (std.fmt.bufPrint(buf[i..], "[{d}] ", .{completed_items})) |b| { | |
| 1482 | if (std.mem.print(buf[i..], "[{d}] ", .{completed_items})) |b| { | |
| 1483 | 1483 | i += b.len; |
| 1484 | 1484 | } else |_| {} |
| 1485 | 1485 | } |
| 1486 | 1486 | if (name.len != 0) { |
| 1487 | if (std.fmt.bufPrint(buf[i..], "{s}", .{name})) |b| { | |
| 1487 | if (std.mem.print(buf[i..], "{s}", .{name})) |b| { | |
| 1488 | 1488 | i += b.len; |
| 1489 | 1489 | } else |_| {} |
| 1490 | 1490 | } |
lib/std/Target.zig+1-1| ... | ... | @@ -2437,7 +2437,7 @@ pub const DynamicLinker = struct { |
| 2437 | 2437 | |
| 2438 | 2438 | /// Asserts that the length is less than or equal to 255 bytes. |
| 2439 | 2439 | pub fn setFmt(dl: *DynamicLinker, comptime fmt_str: []const u8, args: anytype) !void { |
| 2440 | dl.len = @intCast((try std.fmt.bufPrint(&dl.buffer, fmt_str, args)).len); | |
| 2440 | dl.len = @intCast((try std.mem.print(&dl.buffer, fmt_str, args)).len); | |
| 2441 | 2441 | } |
| 2442 | 2442 | |
| 2443 | 2443 | pub fn eql(lhs: DynamicLinker, rhs: DynamicLinker) bool { |
lib/std/Thread.zig+4-4| ... | ... | @@ -47,7 +47,7 @@ pub const SetNameError = error{ |
| 47 | 47 | Unsupported, |
| 48 | 48 | Unexpected, |
| 49 | 49 | InvalidWtf8, |
| 50 | } || posix.PrctlError || Io.File.Writer.Error || Io.File.OpenError || std.fmt.BufPrintError; | |
| 50 | } || posix.PrctlError || Io.File.Writer.Error || Io.File.OpenError || std.mem.PrintError; | |
| 51 | 51 | |
| 52 | 52 | pub fn setName(self: Thread, io: Io, name: []const u8) SetNameError!void { |
| 53 | 53 | if (name.len > max_name_len) return error.NameTooLong; |
| ... | ... | @@ -75,7 +75,7 @@ pub fn setName(self: Thread, io: Io, name: []const u8) SetNameError!void { |
| 75 | 75 | } |
| 76 | 76 | } else { |
| 77 | 77 | var buf: [32]u8 = undefined; |
| 78 | const path = try std.fmt.bufPrint(&buf, "/proc/self/task/{d}/comm", .{self.getHandle()}); | |
| 78 | const path = try std.mem.print(&buf, "/proc/self/task/{d}/comm", .{self.getHandle()}); | |
| 79 | 79 | |
| 80 | 80 | const file = try Io.Dir.cwd().openFile(io, path, .{ .mode = .write_only }); |
| 81 | 81 | defer file.close(io); |
| ... | ... | @@ -152,7 +152,7 @@ pub fn setName(self: Thread, io: Io, name: []const u8) SetNameError!void { |
| 152 | 152 | pub const GetNameError = error{ |
| 153 | 153 | Unsupported, |
| 154 | 154 | Unexpected, |
| 155 | } || posix.PrctlError || posix.ReadError || Io.File.OpenError || std.fmt.BufPrintError; | |
| 155 | } || posix.PrctlError || posix.ReadError || Io.File.OpenError || std.mem.PrintError; | |
| 156 | 156 | |
| 157 | 157 | /// On Windows, the result is encoded as [WTF-8](https://wtf-8.codeberg.page/). |
| 158 | 158 | /// On other platforms, the result is an opaque sequence of bytes with no particular encoding. |
| ... | ... | @@ -176,7 +176,7 @@ pub fn getName(self: Thread, buffer_ptr: *[max_name_len:0]u8) GetNameError!?[]co |
| 176 | 176 | } |
| 177 | 177 | } else { |
| 178 | 178 | var buf: [32]u8 = undefined; |
| 179 | const path = try std.fmt.bufPrint(&buf, "/proc/self/task/{d}/comm", .{self.getHandle()}); | |
| 179 | const path = try std.mem.print(&buf, "/proc/self/task/{d}/comm", .{self.getHandle()}); | |
| 180 | 180 | |
| 181 | 181 | const io = std.Options.debug_io; |
| 182 | 182 |
lib/std/Uri.zig+2-2| ... | ... | @@ -41,7 +41,7 @@ pub const Component = union(enum) { |
| 41 | 41 | return switch (component) { |
| 42 | 42 | .raw => |raw| raw, |
| 43 | 43 | .percent_encoded => |percent_encoded| if (std.mem.findScalar(u8, percent_encoded, '%')) |_| |
| 44 | try std.fmt.bufPrint(buffer, "{f}", .{std.fmt.alt(component, .formatRaw)}) | |
| 44 | try std.mem.print(buffer, "{f}", .{std.fmt.alt(component, .formatRaw)}) | |
| 45 | 45 | else |
| 46 | 46 | percent_encoded, |
| 47 | 47 | }; |
| ... | ... | @@ -52,7 +52,7 @@ pub const Component = union(enum) { |
| 52 | 52 | return switch (component) { |
| 53 | 53 | .raw => |raw| raw, |
| 54 | 54 | .percent_encoded => |percent_encoded| if (std.mem.findScalar(u8, percent_encoded, '%')) |_| |
| 55 | try std.fmt.allocPrint(arena, "{f}", .{std.fmt.alt(component, .formatRaw)}) | |
| 55 | try arena.print("{f}", .{std.fmt.alt(component, .formatRaw)}) | |
| 56 | 56 | else |
| 57 | 57 | percent_encoded, |
| 58 | 58 | }; |
lib/std/crypto/25519/curve25519.zig+2-2| ... | ... | @@ -129,9 +129,9 @@ test "curve25519" { |
| 129 | 129 | const p = try Curve25519.basePoint.clampedMul(s); |
| 130 | 130 | try p.rejectIdentity(); |
| 131 | 131 | var buf: [128]u8 = undefined; |
| 132 | try std.testing.expectEqualStrings(try std.fmt.bufPrint(&buf, "{X}", .{&p.toBytes()}), "E6F2A4D1C28EE5C7AD0329268255A468AD407D2672824C0C0EB30EA6EF450145"); | |
| 132 | try std.testing.expectEqualStrings(try std.mem.print(&buf, "{X}", .{&p.toBytes()}), "E6F2A4D1C28EE5C7AD0329268255A468AD407D2672824C0C0EB30EA6EF450145"); | |
| 133 | 133 | const q = try p.clampedMul(s); |
| 134 | try std.testing.expectEqualStrings(try std.fmt.bufPrint(&buf, "{X}", .{&q.toBytes()}), "3614E119FFE55EC55B87D6B19971A9F4CBC78EFE80BEC55B96392BABCC712537"); | |
| 134 | try std.testing.expectEqualStrings(try std.mem.print(&buf, "{X}", .{&q.toBytes()}), "3614E119FFE55EC55B87D6B19971A9F4CBC78EFE80BEC55B96392BABCC712537"); | |
| 135 | 135 | |
| 136 | 136 | try Curve25519.rejectNonCanonical(s); |
| 137 | 137 | s[31] |= 0x80; |
lib/std/crypto/25519/ed25519.zig+3-3| ... | ... | @@ -585,8 +585,8 @@ test "key pair creation" { |
| 585 | 585 | _ = try fmt.hexToBytes(seed[0..], "8052030376d47112be7f73ed7a019293dd12ad910b654455798b4667d73de166"); |
| 586 | 586 | const key_pair = try Ed25519.KeyPair.generateDeterministic(seed); |
| 587 | 587 | var buf: [256]u8 = undefined; |
| 588 | try std.testing.expectEqualStrings(try std.fmt.bufPrint(&buf, "{X}", .{&key_pair.secret_key.toBytes()}), "8052030376D47112BE7F73ED7A019293DD12AD910B654455798B4667D73DE1662D6F7455D97B4A3A10D7293909D1A4F2058CB9A370E43FA8154BB280DB839083"); | |
| 589 | try std.testing.expectEqualStrings(try std.fmt.bufPrint(&buf, "{X}", .{&key_pair.public_key.toBytes()}), "2D6F7455D97B4A3A10D7293909D1A4F2058CB9A370E43FA8154BB280DB839083"); | |
| 588 | try std.testing.expectEqualStrings(try std.mem.print(&buf, "{X}", .{&key_pair.secret_key.toBytes()}), "8052030376D47112BE7F73ED7A019293DD12AD910B654455798B4667D73DE1662D6F7455D97B4A3A10D7293909D1A4F2058CB9A370E43FA8154BB280DB839083"); | |
| 589 | try std.testing.expectEqualStrings(try std.mem.print(&buf, "{X}", .{&key_pair.public_key.toBytes()}), "2D6F7455D97B4A3A10D7293909D1A4F2058CB9A370E43FA8154BB280DB839083"); | |
| 590 | 590 | } |
| 591 | 591 | |
| 592 | 592 | test "signature" { |
| ... | ... | @@ -596,7 +596,7 @@ test "signature" { |
| 596 | 596 | |
| 597 | 597 | const sig = try key_pair.sign("test", null); |
| 598 | 598 | var buf: [128]u8 = undefined; |
| 599 | try std.testing.expectEqualStrings(try std.fmt.bufPrint(&buf, "{X}", .{&sig.toBytes()}), "10A442B4A80CC4225B154F43BEF28D2472CA80221951262EB8E0DF9091575E2687CC486E77263C3418C757522D54F84B0359236ABBBD4ACD20DC297FDCA66808"); | |
| 599 | try std.testing.expectEqualStrings(try std.mem.print(&buf, "{X}", .{&sig.toBytes()}), "10A442B4A80CC4225B154F43BEF28D2472CA80221951262EB8E0DF9091575E2687CC486E77263C3418C757522D54F84B0359236ABBBD4ACD20DC297FDCA66808"); | |
| 600 | 600 | try sig.verify("test", key_pair.public_key); |
| 601 | 601 | try std.testing.expectError(error.SignatureVerificationFailed, sig.verify("TEST", key_pair.public_key)); |
| 602 | 602 | } |
lib/std/crypto/25519/edwards25519.zig+1-1| ... | ... | @@ -543,7 +543,7 @@ test "packing/unpacking" { |
| 543 | 543 | var b = Edwards25519.basePoint; |
| 544 | 544 | const pk = try b.mul(s); |
| 545 | 545 | var buf: [128]u8 = undefined; |
| 546 | try std.testing.expectEqualStrings(try std.fmt.bufPrint(&buf, "{X}", .{&pk.toBytes()}), "074BC7E0FCBD587FDBC0969444245FADC562809C8F6E97E949AF62484B5B81A6"); | |
| 546 | try std.testing.expectEqualStrings(try std.mem.print(&buf, "{X}", .{&pk.toBytes()}), "074BC7E0FCBD587FDBC0969444245FADC562809C8F6E97E949AF62484B5B81A6"); | |
| 547 | 547 | |
| 548 | 548 | const small_order_ss: [7][32]u8 = .{ |
| 549 | 549 | .{ |
lib/std/crypto/25519/ristretto255.zig+4-4| ... | ... | @@ -175,21 +175,21 @@ pub const Ristretto255 = struct { |
| 175 | 175 | test "ristretto255" { |
| 176 | 176 | const p = Ristretto255.basePoint; |
| 177 | 177 | var buf: [256]u8 = undefined; |
| 178 | try std.testing.expectEqualStrings(try std.fmt.bufPrint(&buf, "{X}", .{&p.toBytes()}), "E2F2AE0A6ABC4E71A884A961C500515F58E30B6AA582DD8DB6A65945E08D2D76"); | |
| 178 | try std.testing.expectEqualStrings(try std.mem.print(&buf, "{X}", .{&p.toBytes()}), "E2F2AE0A6ABC4E71A884A961C500515F58E30B6AA582DD8DB6A65945E08D2D76"); | |
| 179 | 179 | |
| 180 | 180 | var r: [Ristretto255.encoded_length]u8 = undefined; |
| 181 | 181 | _ = try fmt.hexToBytes(r[0..], "6a493210f7499cd17fecb510ae0cea23a110e8d5b901f8acadd3095c73a3b919"); |
| 182 | 182 | var q = try Ristretto255.fromBytes(r); |
| 183 | 183 | q = q.dbl().add(p); |
| 184 | try std.testing.expectEqualStrings(try std.fmt.bufPrint(&buf, "{X}", .{&q.toBytes()}), "E882B131016B52C1D3337080187CF768423EFCCBB517BB495AB812C4160FF44E"); | |
| 184 | try std.testing.expectEqualStrings(try std.mem.print(&buf, "{X}", .{&q.toBytes()}), "E882B131016B52C1D3337080187CF768423EFCCBB517BB495AB812C4160FF44E"); | |
| 185 | 185 | |
| 186 | 186 | const s = [_]u8{15} ++ @as([31]u8, @splat(0)); |
| 187 | 187 | const w = try p.mul(s); |
| 188 | try std.testing.expectEqualStrings(try std.fmt.bufPrint(&buf, "{X}", .{&w.toBytes()}), "E0C418F7C8D9C4CDD7395B93EA124F3AD99021BB681DFC3302A9D99A2E53E64E"); | |
| 188 | try std.testing.expectEqualStrings(try std.mem.print(&buf, "{X}", .{&w.toBytes()}), "E0C418F7C8D9C4CDD7395B93EA124F3AD99021BB681DFC3302A9D99A2E53E64E"); | |
| 189 | 189 | |
| 190 | 190 | try std.testing.expect(p.dbl().dbl().dbl().dbl().equivalent(w.add(p))); |
| 191 | 191 | |
| 192 | 192 | const h = @as([32]u8, @splat(69)) ++ @as([32]u8, @splat(42)); |
| 193 | 193 | const ph = Ristretto255.fromUniform(h); |
| 194 | try std.testing.expectEqualStrings(try std.fmt.bufPrint(&buf, "{X}", .{&ph.toBytes()}), "DCCA54E037A4311EFBEEF413ACD21D35276518970B7A61DC88F8587B493D5E19"); | |
| 194 | try std.testing.expectEqualStrings(try std.mem.print(&buf, "{X}", .{&ph.toBytes()}), "DCCA54E037A4311EFBEEF413ACD21D35276518970B7A61DC88F8587B493D5E19"); | |
| 195 | 195 | } |
lib/std/crypto/25519/scalar.zig+3-3| ... | ... | @@ -850,10 +850,10 @@ test "scalar25519" { |
| 850 | 850 | var y = x.toBytes(); |
| 851 | 851 | try rejectNonCanonical(y); |
| 852 | 852 | var buf: [128]u8 = undefined; |
| 853 | try std.testing.expectEqualStrings(try std.fmt.bufPrint(&buf, "{X}", .{&y}), "1E979B917937F3DE71D18077F961F6CEFF01030405060708010203040506070F"); | |
| 853 | try std.testing.expectEqualStrings(try std.mem.print(&buf, "{X}", .{&y}), "1E979B917937F3DE71D18077F961F6CEFF01030405060708010203040506070F"); | |
| 854 | 854 | |
| 855 | 855 | const reduced = reduce(field_order_s); |
| 856 | try std.testing.expectEqualStrings(try std.fmt.bufPrint(&buf, "{X}", .{&reduced}), "0000000000000000000000000000000000000000000000000000000000000000"); | |
| 856 | try std.testing.expectEqualStrings(try std.mem.print(&buf, "{X}", .{&reduced}), "0000000000000000000000000000000000000000000000000000000000000000"); | |
| 857 | 857 | } |
| 858 | 858 | |
| 859 | 859 | test "non-canonical scalar25519" { |
| ... | ... | @@ -867,7 +867,7 @@ test "mulAdd overflow check" { |
| 867 | 867 | const c: [32]u8 = @splat(0xff); |
| 868 | 868 | const x = mulAdd(a, b, c); |
| 869 | 869 | var buf: [128]u8 = undefined; |
| 870 | try std.testing.expectEqualStrings(try std.fmt.bufPrint(&buf, "{X}", .{&x}), "D14DF91389432C25AD60FF9791B9FD1D67BEF517D273ECCE3D9A307C1B419903"); | |
| 870 | try std.testing.expectEqualStrings(try std.mem.print(&buf, "{X}", .{&x}), "D14DF91389432C25AD60FF9791B9FD1D67BEF517D273ECCE3D9A307C1B419903"); | |
| 871 | 871 | } |
| 872 | 872 | |
| 873 | 873 | test "scalar field inversion" { |
lib/std/crypto/bcrypt.zig+1-1| ... | ... | @@ -635,7 +635,7 @@ const crypt_format = struct { |
| 635 | 635 | _ = Codec.Encoder.encode(&ct_str, dk[0..]); |
| 636 | 636 | |
| 637 | 637 | var s_buf: [hash_length]u8 = undefined; |
| 638 | const s = fmt.bufPrint( | |
| 638 | const s = mem.print( | |
| 639 | 639 | s_buf[0..], |
| 640 | 640 | "{s}b${d}{d}${s}{s}", |
| 641 | 641 | .{ prefix, params.rounds_log / 10, params.rounds_log % 10, salt_str, ct_str }, |
lib/std/crypto/chacha20.zig+2-2| ... | ... | @@ -1145,7 +1145,7 @@ test "xchacha20" { |
| 1145 | 1145 | var c: [m.len]u8 = undefined; |
| 1146 | 1146 | XChaCha20IETF.xor(c[0..], m[0..], 0, key, nonce); |
| 1147 | 1147 | var buf: [2 * c.len]u8 = undefined; |
| 1148 | try testing.expectEqualStrings(try std.fmt.bufPrint(&buf, "{X}", .{&c}), "E0A1BCF939654AFDBDC1746EC49832647C19D891F0D1A81FC0C1703B4514BDEA584B512F6908C2C5E9DD18D5CBC1805DE5803FE3B9CA5F193FB8359E91FAB0C3BB40309A292EB1CF49685C65C4A3ADF4F11DB0CD2B6B67FBC174BC2E860E8F769FD3565BBFAD1C845E05A0FED9BE167C240D"); | |
| 1148 | try testing.expectEqualStrings(try std.mem.print(&buf, "{X}", .{&c}), "E0A1BCF939654AFDBDC1746EC49832647C19D891F0D1A81FC0C1703B4514BDEA584B512F6908C2C5E9DD18D5CBC1805DE5803FE3B9CA5F193FB8359E91FAB0C3BB40309A292EB1CF49685C65C4A3ADF4F11DB0CD2B6B67FBC174BC2E860E8F769FD3565BBFAD1C845E05A0FED9BE167C240D"); | |
| 1149 | 1149 | } |
| 1150 | 1150 | { |
| 1151 | 1151 | const ad = "Additional data"; |
| ... | ... | @@ -1154,7 +1154,7 @@ test "xchacha20" { |
| 1154 | 1154 | var out: [m.len]u8 = undefined; |
| 1155 | 1155 | try XChaCha20Poly1305.decrypt(out[0..], c[0..m.len], c[m.len..].*, ad, nonce, key); |
| 1156 | 1156 | var buf: [2 * c.len]u8 = undefined; |
| 1157 | try testing.expectEqualStrings(try std.fmt.bufPrint(&buf, "{X}", .{&c}), "994D2DD32333F48E53650C02C7A2ABB8E018B0836D7175AEC779F52E961780768F815C58F1AA52D211498DB89B9216763F569C9433A6BBFCEFB4D4A49387A4C5207FBB3B5A92B5941294DF30588C6740D39DC16FA1F0E634F7246CF7CDCB978E44347D89381B7A74EB7084F754B90BDE9AAF5A94B8F2A85EFD0B50692AE2D425E234"); | |
| 1157 | try testing.expectEqualStrings(try std.mem.print(&buf, "{X}", .{&c}), "994D2DD32333F48E53650C02C7A2ABB8E018B0836D7175AEC779F52E961780768F815C58F1AA52D211498DB89B9216763F569C9433A6BBFCEFB4D4A49387A4C5207FBB3B5A92B5941294DF30588C6740D39DC16FA1F0E634F7246CF7CDCB978E44347D89381B7A74EB7084F754B90BDE9AAF5A94B8F2A85EFD0B50692AE2D425E234"); | |
| 1158 | 1158 | try testing.expectEqualSlices(u8, out[0..], m); |
| 1159 | 1159 | c[0] +%= 1; |
| 1160 | 1160 | try testing.expectError(error.AuthenticationFailed, XChaCha20Poly1305.decrypt(out[0..], c[0..m.len], c[m.len..].*, ad, nonce, key)); |
lib/std/crypto/ml_kem.zig+1-1| ... | ... | @@ -1701,7 +1701,7 @@ fn testNistKat(mode: type, hash: []const u8) !void { |
| 1701 | 1701 | var out: [32]u8 = undefined; |
| 1702 | 1702 | fw.hasher.final(&out); |
| 1703 | 1703 | var outHex: [64]u8 = undefined; |
| 1704 | _ = try std.fmt.bufPrint(&outHex, "{x}", .{&out}); | |
| 1704 | _ = try std.mem.print(&outHex, "{x}", .{&out}); | |
| 1705 | 1705 | try testing.expectEqualStrings(&outHex, hash); |
| 1706 | 1706 | } |
| 1707 | 1707 |
lib/std/fs/test.zig+2-2| ... | ... | @@ -529,7 +529,7 @@ test "Dir.Iterator many entries" { |
| 529 | 529 | var i: usize = 0; |
| 530 | 530 | var buf: [4]u8 = undefined; // Enough to store "1024". |
| 531 | 531 | while (i < num) : (i += 1) { |
| 532 | const name = try std.fmt.bufPrint(&buf, "{}", .{i}); | |
| 532 | const name = try std.mem.print(&buf, "{}", .{i}); | |
| 533 | 533 | const file = try tmp_dir.dir.createFile(io, name, .{}); |
| 534 | 534 | file.close(io); |
| 535 | 535 | } |
| ... | ... | @@ -551,7 +551,7 @@ test "Dir.Iterator many entries" { |
| 551 | 551 | |
| 552 | 552 | i = 0; |
| 553 | 553 | while (i < num) : (i += 1) { |
| 554 | const name = try std.fmt.bufPrint(&buf, "{}", .{i}); | |
| 554 | const name = try std.mem.print(&buf, "{}", .{i}); | |
| 555 | 555 | try expect(contains(&entries, .{ .name = name, .kind = .file, .inode = 0 })); |
| 556 | 556 | } |
| 557 | 557 | } |
lib/std/http/test.zig+5-5| ... | ... | @@ -344,7 +344,7 @@ test "Server.Request.respondStreaming non-chunked, unknown content-length" { |
| 344 | 344 | var total: usize = 0; |
| 345 | 345 | for (0..500) |i| { |
| 346 | 346 | var buf: [30]u8 = undefined; |
| 347 | const line = try std.fmt.bufPrint(&buf, "{d}, ah ha ha!\n", .{i}); | |
| 347 | const line = try std.mem.print(&buf, "{d}, ah ha ha!\n", .{i}); | |
| 348 | 348 | try expected_response.appendSlice(line); |
| 349 | 349 | total += line.len; |
| 350 | 350 | } |
| ... | ... | @@ -1017,7 +1017,7 @@ fn echoTests(client: *http.Client, port: u16) !void { |
| 1017 | 1017 | try expect(client.http_proxy != null or client.connection_pool.free_len == 1); |
| 1018 | 1018 | |
| 1019 | 1019 | { // send chunked request |
| 1020 | const uri = try std.Uri.parse(try std.fmt.bufPrint( | |
| 1020 | const uri = try std.Uri.parse(try std.mem.print( | |
| 1021 | 1021 | &location_buffer, |
| 1022 | 1022 | "http://127.0.0.1:{d}/echo-content", |
| 1023 | 1023 | .{port}, |
| ... | ... | @@ -1213,7 +1213,7 @@ test "redirect to different connection" { |
| 1213 | 1213 | defer stream.close(io); |
| 1214 | 1214 | |
| 1215 | 1215 | var loc_buf: [50]u8 = undefined; |
| 1216 | const new_loc = try std.fmt.bufPrint(&loc_buf, "http://127.0.0.1:{d}/ok", .{ | |
| 1216 | const new_loc = try std.mem.print(&loc_buf, "http://127.0.0.1:{d}/ok", .{ | |
| 1217 | 1217 | global.other_port.?, |
| 1218 | 1218 | }); |
| 1219 | 1219 | |
| ... | ... | @@ -1241,7 +1241,7 @@ test "redirect to different connection" { |
| 1241 | 1241 | defer client.deinit(); |
| 1242 | 1242 | |
| 1243 | 1243 | var loc_buf: [100]u8 = undefined; |
| 1244 | const location = try std.fmt.bufPrint(&loc_buf, "http://127.0.0.1:{d}/help", .{ | |
| 1244 | const location = try std.mem.print(&loc_buf, "http://127.0.0.1:{d}/help", .{ | |
| 1245 | 1245 | test_server_orig.port(), |
| 1246 | 1246 | }); |
| 1247 | 1247 | const uri = try std.Uri.parse(location); |
| ... | ... | @@ -1300,7 +1300,7 @@ test "boot failed connections from the pool" { |
| 1300 | 1300 | defer client.deinit(); |
| 1301 | 1301 | |
| 1302 | 1302 | var loc_buf: [100]u8 = undefined; |
| 1303 | const location = try std.fmt.bufPrint(&loc_buf, "http://127.0.0.1:{d}/", .{ | |
| 1303 | const location = try std.mem.print(&loc_buf, "http://127.0.0.1:{d}/", .{ | |
| 1304 | 1304 | test_server_orig.port(), |
| 1305 | 1305 | }); |
| 1306 | 1306 | const uri = try std.Uri.parse(location); |
lib/std/os/windows.zig+1-1| ... | ... | @@ -5006,7 +5006,7 @@ pub const TEB = extern struct { |
| 5006 | 5006 | }; |
| 5007 | 5007 | |
| 5008 | 5008 | comptime { |
| 5009 | // XXX: Without this check we cannot use `std.Io.Writer` on 16-bit platforms. `std.fmt.bufPrint` will hit the unreachable in `PEB.GdiHandleBuffer` without this guard. | |
| 5009 | // XXX: Without this check we cannot use `std.Io.Writer` on 16-bit platforms. `std.mem.print` will hit the unreachable in `PEB.GdiHandleBuffer` without this guard. | |
| 5010 | 5010 | if (builtin.os.tag == .windows) { |
| 5011 | 5011 | // Offsets taken from WinDbg info and Geoff Chappell[1] (RIP) |
| 5012 | 5012 | // [1]: https://www.geoffchappell.com/studies/windows/km/ntoskrnl/inc/api/pebteb/teb/index.htm |
lib/std/process/Environ.zig+2-2| ... | ... | @@ -466,7 +466,7 @@ pub const Map = struct { |
| 466 | 466 | ); |
| 467 | 467 | i += "ZIG_PROGRESS=".len; |
| 468 | 468 | var value_buf: [std.fmt.count("{d}", .{std.math.maxInt(usize)})]u8 = undefined; |
| 469 | const value = std.fmt.bufPrint(&value_buf, "{d}", .{@intFromPtr(handle)}) catch unreachable; | |
| 469 | const value = std.mem.print(&value_buf, "{d}", .{@intFromPtr(handle)}) catch unreachable; | |
| 470 | 470 | for (block[i..][0..value.len], value) |*r, v| r.* = v; |
| 471 | 471 | i += value.len; |
| 472 | 472 | block[i] = 0; |
| ... | ... | @@ -840,7 +840,7 @@ pub fn createWindowsBlock( |
| 840 | 840 | @memcpy(block[i..][0..zig_progress_key.len], &zig_progress_key); |
| 841 | 841 | i += zig_progress_key.len; |
| 842 | 842 | var value_buf: [std.fmt.count("{d}", .{std.math.maxInt(usize)})]u8 = undefined; |
| 843 | const value = std.fmt.bufPrint(&value_buf, "{d}", .{@intFromPtr(handle)}) catch unreachable; | |
| 843 | const value = std.mem.print(&value_buf, "{d}", .{@intFromPtr(handle)}) catch unreachable; | |
| 844 | 844 | for (block[i..][0..value.len], value) |*r, v| r.* = v; |
| 845 | 845 | i += value.len; |
| 846 | 846 | block[i] = 0; |
lib/std/testing.zig+1-1| ... | ... | @@ -656,7 +656,7 @@ test expectError { |
| 656 | 656 | pub fn expectFmt(expected: []const u8, comptime template: []const u8, args: anytype) !void { |
| 657 | 657 | if (@inComptime()) { |
| 658 | 658 | var buffer: [std.fmt.count(template, args)]u8 = undefined; |
| 659 | return expectEqualStrings(expected, try std.fmt.bufPrint(&buffer, template, args)); | |
| 659 | return expectEqualStrings(expected, try std.mem.print(&buffer, template, args)); | |
| 660 | 660 | } |
| 661 | 661 | const actual = try std.fmt.allocPrint(allocator, template, args); |
| 662 | 662 | defer allocator.free(actual); |
lib/std/zig/WindowsSdk.zig+2-2| ... | ... | @@ -513,7 +513,7 @@ pub const Installation = struct { |
| 513 | 513 | |
| 514 | 514 | const version = version: { |
| 515 | 515 | var buf: [Dir.max_path_bytes]u8 = undefined; |
| 516 | const sdk_lib_dir_path = std.fmt.bufPrint(buf[0..], "{s}\\Lib\\", .{path}) catch |err| switch (err) { | |
| 516 | const sdk_lib_dir_path = std.mem.print(buf[0..], "{s}\\Lib\\", .{path}) catch |err| switch (err) { | |
| 517 | 517 | error.NoSpaceLeft => return error.PathTooLong, |
| 518 | 518 | }; |
| 519 | 519 | if (!Dir.path.isAbsolute(sdk_lib_dir_path)) return error.InstallationNotFound; |
| ... | ... | @@ -985,7 +985,7 @@ const MsvcLibDir = struct { |
| 985 | 985 | io.random(std.mem.asBytes(&guid)); |
| 986 | 986 | |
| 987 | 987 | var guid_buf: [38]u8 = undefined; |
| 988 | const guid_str = std.fmt.bufPrint(&guid_buf, "{f}", .{guid}) catch unreachable; | |
| 988 | const guid_str = std.mem.print(&guid_buf, "{f}", .{guid}) catch unreachable; | |
| 989 | 989 | |
| 990 | 990 | var buf: std.ArrayList(u16) = .initBuffer(&key_path_buf); |
| 991 | 991 | buf.appendSliceAssumeCapacity(L("\\REGISTRY\\A\\")); |
lib/std/zig/system/windows.zig+1-1| ... | ... | @@ -74,7 +74,7 @@ fn getCpuInfoFromRegistry(core: usize, args: anytype) !void { |
| 74 | 74 | |
| 75 | 75 | const max_cpu_buf = 4; |
| 76 | 76 | var next_cpu_buf: [max_cpu_buf]u8 = undefined; |
| 77 | const next_cpu = try std.fmt.bufPrint(&next_cpu_buf, "{d}", .{core}); | |
| 77 | const next_cpu = try std.mem.print(&next_cpu_buf, "{d}", .{core}); | |
| 78 | 78 | |
| 79 | 79 | var subkey: [max_cpu_buf + 1]u16 = undefined; |
| 80 | 80 | const subkey_len = try std.unicode.utf8ToUtf16Le(&subkey, next_cpu); |
src/Compilation.zig+1-1| ... | ... | @@ -3821,7 +3821,7 @@ pub fn saveState(comp: *Compilation) !void { |
| 3821 | 3821 | } |
| 3822 | 3822 | |
| 3823 | 3823 | var basename_buf: [255]u8 = undefined; |
| 3824 | const basename = std.fmt.bufPrint(&basename_buf, "{s}.zcs", .{ | |
| 3824 | const basename = std.mem.print(&basename_buf, "{s}.zcs", .{ | |
| 3825 | 3825 | comp.root_name, |
| 3826 | 3826 | }) catch o: { |
| 3827 | 3827 | basename_buf[basename_buf.len - 4 ..].* = ".zcs".*; |
src/IncrementalDebugServer.zig+2-2| ... | ... | @@ -405,10 +405,10 @@ fn parseAnalUnit(str: []const u8) ?AnalUnit { |
| 405 | 405 | } |
| 406 | 406 | fn printAnalUnit(unit: AnalUnit, buf: *[32]u8) []const u8 { |
| 407 | 407 | const idx: u32 = switch (unit.unwrap()) { |
| 408 | .memoized_state => |stage| return std.fmt.bufPrint(buf, "memoized_state {s}", .{@tagName(stage)}) catch unreachable, | |
| 408 | .memoized_state => |stage| return std.mem.print(buf, "memoized_state {s}", .{@tagName(stage)}) catch unreachable, | |
| 409 | 409 | inline else => |i| @backingInt(i), |
| 410 | 410 | }; |
| 411 | return std.fmt.bufPrint(buf, "{s} {d}", .{ @tagName(unit.unwrap()), idx }) catch unreachable; | |
| 411 | return std.mem.print(buf, "{s} {d}", .{ @tagName(unit.unwrap()), idx }) catch unreachable; | |
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | fn printType(ty: Type, zcu: *const Zcu, w: *Io.Writer) Io.Writer.Error!void { |
src/InternPool.zig+1-1| ... | ... | @@ -11384,7 +11384,7 @@ pub fn getOrPutStringFmt( |
| 11384 | 11384 | const len: u32 = @intCast(std.fmt.count(format_z, args)); |
| 11385 | 11385 | const string_bytes = ip.getLocal(tid).getMutableStringBytes(gpa, io); |
| 11386 | 11386 | const slice = try string_bytes.addManyAsSlice(len); |
| 11387 | assert((std.fmt.bufPrint(slice[0], format_z, args) catch unreachable).len == len); | |
| 11387 | assert((std.mem.print(slice[0], format_z, args) catch unreachable).len == len); | |
| 11388 | 11388 | return ip.getOrPutTrailingString(gpa, io, tid, len, embedded_nulls); |
| 11389 | 11389 | } |
| 11390 | 11390 |
src/codegen/aarch64/Assemble.zig+2-2| ... | ... | @@ -83,7 +83,7 @@ fn zonCast(comptime Result: type, zon_value: anytype, symbols: anytype) Result { |
| 83 | 83 | .unsigned => std.math.maxInt(Symbol), |
| 84 | 84 | }}) |
| 85 | 85 | ]u8 = undefined; |
| 86 | return std.meta.stringToEnum(Result, std.fmt.bufPrint(&buf, "{d}", .{symbol}) catch unreachable).?; | |
| 86 | return std.meta.stringToEnum(Result, std.mem.print(&buf, "{d}", .{symbol}) catch unreachable).?; | |
| 87 | 87 | }, |
| 88 | 88 | else => return symbol, |
| 89 | 89 | }, |
| ... | ... | @@ -256,7 +256,7 @@ fn nextToken(as: *Assemble, buf: *[token_buf_len]u8, comptime opts: struct { |
| 256 | 256 | switch (modified_operand) { |
| 257 | 257 | .register => |reg| { |
| 258 | 258 | as.source = as.source[index + 1 ..]; |
| 259 | return std.fmt.bufPrint(buf, "{f}", .{reg.fmt()}) catch unreachable; | |
| 259 | return std.mem.print(buf, "{f}", .{reg.fmt()}) catch unreachable; | |
| 260 | 260 | }, |
| 261 | 261 | } |
| 262 | 262 | } else continue :c invalid_syntax, |
src/codegen/c.zig+2-2| ... | ... | @@ -7467,7 +7467,7 @@ const StringLiteral = struct { |
| 7467 | 7467 | }, |
| 7468 | 7468 | else => { |
| 7469 | 7469 | var buf: [4]u8 = undefined; |
| 7470 | const printed = std.fmt.bufPrint(&buf, "\\{o:0>3}", .{c}) catch unreachable; | |
| 7470 | const printed = std.mem.print(&buf, "\\{o:0>3}", .{c}) catch unreachable; | |
| 7471 | 7471 | try w.writeAll(printed); |
| 7472 | 7472 | return printed.len; |
| 7473 | 7473 | }, |
| ... | ... | @@ -7489,7 +7489,7 @@ const StringLiteral = struct { |
| 7489 | 7489 | } else { |
| 7490 | 7490 | if (!sl.first) try sl.w.writeByte(','); |
| 7491 | 7491 | var buf: [6]u8 = undefined; |
| 7492 | const printed = std.fmt.bufPrint(&buf, "'\\x{x}'", .{c}) catch unreachable; | |
| 7492 | const printed = std.mem.print(&buf, "'\\x{x}'", .{c}) catch unreachable; | |
| 7493 | 7493 | try sl.w.writeAll(printed); |
| 7494 | 7494 | sl.cur_len += printed.len; |
| 7495 | 7495 | sl.first = false; |
src/codegen/x86_64/CodeGen.zig+1-1| ... | ... | @@ -178194,7 +178194,7 @@ fn airAsm(self: *CodeGen, inst: Air.Inst.Index) !void { |
| 178194 | 178194 | inline for (@typeInfo(encoder.Instruction.Mnemonic).@"enum".field_names) |mnem_name| |
| 178195 | 178195 | max_mnem_len = @max(mnem_name.len, max_mnem_len); |
| 178196 | 178196 | var intel_mnem_buf: [max_mnem_len + 1]u8 = undefined; |
| 178197 | const intel_mnem_str = std.fmt.bufPrint(&intel_mnem_buf, "{s}{c}", .{ | |
| 178197 | const intel_mnem_str = std.mem.print(&intel_mnem_buf, "{s}{c}", .{ | |
| 178198 | 178198 | @tagName(mnem_tag), |
| 178199 | 178199 | @as(u8, switch (mnem_size.size) { |
| 178200 | 178200 | .byte => 'b', |
src/libs/freebsd.zig+1-1| ... | ... | @@ -975,7 +975,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 975 | 975 | } |
| 976 | 976 | |
| 977 | 977 | var lib_name_buf: [32]u8 = undefined; // Larger than each of the names "c", "stdthreads", etc. |
| 978 | const asm_file_basename = std.fmt.bufPrint(&lib_name_buf, "{s}.s", .{lib.name}) catch unreachable; | |
| 978 | const asm_file_basename = std.mem.print(&lib_name_buf, "{s}.s", .{lib.name}) catch unreachable; | |
| 979 | 979 | try o_directory.handle.writeFile(io, .{ .sub_path = asm_file_basename, .data = stubs_asm.items }); |
| 980 | 980 | try buildSharedLib(comp, arena, o_directory, asm_file_basename, lib, prog_node); |
| 981 | 981 | } |
src/libs/glibc.zig+1-1| ... | ... | @@ -1124,7 +1124,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 1124 | 1124 | } |
| 1125 | 1125 | |
| 1126 | 1126 | var lib_name_buf: [32]u8 = undefined; // Larger than each of the names "c", "pthread", etc. |
| 1127 | const asm_file_basename = std.fmt.bufPrint(&lib_name_buf, "{s}.s", .{lib.name}) catch unreachable; | |
| 1127 | const asm_file_basename = std.mem.print(&lib_name_buf, "{s}.s", .{lib.name}) catch unreachable; | |
| 1128 | 1128 | try o_directory.handle.writeFile(io, .{ .sub_path = asm_file_basename, .data = stubs_asm.items }); |
| 1129 | 1129 | try buildSharedLib(comp, arena, o_directory, asm_file_basename, lib, prog_node); |
| 1130 | 1130 | } |
src/libs/mingw/Preprocessor.zig+2-2| ... | ... | @@ -92,9 +92,9 @@ fn addTokenAssumeCapacity(pp: *Preprocessor, tok: Token) void { |
| 92 | 92 | |
| 93 | 93 | fn defineBuiltins(pp: *Preprocessor) !void { |
| 94 | 94 | var buf: [5]u8 = undefined; |
| 95 | var val = std.fmt.bufPrint(&buf, "{d}", .{pp.target.cTypeByteSize(.longdouble).?}) catch unreachable; | |
| 95 | var val = std.mem.print(&buf, "{d}", .{pp.target.cTypeByteSize(.longdouble).?}) catch unreachable; | |
| 96 | 96 | try pp.defineBuiltinValue("__SIZEOF_LONG_DOUBLE__", val, .pp_num); |
| 97 | val = std.fmt.bufPrint(&buf, "{d}", .{pp.target.cTypeByteSize(.double).?}) catch unreachable; | |
| 97 | val = std.mem.print(&buf, "{d}", .{pp.target.cTypeByteSize(.double).?}) catch unreachable; | |
| 98 | 98 | try pp.defineBuiltinValue("__SIZEOF_DOUBLE__", val, .pp_num); |
| 99 | 99 | |
| 100 | 100 | if (pp.target.abi.isGnu()) { |
src/libs/netbsd.zig+1-1| ... | ... | @@ -636,7 +636,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 636 | 636 | } |
| 637 | 637 | |
| 638 | 638 | var lib_name_buf: [32]u8 = undefined; // Larger than each of the names "c", "pthread", etc. |
| 639 | const asm_file_basename = std.fmt.bufPrint(&lib_name_buf, "{s}.s", .{lib.name}) catch unreachable; | |
| 639 | const asm_file_basename = std.mem.print(&lib_name_buf, "{s}.s", .{lib.name}) catch unreachable; | |
| 640 | 640 | try o_directory.handle.writeFile(io, .{ .sub_path = asm_file_basename, .data = stubs_asm.items }); |
| 641 | 641 | try buildSharedLib(comp, arena, o_directory, asm_file_basename, lib, prog_node); |
| 642 | 642 | } |
src/libs/openbsd.zig+1-1| ... | ... | @@ -557,7 +557,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 557 | 557 | } |
| 558 | 558 | |
| 559 | 559 | var lib_name_buf: [32]u8 = undefined; // Larger than each of the names "c", "pthread", etc. |
| 560 | const asm_file_basename = std.fmt.bufPrint(&lib_name_buf, "{s}.s", .{lib.name}) catch unreachable; | |
| 560 | const asm_file_basename = std.mem.print(&lib_name_buf, "{s}.s", .{lib.name}) catch unreachable; | |
| 561 | 561 | try o_directory.handle.writeFile(io, .{ .sub_path = asm_file_basename, .data = stubs_asm.items }); |
| 562 | 562 | try buildSharedLib(comp, arena, o_directory, asm_file_basename, lib, prog_node); |
| 563 | 563 | } |
src/link/Coff.zig+3-3| ... | ... | @@ -5994,7 +5994,7 @@ fn resolve(coff: *Coff, tid: Zcu.PerThread.Id) !bool { |
| 5994 | 5994 | }; |
| 5995 | 5995 | var name: [std.Progress.Node.max_name_len]u8 = undefined; |
| 5996 | 5996 | const sub_prog_node = coff.synth_prog_node.start( |
| 5997 | std.fmt.bufPrint(&name, "lazy {s} for {f}", .{ | |
| 5997 | std.mem.print(&name, "lazy {s} for {f}", .{ | |
| 5998 | 5998 | kind, |
| 5999 | 5999 | Type.fromInterned(lmr.lazySymbol(coff).ty).fmt(pt), |
| 6000 | 6000 | }) catch &name, |
| ... | ... | @@ -6132,7 +6132,7 @@ fn idleProgNode( |
| 6132 | 6132 | inline .pseudo_section, .object_section => |smi| smi.name(coff).toSlice(coff), |
| 6133 | 6133 | .input_section => |isi| { |
| 6134 | 6134 | const ioi = isi.input(coff); |
| 6135 | break :name std.fmt.bufPrint(&name, "{f}{f} {s}", .{ | |
| 6135 | break :name std.mem.print(&name, "{f}{f} {s}", .{ | |
| 6136 | 6136 | ioi.path(coff).fmtEscapeString(), |
| 6137 | 6137 | fmtMemberNameString(ioi.memberName(coff)), |
| 6138 | 6138 | coff.getNode(isi.symbol(coff).node(coff).parent(&coff.mf).unwrap().?).object_section.name(coff).toSlice(coff), |
| ... | ... | @@ -6143,7 +6143,7 @@ fn idleProgNode( |
| 6143 | 6143 | const ip = &coff.base.comp.zcu.?.intern_pool; |
| 6144 | 6144 | break :name ip.getNav(nmi.navIndex(coff)).fqn.toSlice(ip); |
| 6145 | 6145 | }, |
| 6146 | .uav => |umi| std.fmt.bufPrint(&name, "{f}", .{ | |
| 6146 | .uav => |umi| std.mem.print(&name, "{f}", .{ | |
| 6147 | 6147 | Value.fromInterned(umi.uavValue(coff)).fmtValue(.{ |
| 6148 | 6148 | .zcu = coff.base.comp.zcu.?, |
| 6149 | 6149 | .tid = tid, |
src/link/Dwarf.zig+3-3| ... | ... | @@ -3834,7 +3834,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 3834 | 3834 | .field); |
| 3835 | 3835 | { |
| 3836 | 3836 | var field_name_buf: [std.fmt.count("{d}", .{std.math.maxInt(u32)})]u8 = undefined; |
| 3837 | const field_name = std.fmt.bufPrint(&field_name_buf, "{d}", .{field_index}) catch unreachable; | |
| 3837 | const field_name = std.mem.print(&field_name_buf, "{d}", .{field_index}) catch unreachable; | |
| 3838 | 3838 | try wip_nav.strp(field_name); |
| 3839 | 3839 | } |
| 3840 | 3840 | try wip_nav.refType(field_type); |
| ... | ... | @@ -4456,7 +4456,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4456 | 4456 | .tuple_index => |index| { |
| 4457 | 4457 | try wip_nav.abbrevCode(.access); |
| 4458 | 4458 | var field_name_buf: [std.fmt.count("{d}", .{std.math.maxInt(u32)})]u8 = undefined; |
| 4459 | const field_name = std.fmt.bufPrint(&field_name_buf, "{d}", .{index}) catch unreachable; | |
| 4459 | const field_name = std.mem.print(&field_name_buf, "{d}", .{index}) catch unreachable; | |
| 4460 | 4460 | try wip_nav.strp(field_name); |
| 4461 | 4461 | }, |
| 4462 | 4462 | }; |
| ... | ... | @@ -4551,7 +4551,7 @@ fn updateConstInner(dwarf: *Dwarf, pt: Zcu.PerThread, debug_const_index: link.Co |
| 4551 | 4551 | continue); |
| 4552 | 4552 | { |
| 4553 | 4553 | var field_name_buf: [std.fmt.count("{d}", .{std.math.maxInt(u32)})]u8 = undefined; |
| 4554 | const field_name = std.fmt.bufPrint(&field_name_buf, "{d}", .{field_index}) catch unreachable; | |
| 4554 | const field_name = std.mem.print(&field_name_buf, "{d}", .{field_index}) catch unreachable; | |
| 4555 | 4555 | try wip_nav.strp(field_name); |
| 4556 | 4556 | } |
| 4557 | 4557 | const field_value: Value = .fromInterned(switch (aggregate.storage) { |
src/link/Elf/ZigObject.zig+1-1| ... | ... | @@ -1026,7 +1026,7 @@ pub fn lowerUav( |
| 1026 | 1026 | }; |
| 1027 | 1027 | |
| 1028 | 1028 | var name_buf: [32]u8 = undefined; |
| 1029 | const name = std.fmt.bufPrint(&name_buf, "__anon_{d}", .{ | |
| 1029 | const name = std.mem.print(&name_buf, "__anon_{d}", .{ | |
| 1030 | 1030 | @backingInt(uav), |
| 1031 | 1031 | }) catch unreachable; |
| 1032 | 1032 | const sym_index = self.lowerConst( |
src/link/Elf2.zig+5-5| ... | ... | @@ -3026,7 +3026,7 @@ fn lazySymbolInner(elf: *Elf, lazy: link.File.LazySymbol) Error!link.File.Symbol |
| 3026 | 3026 | }; |
| 3027 | 3027 | const node = try shndx.get(elf).ni.addFloatingChild(&elf.mf, gpa, .{}); |
| 3028 | 3028 | var name_buf: [64]u8 = undefined; |
| 3029 | const name = std.fmt.bufPrint( | |
| 3029 | const name = std.mem.print( | |
| 3030 | 3030 | &name_buf, |
| 3031 | 3031 | "__lazy_{t}_{d}", |
| 3032 | 3032 | .{ lazy.kind, @backingInt(lazy.ty) }, |
| ... | ... | @@ -5361,7 +5361,7 @@ fn uavMapIndex( |
| 5361 | 5361 | .alignment = resolved_align, |
| 5362 | 5362 | }); |
| 5363 | 5363 | var name_buf: [32]u8 = undefined; |
| 5364 | const name = std.fmt.bufPrint( | |
| 5364 | const name = std.mem.print( | |
| 5365 | 5365 | &name_buf, |
| 5366 | 5366 | "__anon_{d}", |
| 5367 | 5367 | .{@backingInt(uav_val)}, |
| ... | ... | @@ -7916,13 +7916,13 @@ fn idleProgNode( |
| 7916 | 7916 | return prog_node.start(name: switch (node) { |
| 7917 | 7917 | else => |tag| @tagName(tag), |
| 7918 | 7918 | .section => |shndx| shndx.name(elf).slice(elf), |
| 7919 | .archive_input_member => |ii| std.fmt.bufPrint(&name, "{f}{f}", .{ | |
| 7919 | .archive_input_member => |ii| std.mem.print(&name, "{f}{f}", .{ | |
| 7920 | 7920 | ii.path(elf).fmtEscapeString(), |
| 7921 | 7921 | fmtMemberString(ii.member(elf)), |
| 7922 | 7922 | }) catch &name, |
| 7923 | 7923 | .input_section => |isi| { |
| 7924 | 7924 | const ii = isi.input(elf); |
| 7925 | break :name std.fmt.bufPrint(&name, "{f}{f} {s}", .{ | |
| 7925 | break :name std.mem.print(&name, "{f}{f} {s}", .{ | |
| 7926 | 7926 | ii.path(elf).fmtEscapeString(), |
| 7927 | 7927 | fmtMemberString(ii.member(elf)), |
| 7928 | 7928 | elf.getNode(isi.node(elf).parent(&elf.mf).unwrap().?).section.name(elf).slice(elf), |
| ... | ... | @@ -7932,7 +7932,7 @@ fn idleProgNode( |
| 7932 | 7932 | const ip = &elf.base.comp.zcu.?.intern_pool; |
| 7933 | 7933 | break :name ip.getNav(nmi.navIndex(elf)).fqn.toSlice(ip); |
| 7934 | 7934 | }, |
| 7935 | .uav => |umi| std.fmt.bufPrint(&name, "{f}", .{ | |
| 7935 | .uav => |umi| std.mem.print(&name, "{f}", .{ | |
| 7936 | 7936 | Value.fromInterned(umi.uavValue(elf)).fmtValue(.{ .zcu = elf.base.comp.zcu.?, .tid = tid }), |
| 7937 | 7937 | }) catch &name, |
| 7938 | 7938 | }, 0); |
src/link/MachO/Dylib.zig+2-2| ... | ... | @@ -844,7 +844,7 @@ pub const Id = struct { |
| 844 | 844 | allocator.free(id.name); |
| 845 | 845 | } |
| 846 | 846 | |
| 847 | pub const ParseError = fmt.ParseIntError || fmt.BufPrintError; | |
| 847 | pub const ParseError = fmt.ParseIntError || mem.PrintError; | |
| 848 | 848 | |
| 849 | 849 | pub fn parseCurrentVersion(id: *Id, version: anytype) ParseError!void { |
| 850 | 850 | id.current_version = try parseVersion(version); |
| ... | ... | @@ -865,7 +865,7 @@ pub const Id = struct { |
| 865 | 865 | }, |
| 866 | 866 | .float => |float| { |
| 867 | 867 | var buf: [256]u8 = undefined; |
| 868 | break :blk try fmt.bufPrint(&buf, "{d}", .{float}); | |
| 868 | break :blk try mem.print(&buf, "{d}", .{float}); | |
| 869 | 869 | }, |
| 870 | 870 | .string => |string| { |
| 871 | 871 | break :blk string; |
src/link/MachO/ZigObject.zig+1-1| ... | ... | @@ -720,7 +720,7 @@ pub fn lowerUav( |
| 720 | 720 | } |
| 721 | 721 | |
| 722 | 722 | var name_buf: [32]u8 = undefined; |
| 723 | const name = std.fmt.bufPrint(&name_buf, "__anon_{d}", .{ | |
| 723 | const name = std.mem.print(&name_buf, "__anon_{d}", .{ | |
| 724 | 724 | @backingInt(uav), |
| 725 | 725 | }) catch unreachable; |
| 726 | 726 | const sym_index = self.lowerConst( |
src/link/Wasm.zig+3-3| ... | ... | @@ -1374,7 +1374,7 @@ pub const GlobalImport = extern struct { |
| 1374 | 1374 | .__tls_base => @tagName(Unpacked.__tls_base), |
| 1375 | 1375 | .__tls_size => @tagName(Unpacked.__tls_size), |
| 1376 | 1376 | .object_global => |i| i.name(wasm).slice(wasm), |
| 1377 | inline .uav_obj, .uav_exe => |i| std.fmt.bufPrint( | |
| 1377 | inline .uav_obj, .uav_exe => |i| std.mem.print( | |
| 1378 | 1378 | buf, |
| 1379 | 1379 | "__anon_{d}", |
| 1380 | 1380 | .{@backingInt(i.key(wasm).*)}, |
| ... | ... | @@ -1997,7 +1997,7 @@ pub const ObjectDataImport = extern struct { |
| 1997 | 1997 | .__heap_base => @tagName(.__heap_base), |
| 1998 | 1998 | .__heap_end => @tagName(.__heap_end), |
| 1999 | 1999 | .__wasm_first_page_end => @tagName(.__wasm_first_page_end), |
| 2000 | inline .uav_exe, .uav_obj => |i| std.fmt.bufPrint( | |
| 2000 | inline .uav_exe, .uav_obj => |i| std.mem.print( | |
| 2001 | 2001 | buf, |
| 2002 | 2002 | "__anon_{d}", |
| 2003 | 2003 | .{@backingInt(i.key(wasm).*)}, |
| ... | ... | @@ -4348,7 +4348,7 @@ pub fn internString(wasm: *Wasm, bytes: []const u8) Allocator.Error!String { |
| 4348 | 4348 | // TODO implement instead by appending to string_bytes |
| 4349 | 4349 | pub fn internStringFmt(wasm: *Wasm, comptime format: []const u8, args: anytype) Allocator.Error!String { |
| 4350 | 4350 | var buffer: [32]u8 = undefined; |
| 4351 | const slice = std.fmt.bufPrint(&buffer, format, args) catch unreachable; | |
| 4351 | const slice = std.mem.print(&buffer, format, args) catch unreachable; | |
| 4352 | 4352 | return internString(wasm, slice); |
| 4353 | 4353 | } |
| 4354 | 4354 |
src/link/Wasm/Flush.zig+2-2| ... | ... | @@ -1706,14 +1706,14 @@ pub fn finish(f: *Flush, wasm: *Wasm) !void { |
| 1706 | 1706 | var id: [16]u8 = undefined; |
| 1707 | 1707 | std.crypto.hash.sha3.TurboShake128(null).hash(binary_bytes.items, &id, .{}); |
| 1708 | 1708 | var uuid: [36]u8 = undefined; |
| 1709 | _ = try std.fmt.bufPrint(&uuid, "{x}-{x}-{x}-{x}-{x}", .{ | |
| 1709 | _ = try std.mem.print(&uuid, "{x}-{x}-{x}-{x}-{x}", .{ | |
| 1710 | 1710 | id[0..4], id[4..6], id[6..8], id[8..10], id[10..], |
| 1711 | 1711 | }); |
| 1712 | 1712 | try emitBuildIdSection(gpa, binary_bytes, &uuid); |
| 1713 | 1713 | }, |
| 1714 | 1714 | .hexstring => |hs| { |
| 1715 | 1715 | var buffer: [32 * 2]u8 = undefined; |
| 1716 | const str = std.fmt.bufPrint(&buffer, "{x}", .{hs.toSlice()}) catch unreachable; | |
| 1716 | const str = std.mem.print(&buffer, "{x}", .{hs.toSlice()}) catch unreachable; | |
| 1717 | 1717 | try emitBuildIdSection(gpa, binary_bytes, str); |
| 1718 | 1718 | }, |
| 1719 | 1719 | else => |mode| { |
src/tracy.zig+1-1| ... | ... | @@ -23,7 +23,7 @@ const ___tracy_c_zone_context = extern struct { |
| 23 | 23 | |
| 24 | 24 | pub inline fn addTextFmt(self: @This(), comptime fmt: []const u8, args: anytype) void { |
| 25 | 25 | var buf: [512]u8 = undefined; |
| 26 | const slice = std.fmt.bufPrint(&buf, fmt, args) catch &buf; | |
| 26 | const slice = std.mem.print(&buf, fmt, args) catch &buf; | |
| 27 | 27 | self.addText(slice); |
| 28 | 28 | } |
| 29 | 29 |
test/standalone/emit_llvm_no_bin/main.zig+1-1| ... | ... | @@ -2,5 +2,5 @@ const std = @import("std"); |
| 2 | 2 | |
| 3 | 3 | export fn strFromFloatHelp(float: f64) void { |
| 4 | 4 | var buf: [400]u8 = undefined; |
| 5 | _ = std.fmt.bufPrint(&buf, "{d}", .{float}) catch unreachable; | |
| 5 | _ = std.mem.print(&buf, "{d}", .{float}) catch unreachable; | |
| 6 | 6 | } |