diff options
| author | gingerBill <bill@gingerbill.org> | 2020-09-27 00:31:29 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-09-27 00:31:29 +0100 |
| commit | 2ebb94fa729e50867ca882fd08acc64bab902ca3 (patch) | |
| tree | f85a5b08630587a356bf740439afcde0303327b4 /core | |
| parent | 96a0125599746d93a07f887350ffedb6a556e2f0 (diff) | |
Allow `os.read_dir` to use a different allocator
Diffstat (limited to 'core')
| -rw-r--r-- | core/os/dir_windows.odin | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/core/os/dir_windows.odin b/core/os/dir_windows.odin index 78c7d357b..6b8fa5dbe 100644 --- a/core/os/dir_windows.odin +++ b/core/os/dir_windows.odin @@ -4,7 +4,7 @@ import win32 "core:sys/windows" import "core:strings" import "core:time" -read_dir :: proc(fd: Handle, n: int) -> (fi: []File_Info, err: Errno) { +read_dir :: proc(fd: Handle, n: int, allocator := context.allocator) -> (fi: []File_Info, err: Errno) { find_data_to_file_info :: proc(base_path: string, d: ^win32.WIN32_FIND_DATAW) -> (fi: File_Info) { // Ignore "." and ".." if d.cFileName[0] == '.' && d.cFileName[1] == 0 { @@ -53,6 +53,8 @@ read_dir :: proc(fd: Handle, n: int) -> (fi: []File_Info, err: Errno) { return nil, ERROR_INVALID_HANDLE; } + context.allocator = allocator; + h := win32.HANDLE(fd); dir_fi, _ := stat_from_file_information("", h); |