Work around BSD lack of core:net support

This commit is contained in:
Feoramund committed 2024-06-15 01:32:48 -04:00
1 parent f28c6c3bba
commit 51a013fcf1
5 files changed
+52 -21

No files matched your search

+1 -13
View File
@@ -5,7 +5,6 @@ import "base:intrinsics"
import "base:runtime"
import "core:fmt"
import "core:mem"
@require import "core:net"
import "core:os"
import "core:reflect"
import "core:strconv"
@@ -309,18 +308,7 @@ parse_and_set_pointer_by_named_type :: proc(ptr: rawptr, str: string, data_type:
}
when IMPORTING_NET {
if data_type == net.Host_Or_Endpoint {
addr, net_error := net.parse_hostname_or_endpoint(str)
if net_error != nil {
// We pass along `net.Error` here.
out_error^ = Parse_Error {
net_error,
"Invalid Host/Endpoint.",
}
return
}
(cast(^net.Host_Or_Endpoint)ptr)^ = addr
if try_net_parse_workaround(data_type, str, ptr, out_error) {
return
}
}