Shell");
var cmd_cont: bool = false;
@@ -984,7 +984,7 @@ fn genHtml(
tokenizer: *Tokenizer,
toc: *Toc,
code_dir: std.fs.Dir,
- out: anytype,
+ out: *Writer,
) !void {
for (toc.nodes) |node| {
switch (node) {
diff --git a/tools/doctest.zig b/tools/doctest.zig
index 2c8f14e913..9aa7262d7f 100644
--- a/tools/doctest.zig
+++ b/tools/doctest.zig
@@ -127,9 +127,9 @@ fn printOutput(
const obj_ext = builtin.object_format.fileExt(builtin.cpu.arch);
const print = std.debug.print;
- var shell_buffer = std.array_list.Managed(u8).init(arena);
+ var shell_buffer: std.Io.Writer.Allocating = .init(arena);
defer shell_buffer.deinit();
- var shell_out = shell_buffer.writer();
+ const shell_out = &shell_buffer.writer;
const code_name = std.fs.path.stem(input_path);
@@ -600,7 +600,7 @@ fn printOutput(
}
if (!code.just_check_syntax) {
- try printShell(out, shell_buffer.items, false);
+ try printShell(out, shell_buffer.written(), false);
}
}
@@ -975,25 +975,21 @@ fn skipPrefix(line: []const u8) []const u8 {
return line[3..];
}
-fn escapeHtml(allocator: Allocator, input: []const u8) ![]u8 {
- var buf = std.array_list.Managed(u8).init(allocator);
- defer buf.deinit();
-
- const out = buf.writer();
- try writeEscaped(out, input);
- return try buf.toOwnedSlice();
+fn escapeHtml(gpa: Allocator, input: []const u8) ![]u8 {
+ var allocating: Writer.Allocating = .init(gpa);
+ defer allocating.deinit();
+ try writeEscaped(&allocating.writer, input);
+ return allocating.toOwnedSlice();
}
-fn writeEscaped(out: *Writer, input: []const u8) !void {
- for (input) |c| {
- try switch (c) {
- '&' => out.writeAll("&"),
- '<' => out.writeAll("<"),
- '>' => out.writeAll(">"),
- '"' => out.writeAll("""),
- else => out.writeByte(c),
- };
- }
+fn writeEscaped(w: *Writer, input: []const u8) !void {
+ for (input) |c| try switch (c) {
+ '&' => w.writeAll("&"),
+ '<' => w.writeAll("<"),
+ '>' => w.writeAll(">"),
+ '"' => w.writeAll("""),
+ else => w.writeByte(c),
+ };
}
fn termColor(allocator: Allocator, input: []const u8) ![]u8 {