mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
checker: disallow struct int to ptr outside unsafe (#17923)
This commit is contained in:
@@ -194,7 +194,7 @@ pub fn resolve_ipaddrs(addr string, family AddrFamily, typ SocketType) ![]Addr {
|
||||
hints.ai_socktype = int(typ)
|
||||
hints.ai_flags = C.AI_PASSIVE
|
||||
|
||||
results := &C.addrinfo(0)
|
||||
results := &C.addrinfo(unsafe { nil })
|
||||
|
||||
sport := '${port}'
|
||||
|
||||
|
@@ -70,7 +70,7 @@ fn @select(handle int, test Select, timeout time.Duration) !bool {
|
||||
// infinite timeout is signaled by passing null as the timeout to
|
||||
// select
|
||||
if timeout == net.infinite_timeout {
|
||||
timeval_timeout = &C.timeval(0)
|
||||
timeval_timeout = &C.timeval(unsafe { nil })
|
||||
}
|
||||
|
||||
match test {
|
||||
|
@@ -379,7 +379,7 @@ fn @select(handle int, test Select, timeout time.Duration) !bool {
|
||||
// infinite timeout is signaled by passing null as the timeout to
|
||||
// select
|
||||
if timeout == net.infinite_timeout {
|
||||
timeval_timeout = &C.timeval(0)
|
||||
timeval_timeout = &C.timeval(unsafe { nil })
|
||||
}
|
||||
|
||||
match test {
|
||||
|
@@ -5,7 +5,7 @@ struct Abc {
|
||||
}
|
||||
|
||||
fn test_printing_struct_with_reference_field_of_type_ssl_ctx() {
|
||||
a := Abc{&C.SSL_CTX(123)}
|
||||
a := unsafe { Abc{&C.SSL_CTX(123)} }
|
||||
dump(a)
|
||||
sa := a.str()
|
||||
assert sa.contains('&C.SSL_CTX(0x7b)')
|
||||
|
@@ -436,7 +436,7 @@ fn @select(handle int, test Select, timeout time.Duration) !bool {
|
||||
// infinite timeout is signaled by passing null as the timeout to
|
||||
// select
|
||||
if timeout == net.infinite_timeout {
|
||||
timeval_timeout = &C.timeval(0)
|
||||
timeval_timeout = &C.timeval(unsafe { nil })
|
||||
}
|
||||
|
||||
match test {
|
||||
|
@@ -42,7 +42,7 @@ fn @select(handle int, test Select, timeout time.Duration) !bool {
|
||||
// infinite timeout is signaled by passing null as the timeout to
|
||||
// select
|
||||
if timeout == unix.infinite_timeout {
|
||||
timeval_timeout = &C.timeval(0)
|
||||
timeval_timeout = &C.timeval(unsafe { nil })
|
||||
}
|
||||
|
||||
match test {
|
||||
|
Reference in New Issue
Block a user