Clean up error handling

This commit is contained in:
gingerBill
2024-08-04 11:21:09 +01:00
parent 7dae38ce89
commit 29b6eebcd5
15 changed files with 118 additions and 135 deletions
+7 -7
View File
@@ -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) -> ! {