mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-07 08:08:50 +00:00
use context.temp_allocator instead of general allocation + delete()
where clone_to_cstring is used with foreign code, it is prefered to use `context.temp_allocator` instead of using the general allocator and manually delete the memory after use.
This commit is contained in:
@@ -344,9 +344,8 @@ get_last_error_string :: proc() -> string {
|
||||
}
|
||||
|
||||
open :: proc(path: string, flags: int = O_RDWR, mode: int = 0) -> (Handle, Errno) {
|
||||
cstr := strings.clone_to_cstring(path)
|
||||
cstr := strings.clone_to_cstring(path, context.temp_allocator)
|
||||
handle := _unix_open(cstr, i32(flags), u16(mode))
|
||||
delete(cstr)
|
||||
if handle == -1 {
|
||||
return INVALID_HANDLE, 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user