From a20c09158aabda90bfb2b66bd3350b3c1178b03a Mon Sep 17 00:00:00 2001 From: gingerBill Date: Mon, 27 Oct 2025 18:51:51 +0000 Subject: Fix indentation --- core/mem/allocators.odin | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/mem/allocators.odin b/core/mem/allocators.odin index 5b0b178f8..eea7a5b4f 100644 --- a/core/mem/allocators.odin +++ b/core/mem/allocators.odin @@ -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) { -- cgit v1.2.3 From 4c8f99cd36ec05dca1b03a5935b92685549b5717 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Tue, 28 Oct 2025 10:57:53 +0000 Subject: Add `#caller_location` to `os2.read_entire_file` --- core/os/os2/file_util.odin | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/core/os/os2/file_util.odin b/core/os/os2/file_util.odin index 13d6db661..5934f02f5 100644 --- a/core/os/os2/file_util.odin +++ b/core/os/os2/file_util.odin @@ -107,17 +107,14 @@ read_entire_file :: proc{ } @(require_results) -read_entire_file_from_path :: proc(name: string, allocator: runtime.Allocator) -> (data: []byte, err: Error) { - f, ferr := open(name) - if ferr != nil { - return nil, ferr - } +read_entire_file_from_path :: proc(name: string, allocator: runtime.Allocator, loc := #caller_location) -> (data: []byte, err: Error) { + f := open(name) or_return defer close(f) - return read_entire_file_from_file(f, allocator) + return read_entire_file_from_file(f, allocator, loc) } @(require_results) -read_entire_file_from_file :: proc(f: ^File, allocator: runtime.Allocator) -> (data: []byte, err: Error) { +read_entire_file_from_file :: proc(f: ^File, allocator: runtime.Allocator, loc := #caller_location) -> (data: []byte, err: Error) { size: int has_size := false if size64, serr := file_size(f); serr == nil { @@ -129,7 +126,7 @@ read_entire_file_from_file :: proc(f: ^File, allocator: runtime.Allocator) -> (d if has_size && size > 0 { total: int - data = make([]byte, size, allocator) or_return + data = make([]byte, size, allocator, loc) or_return for total < len(data) { n: int n, err = read(f, data[total:]) @@ -145,13 +142,13 @@ read_entire_file_from_file :: proc(f: ^File, allocator: runtime.Allocator) -> (d return } else { buffer: [1024]u8 - out_buffer := make([dynamic]u8, 0, 0, allocator) + out_buffer := make([dynamic]u8, 0, 0, allocator, loc) total := 0 for { 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 -- cgit v1.2.3