os2: Resolve temp allocator collisions

This commit is contained in:
Lucas Perlind
2025-05-08 17:41:01 +10:00
parent 4a709086a4
commit b9db1dd3e0
34 changed files with 319 additions and 314 deletions
+7 -7
View File
@@ -12,9 +12,9 @@ _lookup_env :: proc(key: string, allocator: runtime.Allocator) -> (value: string
return
}
TEMP_ALLOCATOR_GUARD()
temp_allocator := get_temp_allocator(TEMP_ALLOCATOR_GUARD({ allocator }))
ckey := strings.clone_to_cstring(key, temp_allocator())
ckey := strings.clone_to_cstring(key, temp_allocator)
cval := posix.getenv(ckey)
if cval == nil {
return
@@ -27,10 +27,10 @@ _lookup_env :: proc(key: string, allocator: runtime.Allocator) -> (value: string
}
_set_env :: proc(key, value: string) -> (err: Error) {
TEMP_ALLOCATOR_GUARD()
temp_allocator := get_temp_allocator(TEMP_ALLOCATOR_GUARD({}))
ckey := strings.clone_to_cstring(key, temp_allocator()) or_return
cval := strings.clone_to_cstring(value, temp_allocator()) or_return
ckey := strings.clone_to_cstring(key, temp_allocator) or_return
cval := strings.clone_to_cstring(value, temp_allocator) or_return
if posix.setenv(ckey, cval, true) != nil {
err = _get_platform_error_from_errno()
@@ -39,9 +39,9 @@ _set_env :: proc(key, value: string) -> (err: Error) {
}
_unset_env :: proc(key: string) -> (ok: bool) {
TEMP_ALLOCATOR_GUARD()
temp_allocator := get_temp_allocator(TEMP_ALLOCATOR_GUARD({}))
ckey := strings.clone_to_cstring(key, temp_allocator())
ckey := strings.clone_to_cstring(key, temp_allocator)
ok = posix.unsetenv(ckey) == .OK
return