mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
make vet happy, thread_local heap
This commit is contained in:
@@ -101,8 +101,8 @@ MMAP_FLAGS :: unix.MAP_ANONYMOUS | unix.MAP_PRIVATE
|
|||||||
MMAP_PROT :: unix.PROT_READ | unix.PROT_WRITE
|
MMAP_PROT :: unix.PROT_READ | unix.PROT_WRITE
|
||||||
|
|
||||||
|
|
||||||
//@thread_local _local_region: ^Region
|
@thread_local _local_region: ^Region
|
||||||
_local_region: ^Region
|
//_local_region: ^Region
|
||||||
global_regions: ^Region
|
global_regions: ^Region
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package os2
|
|||||||
|
|
||||||
import "core:strings"
|
import "core:strings"
|
||||||
import "core:sys/unix"
|
import "core:sys/unix"
|
||||||
import "core:path/filepath"
|
|
||||||
|
|
||||||
_Path_Separator :: '/'
|
_Path_Separator :: '/'
|
||||||
_Path_List_Separator :: ':'
|
_Path_List_Separator :: ':'
|
||||||
@@ -127,23 +126,22 @@ _remove_all :: proc(path: string) -> Error {
|
|||||||
defer delete(buf)
|
defer delete(buf)
|
||||||
|
|
||||||
loop: for {
|
loop: for {
|
||||||
res := unix.sys_getdents64(int(dfd), &buf[0], n)
|
getdents_res := unix.sys_getdents64(int(dfd), &buf[0], n)
|
||||||
switch res {
|
switch getdents_res {
|
||||||
case -EINVAL:
|
case -EINVAL:
|
||||||
delete(buf)
|
delete(buf)
|
||||||
n *= 2
|
n *= 2
|
||||||
buf = make([]u8, n)
|
buf = make([]u8, n)
|
||||||
continue loop
|
continue loop
|
||||||
case -4096..<0:
|
case -4096..<0:
|
||||||
return _get_platform_error(res)
|
return _get_platform_error(getdents_res)
|
||||||
case 0:
|
case 0:
|
||||||
break loop
|
break loop
|
||||||
}
|
}
|
||||||
|
|
||||||
d: ^dirent64
|
d: ^dirent64
|
||||||
|
|
||||||
for i := 0; i < res; i += int(d.d_reclen) {
|
for i := 0; i < getdents_res; i += int(d.d_reclen) {
|
||||||
description: string
|
|
||||||
d = (^dirent64)(rawptr(&buf[i]))
|
d = (^dirent64)(rawptr(&buf[i]))
|
||||||
d_name_cstr := cstring(&d.d_name[0])
|
d_name_cstr := cstring(&d.d_name[0])
|
||||||
|
|
||||||
@@ -159,7 +157,7 @@ _remove_all :: proc(path: string) -> Error {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
res: int
|
unlink_res: int
|
||||||
|
|
||||||
switch d.d_type {
|
switch d.d_type {
|
||||||
case DT_DIR:
|
case DT_DIR:
|
||||||
@@ -169,13 +167,13 @@ _remove_all :: proc(path: string) -> Error {
|
|||||||
}
|
}
|
||||||
defer unix.sys_close(handle_i)
|
defer unix.sys_close(handle_i)
|
||||||
_remove_all_dir(Handle(handle_i)) or_return
|
_remove_all_dir(Handle(handle_i)) or_return
|
||||||
res = unix.sys_unlinkat(int(dfd), d_name_cstr, int(unix.AT_REMOVEDIR))
|
unlink_res = unix.sys_unlinkat(int(dfd), d_name_cstr, int(unix.AT_REMOVEDIR))
|
||||||
case:
|
case:
|
||||||
res = unix.sys_unlinkat(int(dfd), d_name_cstr)
|
unlink_res = unix.sys_unlinkat(int(dfd), d_name_cstr)
|
||||||
}
|
}
|
||||||
|
|
||||||
if res < 0 {
|
if unlink_res < 0 {
|
||||||
return _get_platform_error(res)
|
return _get_platform_error(unlink_res)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
package os2
|
package os2
|
||||||
|
|
||||||
import "core:time"
|
import "core:time"
|
||||||
import "core:strings"
|
|
||||||
import "core:sys/unix"
|
import "core:sys/unix"
|
||||||
import "core:path/filepath"
|
import "core:path/filepath"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user