Merge pull request #727 from JoshuaManton/master-fork

Add allocator parameter to os.read_entire_file()
This commit is contained in:
gingerBill
2020-09-03 08:37:22 +01:00
committed by GitHub
+2 -2
View File
@@ -70,7 +70,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;
@@ -86,7 +86,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;
}