Browse Source

Add allocator parameter to os.read_entire_file()

Joshua Mark Manton 5 years ago
parent
commit
0fe47a2f1b
1 changed files with 2 additions and 2 deletions
  1. 2 2
      core/os/os.odin

+ 2 - 2
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;
 	}