diff --git a/core/os/os2/dir_windows.odin b/core/os/os2/dir_windows.odin index b62c2528a..1b9675064 100644 --- a/core/os/os2/dir_windows.odin +++ b/core/os/os2/dir_windows.odin @@ -57,7 +57,6 @@ _read_directory_iterator :: proc(it: ^Read_Directory_Iterator) -> (fi: File_Info return } - assert(!is_temp(allocator)) TEMP_ALLOCATOR_GUARD() for !it.impl.no_more_files { @@ -139,4 +138,4 @@ _read_directory_iterator_destroy :: proc(it: ^Read_Directory_Iterator) { } file_info_delete(it.impl.prev_fi, file_allocator()) win32.FindClose(it.impl.find_handle) -} \ No newline at end of file +} diff --git a/core/os/os2/env_posix.odin b/core/os/os2/env_posix.odin index d7dc6d55a..eac7a1fea 100644 --- a/core/os/os2/env_posix.odin +++ b/core/os/os2/env_posix.odin @@ -12,8 +12,7 @@ _lookup_env :: proc(key: string, allocator: runtime.Allocator) -> (value: string return } - assert(!is_temp(allocator)) - TEMP_ALLOCATOR_GUARD() + TEMP_ALLOCATOR_GUARD(ignore=is_temp(allocator)) ckey := strings.clone_to_cstring(key, temp_allocator()) cval := posix.getenv(ckey) diff --git a/core/os/os2/env_windows.odin b/core/os/os2/env_windows.odin index 44485f4b2..0a2bab694 100644 --- a/core/os/os2/env_windows.odin +++ b/core/os/os2/env_windows.odin @@ -8,8 +8,7 @@ _lookup_env :: proc(key: string, allocator: runtime.Allocator) -> (value: string if key == "" { return } - assert(!is_temp(allocator)) - TEMP_ALLOCATOR_GUARD() + TEMP_ALLOCATOR_GUARD(ignore=is_temp(allocator)) wkey, _ := win32_utf8_to_wstring(key, temp_allocator()) n := win32.GetEnvironmentVariableW(wkey, nil, 0) diff --git a/core/os/os2/file_linux.odin b/core/os/os2/file_linux.odin index 6b981cca1..a26ccb09b 100644 --- a/core/os/os2/file_linux.odin +++ b/core/os/os2/file_linux.odin @@ -309,7 +309,7 @@ _read_link_cstr :: proc(name_cstr: cstring, allocator: runtime.Allocator) -> (st } _read_link :: proc(name: string, allocator: runtime.Allocator) -> (s: string, e: Error) { - TEMP_ALLOCATOR_GUARD() + TEMP_ALLOCATOR_GUARD(ignore=is_temp(allocator)) name_cstr := temp_cstring(name) or_return return _read_link_cstr(name_cstr, allocator) } diff --git a/core/os/os2/file_posix.odin b/core/os/os2/file_posix.odin index 123e288ef..efecf6e49 100644 --- a/core/os/os2/file_posix.odin +++ b/core/os/os2/file_posix.odin @@ -189,8 +189,7 @@ _symlink :: proc(old_name, new_name: string) -> Error { } _read_link :: proc(name: string, allocator: runtime.Allocator) -> (s: string, err: Error) { - assert(!is_temp(allocator)) - TEMP_ALLOCATOR_GUARD() + TEMP_ALLOCATOR_GUARD(ignore=is_temp(allocator)) cname := temp_cstring(name) buf: [dynamic]byte diff --git a/core/os/os2/file_windows.odin b/core/os/os2/file_windows.odin index 74067464b..1f5d268f3 100644 --- a/core/os/os2/file_windows.odin +++ b/core/os/os2/file_windows.odin @@ -609,7 +609,7 @@ _normalize_link_path :: proc(p: []u16, allocator: runtime.Allocator) -> (str: st return "", _get_platform_error() } - TEMP_ALLOCATOR_GUARD() + TEMP_ALLOCATOR_GUARD(ignore=is_temp(allocator)) buf := make([]u16, n+1, temp_allocator()) n = win32.GetFinalPathNameByHandleW(handle, raw_data(buf), u32(len(buf)), win32.VOLUME_NAME_DOS) @@ -635,7 +635,7 @@ _read_link :: proc(name: string, allocator: runtime.Allocator) -> (s: string, er @thread_local rdb_buf: [MAXIMUM_REPARSE_DATA_BUFFER_SIZE]byte - TEMP_ALLOCATOR_GUARD() + TEMP_ALLOCATOR_GUARD(ignore=is_temp(allocator)) p := _fix_long_path(name, temp_allocator()) or_return handle := _open_sym_link(p) or_return diff --git a/core/os/os2/path_windows.odin b/core/os/os2/path_windows.odin index 4aa695ee2..e8c34c750 100644 --- a/core/os/os2/path_windows.odin +++ b/core/os/os2/path_windows.odin @@ -108,7 +108,7 @@ _remove_all :: proc(path: string) -> Error { _get_working_directory :: proc(allocator: runtime.Allocator) -> (dir: string, err: Error) { win32.AcquireSRWLockExclusive(&cwd_lock) - TEMP_ALLOCATOR_GUARD() + TEMP_ALLOCATOR_GUARD(ignore=is_temp(allocator)) sz_utf16 := win32.GetCurrentDirectoryW(0, nil) dir_buf_wstr := make([]u16, sz_utf16, temp_allocator()) or_return diff --git a/core/os/os2/process_posix_darwin.odin b/core/os/os2/process_posix_darwin.odin index 9d30d13fd..0c902996b 100644 --- a/core/os/os2/process_posix_darwin.odin +++ b/core/os/os2/process_posix_darwin.odin @@ -237,8 +237,7 @@ _process_list :: proc(allocator: runtime.Allocator) -> (list: []int, err: Error) return } - assert(!is_temp(allocator)) - TEMP_ALLOCATOR_GUARD() + TEMP_ALLOCATOR_GUARD(ignore=is_temp(allocator)) buffer := make([]i32, ret, temp_allocator()) ret = darwin.proc_listallpids(raw_data(buffer), ret*size_of(i32)) diff --git a/core/os/os2/process_windows.odin b/core/os/os2/process_windows.odin index 47fd62401..a43ab3495 100644 --- a/core/os/os2/process_windows.odin +++ b/core/os/os2/process_windows.odin @@ -158,7 +158,7 @@ _process_info_by_pid :: proc(pid: int, selection: Process_Info_Fields, allocator _ = read_memory_as_struct(ph, process_peb.ProcessParameters, &process_params) or_return if selection >= {.Command_Line, .Command_Args} { - TEMP_ALLOCATOR_GUARD() + TEMP_ALLOCATOR_GUARD(ignore=is_temp(allocator)) cmdline_w := make([]u16, process_params.CommandLine.Length, temp_allocator()) or_return _ = read_memory_as_slice(ph, process_params.CommandLine.Buffer, cmdline_w) or_return @@ -172,7 +172,7 @@ _process_info_by_pid :: proc(pid: int, selection: Process_Info_Fields, allocator } } if .Environment in selection { - TEMP_ALLOCATOR_GUARD() + TEMP_ALLOCATOR_GUARD(ignore=is_temp(allocator)) env_len := process_params.EnvironmentSize / 2 envs_w := make([]u16, env_len, temp_allocator()) or_return _ = read_memory_as_slice(ph, process_params.Environment, envs_w) or_return @@ -181,7 +181,7 @@ _process_info_by_pid :: proc(pid: int, selection: Process_Info_Fields, allocator info.fields += {.Environment} } if .Working_Dir in selection { - TEMP_ALLOCATOR_GUARD() + TEMP_ALLOCATOR_GUARD(ignore=is_temp(allocator)) cwd_w := make([]u16, process_params.CurrentDirectoryPath.Length, temp_allocator()) or_return _ = read_memory_as_slice(ph, process_params.CurrentDirectoryPath.Buffer, cwd_w) or_return @@ -250,7 +250,7 @@ _process_info_by_handle :: proc(process: Process, selection: Process_Info_Fields _ = read_memory_as_struct(ph, process_peb.ProcessParameters, &process_params) or_return if selection >= {.Command_Line, .Command_Args} { - TEMP_ALLOCATOR_GUARD() + TEMP_ALLOCATOR_GUARD(ignore=is_temp(allocator)) cmdline_w := make([]u16, process_params.CommandLine.Length, temp_allocator()) or_return _ = read_memory_as_slice(ph, process_params.CommandLine.Buffer, cmdline_w) or_return @@ -265,7 +265,7 @@ _process_info_by_handle :: proc(process: Process, selection: Process_Info_Fields } if .Environment in selection { - TEMP_ALLOCATOR_GUARD() + TEMP_ALLOCATOR_GUARD(ignore=is_temp(allocator)) env_len := process_params.EnvironmentSize / 2 envs_w := make([]u16, env_len, temp_allocator()) or_return _ = read_memory_as_slice(ph, process_params.Environment, envs_w) or_return @@ -275,7 +275,7 @@ _process_info_by_handle :: proc(process: Process, selection: Process_Info_Fields } if .Working_Dir in selection { - TEMP_ALLOCATOR_GUARD() + TEMP_ALLOCATOR_GUARD(ignore=is_temp(allocator)) cwd_w := make([]u16, process_params.CurrentDirectoryPath.Length, temp_allocator()) or_return _ = read_memory_as_slice(ph, process_params.CurrentDirectoryPath.Buffer, cwd_w) or_return @@ -539,7 +539,7 @@ _process_exe_by_pid :: proc(pid: int, allocator: runtime.Allocator) -> (exe_path } _get_process_user :: proc(process_handle: win32.HANDLE, allocator: runtime.Allocator) -> (full_username: string, err: Error) { - TEMP_ALLOCATOR_GUARD() + TEMP_ALLOCATOR_GUARD(ignore=is_temp(allocator)) token_handle: win32.HANDLE if !win32.OpenProcessToken(process_handle, win32.TOKEN_QUERY, &token_handle) { err = _get_platform_error() diff --git a/core/os/os2/stat_linux.odin b/core/os/os2/stat_linux.odin index 2355a09f0..7704aaf20 100644 --- a/core/os/os2/stat_linux.odin +++ b/core/os/os2/stat_linux.odin @@ -48,8 +48,7 @@ _fstat_internal :: proc(fd: linux.Fd, allocator: runtime.Allocator) -> (fi: File // NOTE: _stat and _lstat are using _fstat to avoid a race condition when populating fullpath _stat :: proc(name: string, allocator: runtime.Allocator) -> (fi: File_Info, err: Error) { - assert(!is_temp(allocator)) - TEMP_ALLOCATOR_GUARD() + TEMP_ALLOCATOR_GUARD(ignore=is_temp(allocator)) name_cstr := temp_cstring(name) or_return fd, errno := linux.open(name_cstr, {}) @@ -61,8 +60,7 @@ _stat :: proc(name: string, allocator: runtime.Allocator) -> (fi: File_Info, err } _lstat :: proc(name: string, allocator: runtime.Allocator) -> (fi: File_Info, err: Error) { - assert(!is_temp(allocator)) - TEMP_ALLOCATOR_GUARD() + TEMP_ALLOCATOR_GUARD(ignore=is_temp(allocator)) name_cstr := temp_cstring(name) or_return fd, errno := linux.open(name_cstr, {.PATH, .NOFOLLOW}) diff --git a/core/os/os2/stat_posix.odin b/core/os/os2/stat_posix.odin index 2830a1f22..eb63febe7 100644 --- a/core/os/os2/stat_posix.odin +++ b/core/os/os2/stat_posix.odin @@ -70,8 +70,7 @@ _stat :: proc(name: string, allocator: runtime.Allocator) -> (fi: File_Info, err return } - assert(!is_temp(allocator)) - TEMP_ALLOCATOR_GUARD() + TEMP_ALLOCATOR_GUARD(ignore=is_temp(allocator)) cname := temp_cstring(name) or_return rcname := posix.realpath(cname) diff --git a/core/os/os2/stat_windows.odin b/core/os/os2/stat_windows.odin index d0b7c45a7..46505bfb7 100644 --- a/core/os/os2/stat_windows.odin +++ b/core/os/os2/stat_windows.odin @@ -45,8 +45,7 @@ full_path_from_name :: proc(name: string, allocator: runtime.Allocator) -> (path name = "." } - assert(!is_temp(allocator)) - TEMP_ALLOCATOR_GUARD() + TEMP_ALLOCATOR_GUARD(ignore=is_temp(allocator)) p := win32_utf8_to_utf16(name, temp_allocator()) or_return @@ -66,7 +65,7 @@ internal_stat :: proc(name: string, create_file_attributes: u32, allocator: runt if len(name) == 0 { return {}, .Not_Exist } - TEMP_ALLOCATOR_GUARD() + TEMP_ALLOCATOR_GUARD(ignore=is_temp(allocator)) wname := _fix_long_path(name, temp_allocator()) or_return fa: win32.WIN32_FILE_ATTRIBUTE_DATA @@ -130,8 +129,7 @@ _cleanpath_from_handle :: proc(f: ^File, allocator: runtime.Allocator) -> (strin return "", _get_platform_error() } - assert(!is_temp(allocator)) - TEMP_ALLOCATOR_GUARD() + TEMP_ALLOCATOR_GUARD(ignore=is_temp(allocator)) buf := make([]u16, max(n, 260)+1, temp_allocator()) n = win32.GetFinalPathNameByHandleW(h, raw_data(buf), u32(len(buf)), 0) @@ -149,9 +147,6 @@ _cleanpath_from_handle_u16 :: proc(f: ^File) -> ([]u16, Error) { return nil, _get_platform_error() } - assert(!is_temp(allocator)) - TEMP_ALLOCATOR_GUARD() - buf := make([]u16, max(n, 260)+1, temp_allocator()) n = win32.GetFinalPathNameByHandleW(h, raw_data(buf), u32(len(buf)), 0) return _cleanpath_strip_prefix(buf[:n]), nil diff --git a/core/os/os2/temp_file.odin b/core/os/os2/temp_file.odin index 5ca4e1453..d76dbe318 100644 --- a/core/os/os2/temp_file.odin +++ b/core/os/os2/temp_file.odin @@ -47,7 +47,7 @@ mkdir_temp :: make_directory_temp // If `dir` is an empty tring, `temp_directory()` will be used. @(require_results) make_directory_temp :: proc(dir, pattern: string, allocator: runtime.Allocator) -> (temp_path: string, err: Error) { - TEMP_ALLOCATOR_GUARD() + TEMP_ALLOCATOR_GUARD(ignore=is_temp(allocator)) dir := dir if dir != "" else temp_directory(temp_allocator()) or_return prefix, suffix := _prefix_and_suffix(pattern) or_return prefix = temp_join_path(dir, prefix) or_return diff --git a/core/os/os2/temp_file_linux.odin b/core/os/os2/temp_file_linux.odin index d6f90fbaf..3c6da2e23 100644 --- a/core/os/os2/temp_file_linux.odin +++ b/core/os/os2/temp_file_linux.odin @@ -4,7 +4,7 @@ package os2 import "base:runtime" _temp_dir :: proc(allocator: runtime.Allocator) -> (string, runtime.Allocator_Error) { - TEMP_ALLOCATOR_GUARD() + TEMP_ALLOCATOR_GUARD(ignore=is_temp(allocator)) tmpdir := get_env("TMPDIR", temp_allocator()) if tmpdir == "" { tmpdir = "/tmp" diff --git a/core/os/os2/temp_file_windows.odin b/core/os/os2/temp_file_windows.odin index d888eda52..f430d66ea 100644 --- a/core/os/os2/temp_file_windows.odin +++ b/core/os/os2/temp_file_windows.odin @@ -9,7 +9,7 @@ _temp_dir :: proc(allocator: runtime.Allocator) -> (string, runtime.Allocator_Er if n == 0 { return "", nil } - TEMP_ALLOCATOR_GUARD() + TEMP_ALLOCATOR_GUARD(ignore=is_temp(allocator)) b := make([]u16, max(win32.MAX_PATH, n), temp_allocator()) n = win32.GetTempPathW(u32(len(b)), raw_data(b))