diff --git a/core/debug/trace/trace_cpp.odin b/core/debug/trace/trace_cpp.odin index 894046c45..dc723184a 100644 --- a/core/debug/trace/trace_cpp.odin +++ b/core/debug/trace/trace_cpp.odin @@ -78,7 +78,7 @@ _Context :: struct { @(private="package") _init :: proc(ctx: ^Context) -> (ok: bool) { - defer if !ok do destroy(ctx) + defer if !ok { destroy(ctx) } ctx.impl.state = backtrace_create_state("odin-debug-trace", 1, nil, ctx) return ctx.impl.state != nil diff --git a/core/net/socket_darwin.odin b/core/net/socket_darwin.odin index 3f0e576c1..fc422b3a9 100644 --- a/core/net/socket_darwin.odin +++ b/core/net/socket_darwin.odin @@ -274,8 +274,7 @@ _set_option :: proc(s: Any_Socket, option: Socket_Option, value: any, loc := #ca .Linger, .Send_Timeout, .Receive_Timeout: - t, ok := value.(time.Duration) - if !ok do panic("set_option() value must be a time.Duration here", loc) + t := value.(time.Duration) or_else panic("set_option() value must be a time.Duration here", loc) micros := i64(time.duration_microseconds(t)) timeval_value.microseconds = int(micros % 1e6) diff --git a/core/net/socket_windows.odin b/core/net/socket_windows.odin index 3b9623749..eef0df583 100644 --- a/core/net/socket_windows.odin +++ b/core/net/socket_windows.odin @@ -263,12 +263,15 @@ _set_option :: proc(s: Any_Socket, option: Socket_Option, value: any, loc := #ca ptr = &bool_value len = size_of(bool_value) case .Linger: - t, ok := value.(time.Duration) - if !ok do panic("set_option() value must be a time.Duration here", loc) + t := value.(time.Duration) or_else panic("set_option() value must be a time.Duration here", loc) num_secs := i64(time.duration_seconds(t)) - if time.Duration(num_secs * 1e9) != t do return .Linger_Only_Supports_Whole_Seconds - if num_secs > i64(max(u16)) do return .Value_Out_Of_Range + if time.Duration(num_secs * 1e9) != t { + return .Linger_Only_Supports_Whole_Seconds + } + if num_secs > i64(max(u16)) { + return .Value_Out_Of_Range + } linger_value.l_onoff = 1 linger_value.l_linger = c.ushort(num_secs) @@ -277,8 +280,7 @@ _set_option :: proc(s: Any_Socket, option: Socket_Option, value: any, loc := #ca case .Receive_Timeout, .Send_Timeout: - t, ok := value.(time.Duration) - if !ok do panic("set_option() value must be a time.Duration here", loc) + t := value.(time.Duration) or_else panic("set_option() value must be a time.Duration here", loc) int_value = i32(time.duration_milliseconds(t)) ptr = &int_value diff --git a/core/os/os_freebsd.odin b/core/os/os_freebsd.odin index 97165b262..36ada0948 100644 --- a/core/os/os_freebsd.odin +++ b/core/os/os_freebsd.odin @@ -705,7 +705,9 @@ set_current_directory :: proc(path: string) -> (err: Errno) { runtime.DEFAULT_TEMP_ALLOCATOR_TEMP_GUARD() cstr := strings.clone_to_cstring(path, context.temp_allocator) res := _unix_chdir(cstr) - if res == -1 do return Errno(get_last_error()) + if res == -1 { + return Errno(get_last_error()) + } return ERROR_NONE } @@ -743,7 +745,9 @@ get_page_size :: proc() -> int { // NOTE(tetra): The page size never changes, so why do anything complicated // if we don't have to. @static page_size := -1 - if page_size != -1 do return page_size + if page_size != -1 { + return page_size + } page_size = int(_unix_getpagesize()) return page_size diff --git a/core/os/os_netbsd.odin b/core/os/os_netbsd.odin index c8f10d1da..2bda8abf7 100644 --- a/core/os/os_netbsd.odin +++ b/core/os/os_netbsd.odin @@ -714,7 +714,9 @@ set_current_directory :: proc(path: string) -> (err: Errno) { runtime.DEFAULT_TEMP_ALLOCATOR_TEMP_GUARD() cstr := strings.clone_to_cstring(path, context.temp_allocator) res := _unix_chdir(cstr) - if res == -1 do return Errno(get_last_error()) + if res == -1 { + return Errno(get_last_error()) + } return ERROR_NONE } @@ -755,7 +757,9 @@ get_page_size :: proc() -> int { // NOTE(tetra): The page size never changes, so why do anything complicated // if we don't have to. @static page_size := -1 - if page_size != -1 do return page_size + if page_size != -1 { + return page_size + } page_size = int(_unix_getpagesize()) return page_size diff --git a/core/sys/darwin/CoreFoundation/CFString.odin b/core/sys/darwin/CoreFoundation/CFString.odin index 4a167c604..6ad3c5bfc 100644 --- a/core/sys/darwin/CoreFoundation/CFString.odin +++ b/core/sys/darwin/CoreFoundation/CFString.odin @@ -192,7 +192,7 @@ StringCopyToOdinString :: proc( max := StringGetMaximumSizeForEncoding(length, StringEncoding(StringBuiltInEncodings.UTF8)) buf, err := make([]byte, max, allocator) - if err != nil do return + if err != nil { return } raw_str := runtime.Raw_String { data = raw_data(buf), diff --git a/vendor/ENet/win32.odin b/vendor/ENet/win32.odin index 1df35ee45..d05cf5d99 100644 --- a/vendor/ENet/win32.odin +++ b/vendor/ENet/win32.odin @@ -39,7 +39,9 @@ foreign WinSock2 { return } } - if s.fd_count >= FD_SETSIZE do return + if s.fd_count >= FD_SETSIZE { + return + } s.fd_array[s.fd_count] = fd s.fd_count += 1 }