mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-14 06:13:45 +00:00
Merge branch 'master' into core_os2_revamp
This commit is contained in:
@@ -99,8 +99,8 @@ panic_allocator :: proc() -> Allocator {
|
||||
panic_allocator_proc :: proc(
|
||||
allocator_data: rawptr,
|
||||
mode: Allocator_Mode,
|
||||
size, alignment: int,
|
||||
old_memory: rawptr,
|
||||
size, alignment: int,
|
||||
old_memory: rawptr,
|
||||
old_size: int,
|
||||
loc := #caller_location,
|
||||
) -> ([]byte, Allocator_Error) {
|
||||
|
||||
@@ -108,12 +108,9 @@ read_entire_file :: proc{
|
||||
|
||||
@(require_results)
|
||||
read_entire_file_from_path :: proc(name: string, allocator: runtime.Allocator, loc := #caller_location) -> (data: []byte, err: Error) {
|
||||
f, ferr := open(name)
|
||||
if ferr != nil {
|
||||
return nil, ferr
|
||||
}
|
||||
f := open(name) or_return
|
||||
defer close(f)
|
||||
return read_entire_file_from_file(f=f, allocator=allocator, loc=loc)
|
||||
return read_entire_file_from_file(f, allocator, loc)
|
||||
}
|
||||
|
||||
@(require_results)
|
||||
@@ -151,7 +148,7 @@ read_entire_file_from_file :: proc(f: ^File, allocator: runtime.Allocator, loc :
|
||||
n: int
|
||||
n, err = read(f, buffer[:])
|
||||
total += n
|
||||
append_elems(&out_buffer, ..buffer[:n]) or_return
|
||||
append_elems(&out_buffer, ..buffer[:n], loc=loc) or_return
|
||||
if err != nil {
|
||||
if err == .EOF || err == .Broken_Pipe {
|
||||
err = nil
|
||||
|
||||
Reference in New Issue
Block a user