std.io.Writer.Allocating: rename interface to writer
This commit is contained in:
@@ -1380,8 +1380,8 @@ const MachODumper = struct {
|
||||
},
|
||||
macho.BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM => {
|
||||
name_buf.clearRetainingCapacity();
|
||||
try br.streamDelimiterLimit(&name_buf, 0, .limited(std.math.maxInt(u32)));
|
||||
try name_buf.writeByte(0);
|
||||
_ = try br.streamDelimiterLimit(&name_buf.writer, 0, .limited(std.math.maxInt(u32)));
|
||||
try name_buf.writer.writeByte(0);
|
||||
},
|
||||
macho.BIND_OPCODE_SET_ADDEND_SLEB => {
|
||||
addend = try br.takeLeb128(i64);
|
||||
@@ -1588,7 +1588,7 @@ const MachODumper = struct {
|
||||
|
||||
var aw: std.io.Writer.Allocating = .init(gpa);
|
||||
defer aw.deinit();
|
||||
const bw = &aw.interface;
|
||||
const bw = &aw.writer;
|
||||
|
||||
switch (check.kind) {
|
||||
.headers => {
|
||||
@@ -1741,7 +1741,7 @@ const ElfDumper = struct {
|
||||
|
||||
var aw: std.io.Writer.Allocating = .init(gpa);
|
||||
defer aw.deinit();
|
||||
const bw = &aw.interface;
|
||||
const bw = &aw.writer;
|
||||
|
||||
switch (check.kind) {
|
||||
.archive_symtab => if (ctx.symtab.len > 0) {
|
||||
@@ -1888,7 +1888,7 @@ const ElfDumper = struct {
|
||||
|
||||
var aw: std.io.Writer.Allocating = .init(gpa);
|
||||
defer aw.deinit();
|
||||
const bw = &aw.interface;
|
||||
const bw = &aw.writer;
|
||||
|
||||
switch (check.kind) {
|
||||
.headers => {
|
||||
@@ -2338,7 +2338,7 @@ const WasmDumper = struct {
|
||||
|
||||
var aw: std.io.Writer.Allocating = .init(gpa);
|
||||
defer aw.deinit();
|
||||
const bw = &aw.interface;
|
||||
const bw = &aw.writer;
|
||||
|
||||
parseAndDumpInner(step, check, &br, bw) catch |err| switch (err) {
|
||||
error.EndOfStream => try bw.writeAll("\n<UnexpectedEndOfStream>"),
|
||||
|
||||
@@ -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