mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 06:38:47 +00:00
[core]: Remove do keyword from the core library
This commit is contained in:
+3
-1
@@ -462,7 +462,9 @@ split_port :: proc(endpoint_str: string) -> (addr_or_host: string, port: int, ok
|
||||
// Joins an address or hostname with a port.
|
||||
join_port :: proc(address_or_host: string, port: int, allocator := context.allocator) -> string {
|
||||
addr_or_host, _, ok := split_port(address_or_host)
|
||||
if !ok do return addr_or_host
|
||||
if !ok {
|
||||
return addr_or_host
|
||||
}
|
||||
|
||||
b := strings.builder_make(allocator)
|
||||
|
||||
|
||||
@@ -333,7 +333,9 @@ _set_option :: proc(sock: Any_Socket, option: Socket_Option, value: any, loc :=
|
||||
.Send_Timeout,
|
||||
.Receive_Timeout:
|
||||
t, ok := value.(time.Duration)
|
||||
if !ok do panic("set_option() value must be a time.Duration here", loc)
|
||||
if !ok {
|
||||
panic("set_option() value must be a time.Duration here", loc)
|
||||
}
|
||||
|
||||
micros := cast(i64) (time.duration_microseconds(t))
|
||||
timeval_value.microseconds = cast(int) (micros % 1e6)
|
||||
|
||||
+9
-3
@@ -123,7 +123,9 @@ percent_encode :: proc(s: string, allocator := context.allocator) -> string {
|
||||
percent_decode :: proc(encoded_string: string, allocator := context.allocator) -> (decoded_string: string, ok: bool) {
|
||||
b := strings.builder_make(allocator)
|
||||
strings.builder_grow(&b, len(encoded_string))
|
||||
defer if !ok do strings.builder_destroy(&b)
|
||||
defer if !ok {
|
||||
strings.builder_destroy(&b)
|
||||
}
|
||||
|
||||
s := encoded_string
|
||||
|
||||
@@ -137,7 +139,9 @@ percent_decode :: proc(encoded_string: string, allocator := context.allocator) -
|
||||
strings.write_string(&b, s[:i])
|
||||
s = s[i:]
|
||||
|
||||
if len(s) == 0 do return // percent without anything after it
|
||||
if len(s) == 0 {
|
||||
return // percent without anything after it
|
||||
}
|
||||
s = s[1:]
|
||||
|
||||
if s[0] == '%' {
|
||||
@@ -177,7 +181,9 @@ base64url_encode :: proc(data: []byte, allocator := context.allocator) -> string
|
||||
}
|
||||
i := len(out)-1;
|
||||
for ; i >= 0; i -= 1 {
|
||||
if out[i] != '=' do break;
|
||||
if out[i] != '=' {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return string(out[:i+1]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user