Add runtime.DEFAULT_TEMP_ALLOCATOR_TEMP_GUARD where appropriate

This commit is contained in:
gingerBill
2023-02-10 16:23:33 +00:00
parent b427a4c8c9
commit 986cba584e
31 changed files with 201 additions and 60 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
package os
import "core:mem"
import "core:runtime"
read_dir :: proc(fd: Handle, n: int, allocator := context.allocator) -> (fi: []File_Info, err: Errno) {
dirp: Dir
@@ -50,7 +51,7 @@ read_dir :: proc(fd: Handle, n: int, allocator := context.allocator) -> (fi: []F
continue
}
fullpath := make([]byte, len(dirpath)+1+len(filename))
fullpath := make([]byte, len(dirpath)+1+len(filename), context.temp_allocator)
copy(fullpath, dirpath)
copy(fullpath[len(dirpath):], "/")
copy(fullpath[len(dirpath)+1:], filename)