authorgravatar for quae@daurnimator.comdaurnimator <quae@daurnimator.com> 2020-03-08 18:16:10+11:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-04-01 10:36:38-04:00
loge535057364d33819001e55d34d104916cfab1b91
treea4ae121967db52ff9d8b01bfa5dca3a5e81767da
parent3fb030e78a04ff5eebd4e01769099b799912b9fd
signaturelock-open Commit is signed but in an unrecognized format.

std: use std.ArrayList(u8).OutStream instead of std.Buffer.OutStream


5 files changed, 12 insertions(+), 11 deletions(-)

doc/docgen.zig+4-4
......@@ -321,7 +321,7 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc {
321321 var last_action = Action.Open;
322322 var last_columns: ?u8 = null;
323323
324 var toc_buf = try std.Buffer.initSize(allocator, 0);
324 var toc_buf = std.ArrayList(u8).init(allocator);
325325 defer toc_buf.deinit();
326326
327327 var toc = toc_buf.outStream();
......@@ -607,7 +607,7 @@ fn genToc(allocator: *mem.Allocator, tokenizer: *Tokenizer) !Toc {
607607}
608608
609609fn urlize(allocator: *mem.Allocator, input: []const u8) ![]u8 {
610 var buf = try std.Buffer.initSize(allocator, 0);
610 var buf = std.ArrayList(u8).init(allocator);
611611 defer buf.deinit();
612612
613613 const out = buf.outStream();
......@@ -626,7 +626,7 @@ fn urlize(allocator: *mem.Allocator, input: []const u8) ![]u8 {
626626}
627627
628628fn escapeHtml(allocator: *mem.Allocator, input: []const u8) ![]u8 {
629 var buf = try std.Buffer.initSize(allocator, 0);
629 var buf = std.ArrayList(u8).init(allocator);
630630 defer buf.deinit();
631631
632632 const out = buf.outStream();
......@@ -672,7 +672,7 @@ test "term color" {
672672}
673673
674674fn termColor(allocator: *mem.Allocator, input: []const u8) ![]u8 {
675 var buf = try std.Buffer.initSize(allocator, 0);
675 var buf = std.ArrayList(u8).init(allocator);
676676 defer buf.deinit();
677677
678678 var out = buf.outStream();
lib/std/zig/parser_test.zig+1-1
......@@ -2953,7 +2953,7 @@ fn testParse(source: []const u8, allocator: *mem.Allocator, anything_changed: *b
29532953 return error.ParseError;
29542954 }
29552955
2956 var buffer = try std.Buffer.initSize(allocator, 0);
2956 var buffer = std.ArrayList(u8).init(allocator);
29572957 errdefer buffer.deinit();
29582958
29592959 anything_changed.* = try std.zig.render(allocator, buffer.outStream(), tree);
src-self-hosted/errmsg.zig+2-2
......@@ -158,7 +158,7 @@ pub const Msg = struct {
158158 parse_error: *const ast.Error,
159159 ) !*Msg {
160160 const loc_token = parse_error.loc();
161 var text_buf = try std.Buffer.initSize(comp.gpa(), 0);
161 var text_buf = std.ArrayList(u8).init(comp.gpa());
162162 defer text_buf.deinit();
163163
164164 const realpath_copy = try mem.dupe(comp.gpa(), u8, tree_scope.root().realpath);
......@@ -197,7 +197,7 @@ pub const Msg = struct {
197197 realpath: []const u8,
198198 ) !*Msg {
199199 const loc_token = parse_error.loc();
200 var text_buf = try std.Buffer.initSize(allocator, 0);
200 var text_buf = std.ArrayList(u8).init(allocator);
201201 defer text_buf.deinit();
202202
203203 const realpath_copy = try mem.dupe(allocator, u8, realpath);
src-self-hosted/stage2.zig+3-2
......@@ -411,10 +411,11 @@ fn printErrMsgToFile(
411411 const start_loc = tree.tokenLocationPtr(0, first_token);
412412 const end_loc = tree.tokenLocationPtr(first_token.end, last_token);
413413
414 var text_buf = try std.Buffer.initSize(allocator, 0);
414 var text_buf = std.ArrayList(u8).init(allocator);
415 defer text_buf.deinit();
415416 const out_stream = &text_buf.outStream();
416417 try parse_error.render(&tree.tokens, out_stream);
417 const text = text_buf.toOwnedSlice();
418 const text = text_buf.span();
418419
419420 const stream = &file.outStream();
420421 try stream.print("{}:{}:{}: error: {}\n", .{ path, start_loc.line + 1, start_loc.column + 1, text });
src-self-hosted/type.zig+2-2
......@@ -387,10 +387,10 @@ pub const Type = struct {
387387 };
388388 errdefer comp.gpa().destroy(self);
389389
390 var name_buf = try std.Buffer.initSize(comp.gpa(), 0);
390 var name_buf = std.ArrayList(u8).init(comp.gpa());
391391 defer name_buf.deinit();
392392
393 const name_stream = &std.io.BufferOutStream.init(&name_buf).stream;
393 const name_stream = name_buf.outStream();
394394
395395 switch (key.data) {
396396 .Generic => |generic| {