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
@@ -419,7 +419,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 `SSIZE_MAX` bytes, OpenBSD returns `EINVAL`.
@@ -476,7 +476,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 {
@@ -486,7 +486,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 {
@@ -496,7 +496,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 {
@@ -506,7 +506,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 {
@@ -638,7 +638,7 @@ _closedir :: proc(dirp: Dir) -> Errno {
if rc != 0 {
return Errno(get_last_error())
}
return ERROR_NONE
return nil
}
@private
@@ -760,7 +760,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) -> ! {