diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2022-02-16 17:24:29 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-16 17:24:29 +0100 |
| commit | 40e45368872bd75ebd63ea2199ee453d9677660a (patch) | |
| tree | b78364c87dcb1293a6dc7f8b3870ce6504f5f36b | |
| parent | 459ea5f4f6bbd30b02eacb330d2e6c72392c69a6 (diff) | |
| parent | 536bf61323230eddbeb4f36266b24e4b29425d1d (diff) | |
Merge pull request #1502 from colrdavidson/mainline-fast
avoid memset on stats
| -rw-r--r-- | core/os/os_linux.odin | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/core/os/os_linux.odin b/core/os/os_linux.odin index dfb4b7948..140b84d8a 100644 --- a/core/os/os_linux.odin +++ b/core/os/os_linux.odin @@ -611,7 +611,8 @@ _stat :: proc(path: string) -> (OS_Stat, Errno) { cstr := strings.clone_to_cstring(path) defer delete(cstr) - s: OS_Stat + // deliberately uninitialized; the syscall fills this buffer for us + s: OS_Stat = --- result := _unix_stat(cstr, &s) if result < 0 { return s, _get_errno(result) @@ -624,7 +625,8 @@ _lstat :: proc(path: string) -> (OS_Stat, Errno) { cstr := strings.clone_to_cstring(path) defer delete(cstr) - s: OS_Stat + // deliberately uninitialized; the syscall fills this buffer for us + s: OS_Stat = --- result := _unix_lstat(cstr, &s) if result < 0 { return s, _get_errno(result) @@ -634,7 +636,8 @@ _lstat :: proc(path: string) -> (OS_Stat, Errno) { @private _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) if result < 0 { return s, _get_errno(result) |