mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 23:28:48 +00:00
Clean up allocator stuff into allocators.odin
This commit is contained in:
@@ -46,15 +46,15 @@ full_path_from_name :: proc(name: string, allocator: runtime.Allocator) -> (path
|
||||
if name == "" {
|
||||
name = "."
|
||||
}
|
||||
_TEMP_ALLOCATOR_GUARD()
|
||||
TEMP_ALLOCATOR_GUARD()
|
||||
|
||||
p := win32.utf8_to_utf16(name, _temp_allocator())
|
||||
p := win32.utf8_to_utf16(name, temp_allocator())
|
||||
|
||||
n := win32.GetFullPathNameW(raw_data(p), 0, nil, nil)
|
||||
if n == 0 {
|
||||
return "", _get_platform_error()
|
||||
}
|
||||
buf := make([]u16, n+1, _temp_allocator())
|
||||
buf := make([]u16, n+1, temp_allocator())
|
||||
n = win32.GetFullPathNameW(raw_data(p), u32(len(buf)), raw_data(buf), nil)
|
||||
if n == 0 {
|
||||
return "", _get_platform_error()
|
||||
@@ -131,8 +131,8 @@ _cleanpath_from_handle :: proc(f: ^File, allocator: runtime.Allocator) -> (strin
|
||||
if n == 0 {
|
||||
return "", _get_platform_error()
|
||||
}
|
||||
_TEMP_ALLOCATOR_GUARD()
|
||||
buf := make([]u16, max(n, 260)+1, _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_from_buf(buf[:n], allocator)
|
||||
}
|
||||
@@ -147,8 +147,8 @@ _cleanpath_from_handle_u16 :: proc(f: ^File) -> ([]u16, Error) {
|
||||
if n == 0 {
|
||||
return nil, _get_platform_error()
|
||||
}
|
||||
_TEMP_ALLOCATOR_GUARD()
|
||||
buf := make([]u16, max(n, 260)+1, _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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user