mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-07 08:08:50 +00:00
Clean up error handling
This commit is contained in:
@@ -438,7 +438,7 @@ close :: proc(fd: Handle) -> Errno {
|
||||
if result == -1 {
|
||||
return Errno(get_last_error())
|
||||
}
|
||||
return ERROR_NONE
|
||||
return nil
|
||||
}
|
||||
|
||||
// If you read or write more than `INT_MAX` bytes, FreeBSD returns `EINVAL`.
|
||||
@@ -495,7 +495,7 @@ rename :: proc(old_path, new_path: string) -> Errno {
|
||||
if res == -1 {
|
||||
return Errno(get_last_error())
|
||||
}
|
||||
return ERROR_NONE
|
||||
return nil
|
||||
}
|
||||
|
||||
remove :: proc(path: string) -> Errno {
|
||||
@@ -505,7 +505,7 @@ remove :: proc(path: string) -> Errno {
|
||||
if res == -1 {
|
||||
return Errno(get_last_error())
|
||||
}
|
||||
return ERROR_NONE
|
||||
return nil
|
||||
}
|
||||
|
||||
make_directory :: proc(path: string, mode: mode_t = 0o775) -> Errno {
|
||||
@@ -515,7 +515,7 @@ make_directory :: proc(path: string, mode: mode_t = 0o775) -> Errno {
|
||||
if res == -1 {
|
||||
return Errno(get_last_error())
|
||||
}
|
||||
return ERROR_NONE
|
||||
return nil
|
||||
}
|
||||
|
||||
remove_directory :: proc(path: string) -> Errno {
|
||||
@@ -525,7 +525,7 @@ remove_directory :: proc(path: string) -> Errno {
|
||||
if res == -1 {
|
||||
return Errno(get_last_error())
|
||||
}
|
||||
return ERROR_NONE
|
||||
return nil
|
||||
}
|
||||
|
||||
is_file_handle :: proc(fd: Handle) -> bool {
|
||||
@@ -654,7 +654,7 @@ _closedir :: proc(dirp: Dir) -> Errno {
|
||||
if rc != 0 {
|
||||
return Errno(get_last_error())
|
||||
}
|
||||
return ERROR_NONE
|
||||
return nil
|
||||
}
|
||||
|
||||
@private
|
||||
@@ -803,7 +803,7 @@ set_current_directory :: proc(path: string) -> (err: Errno) {
|
||||
if res == -1 {
|
||||
return Errno(get_last_error())
|
||||
}
|
||||
return ERROR_NONE
|
||||
return nil
|
||||
}
|
||||
|
||||
exit :: proc "contextless" (code: int) -> ! {
|
||||
|
||||
Reference in New Issue
Block a user