authorgravatar for benjamin.feng@glassdoor.comBenjamin Feng <benjamin.feng@glassdoor.com> 2020-03-06 09:47:42-06:00
committergravatar for benjamin.feng@glassdoor.comBenjamin Feng <benjamin.feng@glassdoor.com> 2020-03-12 10:41:09-05:00
log0059d9ee3e7298df03723d97adbea72ff142cacd
treed88f0722a4cf79afdf374189098bbf753f17cee2
parent4023ed56d4fd7b627aed73428b5fa4be4b7c05ad

Convert fmt.bufPrint / fmt.allocPrint


21 files changed, 56 insertions(+), 56 deletions(-)

lib/std/atomic/queue.zig+2-2
......@@ -348,7 +348,7 @@ test "std.atomic.Queue dump" {
348348 fbs.reset();
349349 try queue.dumpToStream(fbs.outStream());
350350
351 var expected = try std.fmt.bufPrint(expected_buffer[0..],
351 var expected = try std.fmtstream.bufPrint(expected_buffer[0..],
352352 \\head: 0x{x}=1
353353 \\ (null)
354354 \\tail: 0x{x}=1
......@@ -368,7 +368,7 @@ test "std.atomic.Queue dump" {
368368 fbs.reset();
369369 try queue.dumpToStream(fbs.outStream());
370370
371 expected = try std.fmt.bufPrint(expected_buffer[0..],
371 expected = try std.fmtstream.bufPrint(expected_buffer[0..],
372372 \\head: 0x{x}=1
373373 \\ 0x{x}=2
374374 \\ (null)
lib/std/net.zig+1-1
......@@ -438,7 +438,7 @@ pub fn getAddressList(allocator: *mem.Allocator, name: []const u8, port: u16) !*
438438 const name_c = try std.cstr.addNullByte(allocator, name);
439439 defer allocator.free(name_c);
440440
441 const port_c = try std.fmt.allocPrint(allocator, "{}\x00", .{port});
441 const port_c = try std.fmtstream.allocPrint(allocator, "{}\x00", .{port});
442442 defer allocator.free(port_c);
443443
444444 const hints = os.addrinfo{
lib/std/os.zig+1-1
......@@ -3049,7 +3049,7 @@ pub fn realpathC(pathname: [*:0]const u8, out_buffer: *[MAX_PATH_BYTES]u8) RealP
30493049 defer close(fd);
30503050
30513051 var procfs_buf: ["/proc/self/fd/-2147483648".len:0]u8 = undefined;
3052 const proc_path = std.fmt.bufPrint(procfs_buf[0..], "/proc/self/fd/{}\x00", .{fd}) catch unreachable;
3052 const proc_path = std.fmtstream.bufPrint(procfs_buf[0..], "/proc/self/fd/{}\x00", .{fd}) catch unreachable;
30533053
30543054 return readlinkC(@ptrCast([*:0]const u8, proc_path.ptr), out_buffer);
30553055 }
lib/std/progress.zig+3-3
......@@ -130,11 +130,11 @@ pub const Progress = struct {
130130 var end: usize = 0;
131131 if (self.columns_written > 0) {
132132 // restore cursor position
133 end += (std.fmt.bufPrint(self.output_buffer[end..], "\x1b[{}D", .{self.columns_written}) catch unreachable).len;
133 end += (std.fmtstream.bufPrint(self.output_buffer[end..], "\x1b[{}D", .{self.columns_written}) catch unreachable).len;
134134 self.columns_written = 0;
135135
136136 // clear rest of line
137 end += (std.fmt.bufPrint(self.output_buffer[end..], "\x1b[0K", .{}) catch unreachable).len;
137 end += (std.fmtstream.bufPrint(self.output_buffer[end..], "\x1b[0K", .{}) catch unreachable).len;
138138 }
139139
140140 if (!self.done) {
......@@ -185,7 +185,7 @@ pub const Progress = struct {
185185 }
186186
187187 fn bufWrite(self: *Progress, end: *usize, comptime format: []const u8, args: var) void {
188 if (std.fmt.bufPrint(self.output_buffer[end.*..], format, args)) |written| {
188 if (std.fmtstream.bufPrint(self.output_buffer[end.*..], format, args)) |written| {
189189 const amt = written.len;
190190 end.* += amt;
191191 self.columns_written += amt;
lib/std/special/build_runner.zig+3-3
......@@ -2,7 +2,7 @@ const root = @import("@build");
22const std = @import("std");
33const builtin = @import("builtin");
44const io = std.io;
5const fmt = std.fmt;
5const fmtstream = std.fmtstream;
66const Builder = std.build.Builder;
77const mem = std.mem;
88const process = std.process;
......@@ -153,7 +153,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: var) !void {
153153 const allocator = builder.allocator;
154154 for (builder.top_level_steps.toSliceConst()) |top_level_step| {
155155 const name = if (&top_level_step.step == builder.default_step)
156 try fmt.allocPrint(allocator, "{} (default)", .{top_level_step.step.name})
156 try fmtstream.allocPrint(allocator, "{} (default)", .{top_level_step.step.name})
157157 else
158158 top_level_step.step.name;
159159 try out_stream.print(" {s:22} {}\n", .{ name, top_level_step.description });
......@@ -175,7 +175,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: var) !void {
175175 try out_stream.print(" (none)\n", .{});
176176 } else {
177177 for (builder.available_options_list.toSliceConst()) |option| {
178 const name = try fmt.allocPrint(allocator, " -D{}=[{}]", .{
178 const name = try fmtstream.allocPrint(allocator, " -D{}=[{}]", .{
179179 option.name,
180180 Builder.typeIdName(option.type_id),
181181 });
lib/std/target.zig+2-2
......@@ -972,7 +972,7 @@ pub const Target = struct {
972972 }
973973
974974 pub fn linuxTripleSimple(allocator: *mem.Allocator, cpu_arch: Cpu.Arch, os_tag: Os.Tag, abi: Abi) ![:0]u8 {
975 return std.fmt.allocPrint0(allocator, "{}-{}-{}", .{ @tagName(cpu_arch), @tagName(os_tag), @tagName(abi) });
975 return std.fmtstream.allocPrint0(allocator, "{}-{}-{}", .{ @tagName(cpu_arch), @tagName(os_tag), @tagName(abi) });
976976 }
977977
978978 pub fn linuxTriple(self: Target, allocator: *mem.Allocator) ![:0]u8 {
......@@ -1158,7 +1158,7 @@ pub const Target = struct {
11581158 var result: DynamicLinker = .{};
11591159 const S = struct {
11601160 fn print(r: *DynamicLinker, comptime fmt: []const u8, args: var) DynamicLinker {
1161 r.max_byte = @intCast(u8, (std.fmt.bufPrint(&r.buffer, fmt, args) catch unreachable).len - 1);
1161 r.max_byte = @intCast(u8, (std.fmtstream.bufPrint(&r.buffer, fmt, args) catch unreachable).len - 1);
11621162 return r.*;
11631163 }
11641164 fn copy(r: *DynamicLinker, s: []const u8) DynamicLinker {
lib/std/zig/cross_target.zig+1-1
......@@ -573,7 +573,7 @@ pub const CrossTarget = struct {
573573 .Dynamic => "",
574574 };
575575
576 return std.fmt.allocPrint0(allocator, "{}-{}{}", .{ arch, os, static_suffix });
576 return std.fmtstream.allocPrint0(allocator, "{}-{}{}", .{ arch, os, static_suffix });
577577 }
578578
579579 pub const Executor = union(enum) {
lib/std/zig/system.zig+3-3
......@@ -130,7 +130,7 @@ pub const NativePaths = struct {
130130 }
131131
132132 pub fn addIncludeDirFmt(self: *NativePaths, comptime fmt: []const u8, args: var) !void {
133 const item = try std.fmt.allocPrint0(self.include_dirs.allocator, fmt, args);
133 const item = try std.fmtstream.allocPrint0(self.include_dirs.allocator, fmt, args);
134134 errdefer self.include_dirs.allocator.free(item);
135135 try self.include_dirs.append(item);
136136 }
......@@ -140,7 +140,7 @@ pub const NativePaths = struct {
140140 }
141141
142142 pub fn addLibDirFmt(self: *NativePaths, comptime fmt: []const u8, args: var) !void {
143 const item = try std.fmt.allocPrint0(self.lib_dirs.allocator, fmt, args);
143 const item = try std.fmtstream.allocPrint0(self.lib_dirs.allocator, fmt, args);
144144 errdefer self.lib_dirs.allocator.free(item);
145145 try self.lib_dirs.append(item);
146146 }
......@@ -150,7 +150,7 @@ pub const NativePaths = struct {
150150 }
151151
152152 pub fn addWarningFmt(self: *NativePaths, comptime fmt: []const u8, args: var) !void {
153 const item = try std.fmt.allocPrint0(self.warnings.allocator, fmt, args);
153 const item = try std.fmtstream.allocPrint0(self.warnings.allocator, fmt, args);
154154 errdefer self.warnings.allocator.free(item);
155155 try self.warnings.append(item);
156156 }
src-self-hosted/compilation.zig+3-3
......@@ -1051,7 +1051,7 @@ pub const Compilation = struct {
10511051 }
10521052
10531053 fn addCompileError(self: *Compilation, tree_scope: *Scope.AstTree, span: Span, comptime fmt: []const u8, args: var) !void {
1054 const text = try std.fmt.allocPrint(self.gpa(), fmt, args);
1054 const text = try std.fmtstream.allocPrint(self.gpa(), fmt, args);
10551055 errdefer self.gpa().free(text);
10561056
10571057 const msg = try Msg.createFromScope(self, tree_scope, span, text);
......@@ -1061,7 +1061,7 @@ pub const Compilation = struct {
10611061 }
10621062
10631063 fn addCompileErrorCli(self: *Compilation, realpath: []const u8, comptime fmt: []const u8, args: var) !void {
1064 const text = try std.fmt.allocPrint(self.gpa(), fmt, args);
1064 const text = try std.fmtstream.allocPrint(self.gpa(), fmt, args);
10651065 errdefer self.gpa().free(text);
10661066
10671067 const msg = try Msg.createFromCli(self, realpath, text);
......@@ -1154,7 +1154,7 @@ pub const Compilation = struct {
11541154 const tmp_dir = try self.getTmpDir();
11551155 const file_prefix = self.getRandomFileName();
11561156
1157 const file_name = try std.fmt.allocPrint(self.gpa(), "{}{}", .{ file_prefix[0..], suffix });
1157 const file_name = try std.fmtstream.allocPrint(self.gpa(), "{}{}", .{ file_prefix[0..], suffix });
11581158 defer self.gpa().free(file_name);
11591159
11601160 const full_path = try fs.path.join(self.gpa(), &[_][]const u8{ tmp_dir, file_name[0..] });
src-self-hosted/dep_tokenizer.zig+1-1
......@@ -894,7 +894,7 @@ fn printSection(out: var, label: []const u8, bytes: []const u8) !void {
894894
895895fn printLabel(out: var, label: []const u8, bytes: []const u8) !void {
896896 var buf: [80]u8 = undefined;
897 var text = try std.fmt.bufPrint(buf[0..], "{} {} bytes ", .{ label, bytes.len });
897 var text = try std.fmtstream.bufPrint(buf[0..], "{} {} bytes ", .{ label, bytes.len });
898898 try out.write(text);
899899 var i: usize = text.len;
900900 const end = 79;
src-self-hosted/libc_installation.zig+1-1
......@@ -543,7 +543,7 @@ fn ccPrintFileName(args: CCPrintFileNameOptions) ![:0]u8 {
543543 const allocator = args.allocator;
544544
545545 const cc_exe = std.os.getenvZ("CC") orelse default_cc_exe;
546 const arg1 = try std.fmt.allocPrint(allocator, "-print-file-name={}", .{args.search_basename});
546 const arg1 = try std.fmtstream.allocPrint(allocator, "-print-file-name={}", .{args.search_basename});
547547 defer allocator.free(arg1);
548548 const argv = [_][]const u8{ cc_exe, arg1 };
549549
src-self-hosted/link.zig+10-10
......@@ -296,13 +296,13 @@ fn constructLinkerArgsCoff(ctx: *Context) !void {
296296
297297 const is_library = ctx.comp.kind == .Lib;
298298
299 const out_arg = try std.fmt.allocPrint(&ctx.arena.allocator, "-OUT:{}\x00", .{ctx.out_file_path.toSliceConst()});
299 const out_arg = try std.fmtstream.allocPrint(&ctx.arena.allocator, "-OUT:{}\x00", .{ctx.out_file_path.toSliceConst()});
300300 try ctx.args.append(@ptrCast([*:0]const u8, out_arg.ptr));
301301
302302 if (ctx.comp.haveLibC()) {
303 try ctx.args.append(@ptrCast([*:0]const u8, (try std.fmt.allocPrint(&ctx.arena.allocator, "-LIBPATH:{}\x00", .{ctx.libc.msvc_lib_dir.?})).ptr));
304 try ctx.args.append(@ptrCast([*:0]const u8, (try std.fmt.allocPrint(&ctx.arena.allocator, "-LIBPATH:{}\x00", .{ctx.libc.kernel32_lib_dir.?})).ptr));
305 try ctx.args.append(@ptrCast([*:0]const u8, (try std.fmt.allocPrint(&ctx.arena.allocator, "-LIBPATH:{}\x00", .{ctx.libc.lib_dir.?})).ptr));
303 try ctx.args.append(@ptrCast([*:0]const u8, (try std.fmtstream.allocPrint(&ctx.arena.allocator, "-LIBPATH:{}\x00", .{ctx.libc.msvc_lib_dir.?})).ptr));
304 try ctx.args.append(@ptrCast([*:0]const u8, (try std.fmtstream.allocPrint(&ctx.arena.allocator, "-LIBPATH:{}\x00", .{ctx.libc.kernel32_lib_dir.?})).ptr));
305 try ctx.args.append(@ptrCast([*:0]const u8, (try std.fmtstream.allocPrint(&ctx.arena.allocator, "-LIBPATH:{}\x00", .{ctx.libc.lib_dir.?})).ptr));
306306 }
307307
308308 if (ctx.link_in_crt) {
......@@ -310,20 +310,20 @@ fn constructLinkerArgsCoff(ctx: *Context) !void {
310310 const d_str = if (ctx.comp.build_mode == .Debug) "d" else "";
311311
312312 if (ctx.comp.is_static) {
313 const cmt_lib_name = try std.fmt.allocPrint(&ctx.arena.allocator, "libcmt{}.lib\x00", .{d_str});
313 const cmt_lib_name = try std.fmtstream.allocPrint(&ctx.arena.allocator, "libcmt{}.lib\x00", .{d_str});
314314 try ctx.args.append(@ptrCast([*:0]const u8, cmt_lib_name.ptr));
315315 } else {
316 const msvcrt_lib_name = try std.fmt.allocPrint(&ctx.arena.allocator, "msvcrt{}.lib\x00", .{d_str});
316 const msvcrt_lib_name = try std.fmtstream.allocPrint(&ctx.arena.allocator, "msvcrt{}.lib\x00", .{d_str});
317317 try ctx.args.append(@ptrCast([*:0]const u8, msvcrt_lib_name.ptr));
318318 }
319319
320 const vcruntime_lib_name = try std.fmt.allocPrint(&ctx.arena.allocator, "{}vcruntime{}.lib\x00", .{
320 const vcruntime_lib_name = try std.fmtstream.allocPrint(&ctx.arena.allocator, "{}vcruntime{}.lib\x00", .{
321321 lib_str,
322322 d_str,
323323 });
324324 try ctx.args.append(@ptrCast([*:0]const u8, vcruntime_lib_name.ptr));
325325
326 const crt_lib_name = try std.fmt.allocPrint(&ctx.arena.allocator, "{}ucrt{}.lib\x00", .{ lib_str, d_str });
326 const crt_lib_name = try std.fmtstream.allocPrint(&ctx.arena.allocator, "{}ucrt{}.lib\x00", .{ lib_str, d_str });
327327 try ctx.args.append(@ptrCast([*:0]const u8, crt_lib_name.ptr));
328328
329329 // Visual C++ 2015 Conformance Changes
......@@ -383,7 +383,7 @@ fn constructLinkerArgsMachO(ctx: *Context) !void {
383383 .IPhoneOS => try ctx.args.append("-iphoneos_version_min"),
384384 .IPhoneOSSimulator => try ctx.args.append("-ios_simulator_version_min"),
385385 }
386 const ver_str = try std.fmt.allocPrint(&ctx.arena.allocator, "{}.{}.{}\x00", .{
386 const ver_str = try std.fmtstream.allocPrint(&ctx.arena.allocator, "{}.{}.{}\x00", .{
387387 platform.major,
388388 platform.minor,
389389 platform.micro,
......@@ -445,7 +445,7 @@ fn constructLinkerArgsMachO(ctx: *Context) !void {
445445 try ctx.args.append("-lSystem");
446446 } else {
447447 if (mem.indexOfScalar(u8, lib.name, '/') == null) {
448 const arg = try std.fmt.allocPrint(&ctx.arena.allocator, "-l{}\x00", .{lib.name});
448 const arg = try std.fmtstream.allocPrint(&ctx.arena.allocator, "-l{}\x00", .{lib.name});
449449 try ctx.args.append(@ptrCast([*:0]const u8, arg.ptr));
450450 } else {
451451 const arg = try std.cstr.addNullByte(&ctx.arena.allocator, lib.name);
src-self-hosted/print_targets.zig+1-1
......@@ -138,7 +138,7 @@ pub fn cmdTargets(
138138 for (available_glibcs) |glibc| {
139139 try jws.arrayElem();
140140
141 const tmp = try std.fmt.allocPrint(allocator, "{}", .{glibc});
141 const tmp = try std.fmtstream.allocPrint(allocator, "{}", .{glibc});
142142 defer allocator.free(tmp);
143143 try jws.emitString(tmp);
144144 }
src-self-hosted/test.zig+3-3
......@@ -81,7 +81,7 @@ pub const TestContext = struct {
8181 msg: []const u8,
8282 ) !void {
8383 var file_index_buf: [20]u8 = undefined;
84 const file_index = try std.fmt.bufPrint(file_index_buf[0..], "{}", .{self.file_index.incr()});
84 const file_index = try std.fmtstream.bufPrint(file_index_buf[0..], "{}", .{self.file_index.incr()});
8585 const file1_path = try std.fs.path.join(allocator, [_][]const u8{ tmp_dir_name, file_index, file1 });
8686
8787 if (std.fs.path.dirname(file1_path)) |dirname| {
......@@ -114,10 +114,10 @@ pub const TestContext = struct {
114114 expected_output: []const u8,
115115 ) !void {
116116 var file_index_buf: [20]u8 = undefined;
117 const file_index = try std.fmt.bufPrint(file_index_buf[0..], "{}", .{self.file_index.incr()});
117 const file_index = try std.fmtstream.bufPrint(file_index_buf[0..], "{}", .{self.file_index.incr()});
118118 const file1_path = try std.fs.path.join(allocator, [_][]const u8{ tmp_dir_name, file_index, file1 });
119119
120 const output_file = try std.fmt.allocPrint(allocator, "{}-out{}", .{ file1_path, (Target{ .Native = {} }).exeFileExt() });
120 const output_file = try std.fmtstream.allocPrint(allocator, "{}-out{}", .{ file1_path, (Target{ .Native = {} }).exeFileExt() });
121121 if (std.fs.path.dirname(file1_path)) |dirname| {
122122 try std.fs.cwd().makePath(dirname);
123123 }
src-self-hosted/type.zig+4-4
......@@ -581,7 +581,7 @@ pub const Type = struct {
581581 errdefer comp.gpa().destroy(self);
582582
583583 const u_or_i = "ui"[@boolToInt(key.is_signed)];
584 const name = try std.fmt.allocPrint(comp.gpa(), "{c}{}", .{ u_or_i, key.bit_count });
584 const name = try std.fmtstream.allocPrint(comp.gpa(), "{c}{}", .{ u_or_i, key.bit_count });
585585 errdefer comp.gpa().free(name);
586586
587587 self.base.init(comp, .Int, name);
......@@ -764,13 +764,13 @@ pub const Type = struct {
764764 .Non => "",
765765 };
766766 const name = switch (self.key.alignment) {
767 .Abi => try std.fmt.allocPrint(comp.gpa(), "{}{}{}{}", .{
767 .Abi => try std.fmtstream.allocPrint(comp.gpa(), "{}{}{}{}", .{
768768 size_str,
769769 mut_str,
770770 vol_str,
771771 self.key.child_type.name,
772772 }),
773 .Override => |alignment| try std.fmt.allocPrint(comp.gpa(), "{}align<{}> {}{}{}", .{
773 .Override => |alignment| try std.fmtstream.allocPrint(comp.gpa(), "{}align<{}> {}{}{}", .{
774774 size_str,
775775 alignment,
776776 mut_str,
......@@ -845,7 +845,7 @@ pub const Type = struct {
845845 };
846846 errdefer comp.gpa().destroy(self);
847847
848 const name = try std.fmt.allocPrint(comp.gpa(), "[{}]{}", .{ key.len, key.elem_type.name });
848 const name = try std.fmtstream.allocPrint(comp.gpa(), "[{}]{}", .{ key.len, key.elem_type.name });
849849 errdefer comp.gpa().free(name);
850850
851851 self.base.init(comp, .Array, name);
test/src/compare_output.zig+4-4
......@@ -4,7 +4,7 @@ const std = @import("std");
44const builtin = std.builtin;
55const build = std.build;
66const ArrayList = std.ArrayList;
7const fmt = std.fmt;
7const fmtstream = std.fmtstream;
88const mem = std.mem;
99const fs = std.fs;
1010const warn = std.debug.warn;
......@@ -97,7 +97,7 @@ pub const CompareOutputContext = struct {
9797
9898 switch (case.special) {
9999 Special.Asm => {
100 const annotated_case_name = fmt.allocPrint(self.b.allocator, "assemble-and-link {}", .{
100 const annotated_case_name = fmtstream.allocPrint(self.b.allocator, "assemble-and-link {}", .{
101101 case.name,
102102 }) catch unreachable;
103103 if (self.test_filter) |filter| {
......@@ -116,7 +116,7 @@ pub const CompareOutputContext = struct {
116116 },
117117 Special.None => {
118118 for (self.modes) |mode| {
119 const annotated_case_name = fmt.allocPrint(self.b.allocator, "{} {} ({})", .{
119 const annotated_case_name = fmtstream.allocPrint(self.b.allocator, "{} {} ({})", .{
120120 "compare-output",
121121 case.name,
122122 @tagName(mode),
......@@ -141,7 +141,7 @@ pub const CompareOutputContext = struct {
141141 }
142142 },
143143 Special.RuntimeSafety => {
144 const annotated_case_name = fmt.allocPrint(self.b.allocator, "safety {}", .{case.name}) catch unreachable;
144 const annotated_case_name = fmtstream.allocPrint(self.b.allocator, "safety {}", .{case.name}) catch unreachable;
145145 if (self.test_filter) |filter| {
146146 if (mem.indexOf(u8, annotated_case_name, filter) == null) return;
147147 }
test/src/run_translated_c.zig+2-2
......@@ -3,7 +3,7 @@
33const std = @import("std");
44const build = std.build;
55const ArrayList = std.ArrayList;
6const fmt = std.fmt;
6const fmtstream = std.fmtstream;
77const mem = std.mem;
88const fs = std.fs;
99const warn = std.debug.warn;
......@@ -76,7 +76,7 @@ pub const RunTranslatedCContext = struct {
7676 pub fn addCase(self: *RunTranslatedCContext, case: *const TestCase) void {
7777 const b = self.b;
7878
79 const annotated_case_name = fmt.allocPrint(self.b.allocator, "run-translated-c {}", .{case.name}) catch unreachable;
79 const annotated_case_name = fmtstream.allocPrint(self.b.allocator, "run-translated-c {}", .{case.name}) catch unreachable;
8080 if (self.test_filter) |filter| {
8181 if (mem.indexOf(u8, annotated_case_name, filter) == null) return;
8282 }
test/src/translate_c.zig+2-2
......@@ -3,7 +3,7 @@
33const std = @import("std");
44const build = std.build;
55const ArrayList = std.ArrayList;
6const fmt = std.fmt;
6const fmtstream = std.fmtstream;
77const mem = std.mem;
88const fs = std.fs;
99const warn = std.debug.warn;
......@@ -99,7 +99,7 @@ pub const TranslateCContext = struct {
9999 const b = self.b;
100100
101101 const translate_c_cmd = "translate-c";
102 const annotated_case_name = fmt.allocPrint(self.b.allocator, "{} {}", .{ translate_c_cmd, case.name }) catch unreachable;
102 const annotated_case_name = fmtstream.allocPrint(self.b.allocator, "{} {}", .{ translate_c_cmd, case.name }) catch unreachable;
103103 if (self.test_filter) |filter| {
104104 if (mem.indexOf(u8, annotated_case_name, filter) == null) return;
105105 }
test/tests.zig+5-5
......@@ -8,7 +8,7 @@ const Buffer = std.Buffer;
88const io = std.io;
99const fs = std.fs;
1010const mem = std.mem;
11const fmt = std.fmt;
11const fmtstream = std.fmtstream;
1212const ArrayList = std.ArrayList;
1313const Mode = builtin.Mode;
1414const LibExeObjStep = build.LibExeObjStep;
......@@ -484,7 +484,7 @@ pub const StackTracesContext = struct {
484484 const expect_for_mode = expect[@enumToInt(mode)];
485485 if (expect_for_mode.len == 0) continue;
486486
487 const annotated_case_name = fmt.allocPrint(self.b.allocator, "{} {} ({})", .{
487 const annotated_case_name = fmtstream.allocPrint(self.b.allocator, "{} {} ({})", .{
488488 "stack-trace",
489489 name,
490490 @tagName(mode),
......@@ -943,7 +943,7 @@ pub const CompileErrorContext = struct {
943943 pub fn addCase(self: *CompileErrorContext, case: *const TestCase) void {
944944 const b = self.b;
945945
946 const annotated_case_name = fmt.allocPrint(self.b.allocator, "compile-error {}", .{
946 const annotated_case_name = fmtstream.allocPrint(self.b.allocator, "compile-error {}", .{
947947 case.name,
948948 }) catch unreachable;
949949 if (self.test_filter) |filter| {
......@@ -1009,7 +1009,7 @@ pub const StandaloneContext = struct {
10091009 const b = self.b;
10101010
10111011 for (self.modes) |mode| {
1012 const annotated_case_name = fmt.allocPrint(self.b.allocator, "build {} ({})", .{
1012 const annotated_case_name = fmtstream.allocPrint(self.b.allocator, "build {} ({})", .{
10131013 root_src,
10141014 @tagName(mode),
10151015 }) catch unreachable;
......@@ -1152,7 +1152,7 @@ pub const GenHContext = struct {
11521152 const b = self.b;
11531153
11541154 const mode = builtin.Mode.Debug;
1155 const annotated_case_name = fmt.allocPrint(self.b.allocator, "gen-h {} ({})", .{ case.name, @tagName(mode) }) catch unreachable;
1155 const annotated_case_name = fmtstream.allocPrint(self.b.allocator, "gen-h {} ({})", .{ case.name, @tagName(mode) }) catch unreachable;
11561156 if (self.test_filter) |filter| {
11571157 if (mem.indexOf(u8, annotated_case_name, filter) == null) return;
11581158 }
tools/process_headers.zig+2-2
......@@ -299,7 +299,7 @@ pub fn main() !void {
299299 std.debug.warn("unrecognized C ABI: {}\n", .{abi_name});
300300 usageAndExit(args[0]);
301301 };
302 const generic_name = try std.fmt.allocPrint(allocator, "generic-{}", .{abi_name});
302 const generic_name = try std.fmtstream.allocPrint(allocator, "generic-{}", .{abi_name});
303303
304304 // TODO compiler crashed when I wrote this the canonical way
305305 var libc_targets: []const LibCTarget = undefined;
......@@ -440,7 +440,7 @@ pub fn main() !void {
440440 .specific => |a| @tagName(a),
441441 else => @tagName(dest_target.arch),
442442 };
443 const out_subpath = try std.fmt.allocPrint(allocator, "{}-{}-{}", .{
443 const out_subpath = try std.fmtstream.allocPrint(allocator, "{}-{}-{}", .{
444444 arch_name,
445445 @tagName(dest_target.os),
446446 @tagName(dest_target.abi),
tools/update_glibc.zig+2-2
......@@ -1,6 +1,6 @@
11const std = @import("std");
22const fs = std.fs;
3const fmt = std.fmt;
3const fmtstream = std.fmtstream;
44const assert = std.debug.assert;
55
66// Example abilist path:
......@@ -154,7 +154,7 @@ pub fn main() !void {
154154 const fn_set = &target_funcs_gop.kv.value.list;
155155
156156 for (lib_names) |lib_name, lib_name_index| {
157 const basename = try fmt.allocPrint(allocator, "lib{}.abilist", .{lib_name});
157 const basename = try fmtstream.allocPrint(allocator, "lib{}.abilist", .{lib_name});
158158 const abi_list_filename = blk: {
159159 if (abi_list.targets[0].abi == .gnuabi64 and std.mem.eql(u8, lib_name, "c")) {
160160 break :blk try fs.path.join(allocator, &[_][]const u8{ prefix, abi_list.path, "n64", basename });