From 2ca30e3acd413bdcc9dbe055b2b70084f08a4ba7 Mon Sep 17 00:00:00 2001 From: Colin Davidson Date: Wed, 1 Mar 2023 08:27:07 -0800 Subject: [PATCH] more test cleanup --- core/net/dns.odin | 11 +---------- core/net/interface.odin | 8 ++++---- core/net/url.odin | 2 +- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/core/net/dns.odin b/core/net/dns.odin index 26f6fbb4d..087d2e146 100644 --- a/core/net/dns.odin +++ b/core/net/dns.odin @@ -25,20 +25,11 @@ import "core:os" Default configuration for DNS resolution. */ when ODIN_OS == .Windows { - getenv :: proc(key: string) -> (val: string) { - return os.get_env(key) - } - DEFAULT_DNS_CONFIGURATION :: DNS_Configuration{ resolv_conf = "", hosts_file = "%WINDIR%\\system32\\drivers\\etc\\hosts", } } else when ODIN_OS == .Linux || ODIN_OS == .Darwin || ODIN_OS == .OpenBSD { - getenv :: proc(key: string) -> (val: string) { - val, _ = os.getenv(key) - return - } - DEFAULT_DNS_CONFIGURATION :: DNS_Configuration{ resolv_conf = "/etc/resolv.conf", hosts_file = "/etc/hosts", @@ -81,7 +72,7 @@ replace_environment_path :: proc(path: string, allocator := context.allocator) - assert(right > 0 && right <= len(path)) // should be covered by there being two % env_key := path[left: right] - env_val := getenv(env_key) + env_val := os.get_env(env_key) defer delete(env_val) res, _ = strings.replace(path, path[left - 1: right + 1], env_val, 1) diff --git a/core/net/interface.odin b/core/net/interface.odin index 354cba53f..5e6d09830 100644 --- a/core/net/interface.odin +++ b/core/net/interface.odin @@ -56,13 +56,13 @@ physical_address_to_string :: proc(phy_addr: []u8, allocator := context.allocato for b, i in phy_addr { if i > 0 { - strings.write_rune_builder(&buf, ':') + strings.write_rune(&buf, ':') } hi := rune(MAC_HEX[b >> 4]) lo := rune(MAC_HEX[b & 15]) - strings.write_rune_builder(&buf, hi) - strings.write_rune_builder(&buf, lo) + strings.write_rune(&buf, hi) + strings.write_rune(&buf, lo) } return strings.to_string(buf) -} \ No newline at end of file +} diff --git a/core/net/url.odin b/core/net/url.odin index c7bf77671..980fb5e90 100644 --- a/core/net/url.odin +++ b/core/net/url.odin @@ -117,7 +117,7 @@ percent_decode :: proc(encoded_string: string, allocator := context.allocator) - b := builder_make(allocator) builder_grow(&b, len(encoded_string)) - defer if !ok do destroy_builder(&b) + defer if !ok do builder_destroy(&b) stack_buf: [4]u8 pending := mem.buffer_from_slice(stack_buf[:])