This commit is contained in:
Luka Aleksić
2021-01-21 20:55:58 +01:00
parent 92e23ec397
commit ac184957db
2 changed files with 5 additions and 9 deletions

View File

@@ -1,6 +1,5 @@
package os
import "core:strconv"
import "core:strings"
import "core:mem"
@@ -53,8 +52,8 @@ read_dir :: proc(fd: Handle, n: int, allocator := context.allocator) -> (fi: []F
fi_, err = stat(fullpath);
if err != ERROR_NONE {
for fi_ in dfi {
file_info_delete(fi_);
for fi__ in dfi {
file_info_delete(fi__);
}
delete(dfi);
return;

View File

@@ -5,9 +5,8 @@ foreign import libc "system:c"
import "core:runtime"
import "core:strings"
import "core:strconv"
import "core:c"
import "core:mem"
import "core:strconv"
Handle :: distinct i32;
File_Time :: distinct u64;
@@ -492,7 +491,7 @@ _readlink :: inline proc(path: string) -> (string, Errno) {
// NOTE(laleksic, 2021-01-21): Any cleaner way to resize the slice?
bufsz *= 2;
delete(buf);
buf := make([]byte, bufsz);
buf = make([]byte, bufsz);
} else {
return strings.string_from_ptr(&buf[0], rc), ERROR_NONE;
}
@@ -500,7 +499,7 @@ _readlink :: inline proc(path: string) -> (string, Errno) {
}
absolute_path_from_handle :: proc(fd: Handle) -> (string, Errno) {
buf: [256]byte;
buf : [256]byte;
fd_str := strconv.itoa( buf[:], cast(int)fd );
procfs_path := strings.concatenate( []string{ "/proc/self/fd/", fd_str } );
@@ -510,8 +509,6 @@ absolute_path_from_handle :: proc(fd: Handle) -> (string, Errno) {
}
absolute_path_from_relative :: proc(rel: string) -> (path: string, err: Errno) {
ta := context.temp_allocator;
rel := rel;
if rel == "" {
rel = ".";