mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Minor clean ups
This commit is contained in:
@@ -156,7 +156,7 @@ _read :: proc(f: ^File_Impl, p: []byte) -> (i64, Error) {
|
|||||||
if errno != .NONE {
|
if errno != .NONE {
|
||||||
return -1, _get_platform_error(errno)
|
return -1, _get_platform_error(errno)
|
||||||
}
|
}
|
||||||
return i64(n), n == 0 ? io.Error.EOF : nil
|
return i64(n), io.Error.EOF if n == 0 else nil
|
||||||
}
|
}
|
||||||
|
|
||||||
_read_at :: proc(f: ^File_Impl, p: []byte, offset: i64) -> (i64, Error) {
|
_read_at :: proc(f: ^File_Impl, p: []byte, offset: i64) -> (i64, Error) {
|
||||||
|
|||||||
@@ -47,10 +47,8 @@ _mkdir_all :: proc(path: string, perm: int) -> Error {
|
|||||||
// skip consecutive '/'
|
// skip consecutive '/'
|
||||||
for i += 1; i < len(path) && path[i] == '/'; i += 1 {}
|
for i += 1; i < len(path) && path[i] == '/'; i += 1 {}
|
||||||
return mkdirat(new_dfd, path[i:], perm, has_created)
|
return mkdirat(new_dfd, path[i:], perm, has_created)
|
||||||
case:
|
|
||||||
return _get_platform_error(errno)
|
|
||||||
}
|
}
|
||||||
unreachable()
|
return _get_platform_error(errno)
|
||||||
}
|
}
|
||||||
TEMP_ALLOCATOR_GUARD()
|
TEMP_ALLOCATOR_GUARD()
|
||||||
// need something we can edit, and use to generate cstrings
|
// need something we can edit, and use to generate cstrings
|
||||||
@@ -74,11 +72,7 @@ _mkdir_all :: proc(path: string, perm: int) -> Error {
|
|||||||
|
|
||||||
has_created: bool
|
has_created: bool
|
||||||
mkdirat(dfd, path_bytes, perm, &has_created) or_return
|
mkdirat(dfd, path_bytes, perm, &has_created) or_return
|
||||||
if has_created {
|
return nil if has_created else .Exist
|
||||||
return nil
|
|
||||||
}
|
|
||||||
return .Exist
|
|
||||||
//return has_created ? nil : .Exist
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dirent64 :: struct {
|
dirent64 :: struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user