From 0fe47a2f1b233dc6c6a9904c7601981601cb06ef Mon Sep 17 00:00:00 2001 From: Joshua Mark Manton Date: Wed, 2 Sep 2020 18:42:12 -0700 Subject: [PATCH] Add allocator parameter to os.read_entire_file() --- core/os/os.odin | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/os/os.odin b/core/os/os.odin index d9bb318c4..a81010942 100644 --- a/core/os/os.odin +++ b/core/os/os.odin @@ -65,7 +65,7 @@ file_size_from_path :: proc(path: string) -> i64 { return length; } -read_entire_file :: proc(name: string) -> (data: []byte, success: bool) { +read_entire_file :: proc(name: string, allocator := context.allocator) -> (data: []byte, success: bool) { fd, err := open(name, O_RDONLY, 0); if err != 0 { return nil, false; @@ -81,7 +81,7 @@ read_entire_file :: proc(name: string) -> (data: []byte, success: bool) { return nil, true; } - data = make([]byte, int(length)); + data = make([]byte, int(length), allocator); if data == nil { return nil, false; }