diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-02-10 14:52:39 -0500 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-02-10 14:52:39 -0500 |
| commit | 8c31eaf2a87d39fe2f9ed8f5af2a059048bfffb3 (patch) | |
| tree | f4a88fab1589ee554bd74552db44360b4fbaeff7 /std/io.zig | |
| parent | a2bd9f8912ade5149855dc6e2371aaae49093660 (diff) | |
| download | zig-8c31eaf2a87d39fe2f9ed8f5af2a059048bfffb3.tar.gz zig-8c31eaf2a87d39fe2f9ed8f5af2a059048bfffb3.zip | |
std zig tokenizer: don't require 3 newlines at the end of the source
Diffstat (limited to 'std/io.zig')
| -rw-r--r-- | std/io.zig | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/std/io.zig b/std/io.zig index 9fca6aa6f7..7457416b29 100644 --- a/std/io.zig +++ b/std/io.zig @@ -524,16 +524,11 @@ pub fn writeFile(allocator: &mem.Allocator, path: []const u8, data: []const u8) /// On success, caller owns returned buffer. pub fn readFileAlloc(allocator: &mem.Allocator, path: []const u8) ![]u8 { - return readFileAllocExtra(allocator, path, 0); -} -/// On success, caller owns returned buffer. -/// Allocates extra_len extra bytes at the end of the file buffer, which are uninitialized. -pub fn readFileAllocExtra(allocator: &mem.Allocator, path: []const u8, extra_len: usize) ![]u8 { var file = try File.openRead(allocator, path); defer file.close(); const size = try file.getEndPos(); - const buf = try allocator.alloc(u8, size + extra_len); + const buf = try allocator.alloc(u8, size); errdefer allocator.free(buf); var adapter = FileInStream.init(&file); |
