mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
avoid memset on stats
This commit is contained in:
@@ -611,7 +611,8 @@ _stat :: proc(path: string) -> (OS_Stat, Errno) {
|
|||||||
cstr := strings.clone_to_cstring(path)
|
cstr := strings.clone_to_cstring(path)
|
||||||
defer delete(cstr)
|
defer delete(cstr)
|
||||||
|
|
||||||
s: OS_Stat
|
// deliberately uninitialized; the syscall fills this buffer for us
|
||||||
|
s: OS_Stat = ---
|
||||||
result := _unix_stat(cstr, &s)
|
result := _unix_stat(cstr, &s)
|
||||||
if result < 0 {
|
if result < 0 {
|
||||||
return s, _get_errno(result)
|
return s, _get_errno(result)
|
||||||
@@ -624,7 +625,8 @@ _lstat :: proc(path: string) -> (OS_Stat, Errno) {
|
|||||||
cstr := strings.clone_to_cstring(path)
|
cstr := strings.clone_to_cstring(path)
|
||||||
defer delete(cstr)
|
defer delete(cstr)
|
||||||
|
|
||||||
s: OS_Stat
|
// deliberately uninitialized; the syscall fills this buffer for us
|
||||||
|
s: OS_Stat = ---
|
||||||
result := _unix_lstat(cstr, &s)
|
result := _unix_lstat(cstr, &s)
|
||||||
if result < 0 {
|
if result < 0 {
|
||||||
return s, _get_errno(result)
|
return s, _get_errno(result)
|
||||||
@@ -634,7 +636,8 @@ _lstat :: proc(path: string) -> (OS_Stat, Errno) {
|
|||||||
|
|
||||||
@private
|
@private
|
||||||
_fstat :: proc(fd: Handle) -> (OS_Stat, Errno) {
|
_fstat :: proc(fd: Handle) -> (OS_Stat, Errno) {
|
||||||
s: OS_Stat
|
// deliberately uninitialized; the syscall fills this buffer for us
|
||||||
|
s: OS_Stat = ---
|
||||||
result := _unix_fstat(fd, &s)
|
result := _unix_fstat(fd, &s)
|
||||||
if result < 0 {
|
if result < 0 {
|
||||||
return s, _get_errno(result)
|
return s, _get_errno(result)
|
||||||
|
|||||||
Reference in New Issue
Block a user