aboutsummaryrefslogtreecommitdiff
path: root/core/net
diff options
context:
space:
mode:
authorJeroen van Rijn <Kelimion@users.noreply.github.com>2023-11-11 13:16:12 +0100
committerGitHub <noreply@github.com>2023-11-11 13:16:12 +0100
commit3b5d28f0ee34792f4580006d68c2d66e99c1e064 (patch)
tree9d6e1c249ab6118688e604b86c2e18b6dc5e8e77 /core/net
parent70c1f9d0e19a4b97c03308de8f2b9c0c28ba4cf1 (diff)
parent270348b112d0becce7726023b72784066d02306d (diff)
Merge pull request #2948 from flysand7/fix-do
[core]: Remove `do` keyword from the core library
Diffstat (limited to 'core/net')
-rw-r--r--core/net/addr.odin4
-rw-r--r--core/net/socket_linux.odin4
-rw-r--r--core/net/url.odin12
3 files changed, 15 insertions, 5 deletions
diff --git a/core/net/addr.odin b/core/net/addr.odin
index f0c47e926..508399bf4 100644
--- a/core/net/addr.odin
+++ b/core/net/addr.odin
@@ -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)
diff --git a/core/net/socket_linux.odin b/core/net/socket_linux.odin
index 539317141..6d3f111d1 100644
--- a/core/net/socket_linux.odin
+++ b/core/net/socket_linux.odin
@@ -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)
diff --git a/core/net/url.odin b/core/net/url.odin
index 53c94d863..7ad88bd1f 100644
--- a/core/net/url.odin
+++ b/core/net/url.odin
@@ -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]);
}