Compare commits
2 commits
b556c1da61
...
a0fa079a13
| Author | SHA1 | Date | |
|---|---|---|---|
| a0fa079a13 | |||
| ab4d1cdfa5 |
1 changed files with 4 additions and 14 deletions
|
|
@ -933,10 +933,10 @@ const Node = union(enum) {
|
|||
try node.right.store(writer, eol_mode);
|
||||
},
|
||||
.leaf => |*leaf| {
|
||||
_ = try writer.write(leaf.buf);
|
||||
try writer.writeAll(leaf.buf);
|
||||
if (leaf.eol) switch (eol_mode) {
|
||||
.lf => _ = try writer.write("\n"),
|
||||
.crlf => _ = try writer.write("\r\n"),
|
||||
.lf => try writer.writeByte('\n'),
|
||||
.crlf => try writer.writeAll("\r\n"),
|
||||
};
|
||||
},
|
||||
}
|
||||
|
|
@ -1374,17 +1374,7 @@ pub fn store_to_string(self: *const Self, allocator: Allocator, eol_mode: EolMod
|
|||
}
|
||||
|
||||
fn store_to_file_const(self: *const Self, writer: *std.Io.Writer) StoreToFileError!void {
|
||||
switch (builtin.os.tag) {
|
||||
.linux => {
|
||||
try self.root.store(writer, self.file_eol_mode);
|
||||
},
|
||||
else => {
|
||||
var content: std.Io.Writer.Allocating = .init(self.external_allocator);
|
||||
defer content.deinit();
|
||||
try self.root.store(&content.writer, self.file_eol_mode);
|
||||
try writer.writeAll(content.written());
|
||||
},
|
||||
}
|
||||
try writer.flush();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue