std.io.Writer.Allocating: rename interface to writer
This commit is contained in:
@@ -198,7 +198,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void {
|
||||
|
||||
var aw: std.io.Writer.Allocating = .init(gpa);
|
||||
defer aw.deinit();
|
||||
const bw = &aw.interface;
|
||||
const bw = &aw.writer;
|
||||
|
||||
const header_text = "This file was generated by ConfigHeader using the Zig Build System.";
|
||||
const c_generated_line = "/* " ++ header_text ++ " */\n";
|
||||
@@ -335,7 +335,7 @@ fn render_autoconf_at(
|
||||
) !void {
|
||||
const build = step.owner;
|
||||
const allocator = build.allocator;
|
||||
const bw = &aw.interface;
|
||||
const bw = &aw.writer;
|
||||
|
||||
const used = allocator.alloc(bool, values.count()) catch @panic("OOM");
|
||||
for (used) |*u| u.* = false;
|
||||
@@ -753,17 +753,17 @@ fn testReplaceVariablesAutoconfAt(
|
||||
expected: []const u8,
|
||||
values: std.StringArrayHashMap(Value),
|
||||
) !void {
|
||||
var output: std.io.Writer.Allocating = .init(allocator);
|
||||
defer output.deinit();
|
||||
var aw: std.io.Writer.Allocating = .init(allocator);
|
||||
defer aw.deinit();
|
||||
|
||||
const used = try allocator.alloc(bool, values.count());
|
||||
for (used) |*u| u.* = false;
|
||||
defer allocator.free(used);
|
||||
|
||||
try expand_variables_autoconf_at(&output.interface, contents, values, used);
|
||||
try expand_variables_autoconf_at(&aw.writer, contents, values, used);
|
||||
|
||||
for (used) |u| if (!u) return error.UnusedValue;
|
||||
try std.testing.expectEqualStrings(expected, output.getWritten());
|
||||
try std.testing.expectEqualStrings(expected, aw.getWritten());
|
||||
}
|
||||
|
||||
fn testReplaceVariablesCMake(
|
||||
|
||||
Reference in New Issue
Block a user