diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2025-10-28 11:13:34 +0100 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2026-02-08 12:44:05 +0100 |
| commit | e094de58746e2d982b6a23e28c5db2870b45d43d (patch) | |
| tree | a27c947ac792c10d9a88c74172468a03f5b143e8 | |
| parent | 4eab15130f1462f564f13f9a98ea54545088b411 (diff) | |
Add `loc := #caller_location` to `read_entire_file`
| -rw-r--r-- | core/encoding/hxa/read.odin | 4 | ||||
| -rw-r--r-- | core/os/os2/file_util.odin | 7 |
2 files changed, 7 insertions, 4 deletions
diff --git a/core/encoding/hxa/read.odin b/core/encoding/hxa/read.odin index 04dcab817..1f1c3633e 100644 --- a/core/encoding/hxa/read.odin +++ b/core/encoding/hxa/read.odin @@ -14,10 +14,10 @@ Read_Error :: enum { read_from_file :: proc(filename: string, print_error := false, allocator := context.allocator, loc := #caller_location) -> (file: File, err: Read_Error) { context.allocator = allocator - data, data_err := os.read_entire_file(filename, allocator) + data, data_err := os.read_entire_file(filename, allocator, loc) if data_err != nil { err = .Unable_To_Read_File - delete(data, allocator, loc) + delete(data, allocator) return } file, err = read(data, filename, print_error, allocator) diff --git a/core/os/os2/file_util.odin b/core/os/os2/file_util.odin index c2cf7c121..f81dc2190 100644 --- a/core/os/os2/file_util.odin +++ b/core/os/os2/file_util.odin @@ -156,9 +156,12 @@ 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 := open(name) or_return + f, ferr := open(name) + if ferr != nil { + return nil, ferr + } defer close(f) - return read_entire_file_from_file(f, allocator, loc) + return read_entire_file_from_file(f=f, allocator=allocator, loc=loc) } /* |