mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 14:48:47 +00:00
Make or_else and or_return operators (binary and suffix respectively)
This commit is contained in:
@@ -57,7 +57,7 @@ link_error_delete :: proc(lerr: Maybe(Link_Error)) {
|
||||
|
||||
|
||||
is_platform_error :: proc(ferr: Error) -> (err: i32, ok: bool) {
|
||||
v := or_else(ferr.(Platform_Error), {});
|
||||
v := ferr.(Platform_Error) or_else {};
|
||||
return v.err, v.err != 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ error_to_io_error :: proc(ferr: Error) -> io.Error {
|
||||
if ferr == nil {
|
||||
return .None;
|
||||
}
|
||||
return or_else(ferr.(io.Error), .Unknown);
|
||||
return ferr.(io.Error) or_else .Unknown;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ Thread_Os_Specific :: struct {
|
||||
thread_create :: proc(procedure: Thread_Proc) -> ^Thread {
|
||||
__windows_thread_entry_proc :: proc "stdcall" (t_: rawptr) -> win32.DWORD {
|
||||
t := (^Thread)(t_);
|
||||
context = or_else(t.init_context.?, runtime.default_context());
|
||||
context = t.init_context.? or_else runtime.default_context();
|
||||
|
||||
t.procedure(t);
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ _create :: proc(procedure: Thread_Proc, priority := Thread_Priority.Normal) -> ^
|
||||
t.start_gate = {};
|
||||
t.start_mutex = {};
|
||||
|
||||
context = or_else(t.init_context.?, runtime.default_context());
|
||||
context = t.init_context.? or_else runtime.default_context();
|
||||
|
||||
t.procedure(t);
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ _create :: proc(procedure: Thread_Proc, priority := Thread_Priority.Normal) -> ^
|
||||
|
||||
__windows_thread_entry_proc :: proc "stdcall" (t_: rawptr) -> win32.DWORD {
|
||||
t := (^Thread)(t_);
|
||||
context = or_else(t.init_context.?, runtime.default_context());
|
||||
context = t.init_context.? or_else runtime.default_context();
|
||||
|
||||
t.procedure(t);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user