diff options
| author | gingerBill <bill@gingerbill.org> | 2024-06-29 12:02:31 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2024-06-29 12:02:31 +0100 |
| commit | 4b71c47fd5e70f0f96e139e17637cf5de1beb2fc (patch) | |
| tree | 8540dd126a0e18b12c40864433c23dcd2a980f45 /core/sys/linux | |
| parent | 704530497b166dfa6fcee8f2c95a9e492a78a024 (diff) | |
Check for unneeded `transmute` with `-vet-cast`
Diffstat (limited to 'core/sys/linux')
| -rw-r--r-- | core/sys/linux/wrappers.odin | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/sys/linux/wrappers.odin b/core/sys/linux/wrappers.odin index 13073315d..95c818b9d 100644 --- a/core/sys/linux/wrappers.odin +++ b/core/sys/linux/wrappers.odin @@ -85,13 +85,13 @@ dirent_iterate_buf :: proc "contextless" (buf: []u8, offs: ^int) -> (d: ^Dirent, /// Obtain the name of dirent as a string /// The lifetime of the string is bound to the lifetime of the provided dirent structure dirent_name :: proc "contextless" (dirent: ^Dirent) -> string #no_bounds_check { - str := transmute([^]u8) &dirent.name + str := ([^]u8)(&dirent.name) // Note(flysand): The string size calculated above applies only to the ideal case // we subtract 1 byte from the string size, because a null terminator is guaranteed // to be present. But! That said, the dirents are aligned to 8 bytes and the padding // between the null terminator and the start of the next struct may be not initialized // which means we also have to scan these garbage bytes. - str_size := (cast(int) dirent.reclen) - 1 - cast(int) offset_of(Dirent, name) + str_size := int(dirent.reclen) - 1 - cast(int)offset_of(Dirent, name) // This skips *only* over the garbage, since if we're not garbage we're at nul terminator, // which skips this loop for str[str_size] != 0 { |