mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 07:08:48 +00:00
Add allocator parameter to os.read_entire_file()
This commit is contained in:
+2
-2
@@ -65,7 +65,7 @@ file_size_from_path :: proc(path: string) -> i64 {
|
|||||||
return length;
|
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);
|
fd, err := open(name, O_RDONLY, 0);
|
||||||
if err != 0 {
|
if err != 0 {
|
||||||
return nil, false;
|
return nil, false;
|
||||||
@@ -81,7 +81,7 @@ read_entire_file :: proc(name: string) -> (data: []byte, success: bool) {
|
|||||||
return nil, true;
|
return nil, true;
|
||||||
}
|
}
|
||||||
|
|
||||||
data = make([]byte, int(length));
|
data = make([]byte, int(length), allocator);
|
||||||
if data == nil {
|
if data == nil {
|
||||||
return nil, false;
|
return nil, false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user