Luka Aleksić 4 years ago
parent
commit
ac184957db
2 changed files with 5 additions and 9 deletions
  1. 2 3
      core/os/dir_linux.odin
  2. 3 6
      core/os/os_linux.odin

+ 2 - 3
core/os/dir_linux.odin

@@ -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;

+ 3 - 6
core/os/os_linux.odin

@@ -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 = ".";