diff options
| author | kristopher tate <kt@connectfree.co.jp> | 2018-06-21 00:40:21 +0900 |
|---|---|---|
| committer | kristopher tate <kt@connectfree.co.jp> | 2018-06-21 00:40:21 +0900 |
| commit | 71db8df5480f4d849480267574cd5491066e3868 (patch) | |
| tree | 1842ce3024d7254022c66d5a00c5e53488fcbeb8 /std/io.zig | |
| parent | 457c0f0a7e424177e7d8d00f4429da292b7c67d5 (diff) | |
| download | zig-71db8df5480f4d849480267574cd5491066e3868.tar.gz zig-71db8df5480f4d849480267574cd5491066e3868.zip | |
std: update stdlib to match updated allocator create signature; ref #733
Diffstat (limited to 'std/io.zig')
| -rw-r--r-- | std/io.zig | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/std/io.zig b/std/io.zig index cfe1a7f585..1c468f6f4f 100644 --- a/std/io.zig +++ b/std/io.zig @@ -414,14 +414,12 @@ pub const BufferedAtomicFile = struct { pub fn create(allocator: *mem.Allocator, dest_path: []const u8) !*BufferedAtomicFile { // TODO with well defined copy elision we don't need this allocation - var self = try allocator.create(BufferedAtomicFile); - errdefer allocator.destroy(self); - - self.* = BufferedAtomicFile{ + var self = try allocator.create(BufferedAtomicFile{ .atomic_file = undefined, .file_stream = undefined, .buffered_stream = undefined, - }; + }); + errdefer allocator.destroy(self); self.atomic_file = try os.AtomicFile.init(allocator, dest_path, os.default_file_mode); errdefer self.atomic_file.deinit(); |
