From 2ebb94fa729e50867ca882fd08acc64bab902ca3 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sun, 27 Sep 2020 00:31:29 +0100 Subject: [PATCH] Allow `os.read_dir` to use a different allocator --- core/os/dir_windows.odin | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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);