mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
Remove all uses of context stuff in os2
This commit is contained in:
+12
-10
@@ -3,7 +3,6 @@ package os2
|
||||
|
||||
import "core:time"
|
||||
import "base:runtime"
|
||||
import "core:strings"
|
||||
import "core:sys/unix"
|
||||
import "core:path/filepath"
|
||||
|
||||
@@ -112,8 +111,9 @@ _fstat_internal :: proc(fd: int, allocator: runtime.Allocator) -> (File_Info, Er
|
||||
}
|
||||
|
||||
// NOTE: _stat and _lstat are using _fstat to avoid a race condition when populating fullpath
|
||||
_stat :: proc(name: string, allocator: runtime.Allocator) -> (File_Info, Error) {
|
||||
name_cstr := strings.clone_to_cstring(name, context.temp_allocator)
|
||||
_stat :: proc(name: string, allocator: runtime.Allocator) -> (fi: File_Info, err: Error) {
|
||||
TEMP_ALLOCATOR_GUARD()
|
||||
name_cstr := temp_cstring(name) or_return
|
||||
|
||||
fd := unix.sys_open(name_cstr, _O_RDONLY)
|
||||
if fd < 0 {
|
||||
@@ -123,8 +123,9 @@ _stat :: proc(name: string, allocator: runtime.Allocator) -> (File_Info, Error)
|
||||
return _fstat_internal(fd, allocator)
|
||||
}
|
||||
|
||||
_lstat :: proc(name: string, allocator: runtime.Allocator) -> (File_Info, Error) {
|
||||
name_cstr := strings.clone_to_cstring(name, context.temp_allocator)
|
||||
_lstat :: proc(name: string, allocator: runtime.Allocator) -> (fi: File_Info, err: Error) {
|
||||
TEMP_ALLOCATOR_GUARD()
|
||||
name_cstr := temp_cstring(name) or_return
|
||||
|
||||
fd := unix.sys_open(name_cstr, _O_RDONLY | _O_PATH | _O_NOFOLLOW)
|
||||
if fd < 0 {
|
||||
@@ -138,8 +139,9 @@ _same_file :: proc(fi1, fi2: File_Info) -> bool {
|
||||
return fi1.fullpath == fi2.fullpath
|
||||
}
|
||||
|
||||
_stat_internal :: proc(name: string) -> (s: _Stat, res: int) {
|
||||
name_cstr := strings.clone_to_cstring(name, context.temp_allocator)
|
||||
res = unix.sys_stat(name_cstr, &s)
|
||||
return
|
||||
}
|
||||
// _stat_internal :: proc(name: string) -> (s: _Stat, res: int) {
|
||||
// TEMP_ALLOCATOR_GUARD()
|
||||
// name_cstr := temp_cstring(name) or_return
|
||||
// res = unix.sys_stat(name_cstr, &s)
|
||||
// return
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user