Merge branch 'master' into core_os2_revamp

This commit is contained in:
Jeroen van Rijn
2025-10-28 12:29:23 +01:00
committed by GitHub
2 changed files with 5 additions and 8 deletions

View File

@@ -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) {

View File

@@ -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