1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

parser: deprecate short struct init (#10842)

This commit is contained in:
Daniel Däschle
2021-07-20 10:17:08 +02:00
committed by GitHub
parent dc045806f9
commit ad3835b598
85 changed files with 234 additions and 238 deletions

View File

@@ -17,8 +17,8 @@ const (
fn new_ip6(port u16, addr [16]byte) Addr {
a := Addr{
f: u16(AddrFamily.ip6)
addr: {
Ip6: {
addr: AddrData{
Ip6: Ip6{
port: u16(C.htons(port))
}
}
@@ -32,8 +32,8 @@ fn new_ip6(port u16, addr [16]byte) Addr {
fn new_ip(port u16, addr [4]byte) Addr {
a := Addr{
f: u16(AddrFamily.ip)
addr: {
Ip: {
addr: AddrData{
Ip: Ip{
port: u16(C.htons(port))
}
}
@@ -49,7 +49,7 @@ fn temp_unix() ?Addr {
// close it
// remove it
// then reuse the filename
mut file, filename := util.temp_file({}) ?
mut file, filename := util.temp_file() ?
file.close()
os.rm(filename) ?
addrs := resolve_addrs(filename, .unix, .udp) ?
@@ -203,8 +203,8 @@ pub fn resolve_ipaddrs(addr string, family AddrFamily, typ SocketType) ?[]Addr {
match AddrFamily(result.ai_family) {
.ip, .ip6 {
new_addr := Addr{
addr: {
Ip6: {}
addr: AddrData{
Ip6: Ip6{}
}
}
unsafe {
@@ -246,8 +246,8 @@ fn (a Addr) str() string {
pub fn addr_from_socket_handle(handle int) Addr {
addr := Addr{
addr: {
Ip6: {}
addr: AddrData{
Ip6: Ip6{}
}
}
size := sizeof(addr)

View File

@@ -165,8 +165,8 @@ pub fn (mut c TcpConn) wait_for_write() ? {
pub fn (c &TcpConn) peer_addr() ?Addr {
mut addr := Addr{
addr: {
Ip6: {}
addr: AddrData{
Ip6: Ip6{}
}
}
mut size := sizeof(Addr)
@@ -217,8 +217,8 @@ pub fn listen_tcp(family AddrFamily, saddr string) ?&TcpListener {
pub fn (mut l TcpListener) accept() ?&TcpConn {
addr := Addr{
addr: {
Ip6: {}
addr: AddrData{
Ip6: Ip6{}
}
}
size := sizeof(Addr)

View File

@@ -104,8 +104,8 @@ pub fn (mut c UdpConn) write_to_string(addr Addr, s string) ?int {
// read reads from the socket into buf up to buf.len returning the number of bytes read
pub fn (mut c UdpConn) read(mut buf []byte) ?(int, Addr) {
mut addr := Addr{
addr: {
Ip6: {}
addr: AddrData{
Ip6: Ip6{}
}
}
len := sizeof(Addr)
@@ -206,8 +206,8 @@ fn new_udp_socket(local_addr Addr) ?&UdpSocket {
handle: sockfd
l: local_addr
r: Addr{
addr: {
Ip6: {}
addr: AddrData{
Ip6: Ip6{}
}
}
}
@@ -246,8 +246,8 @@ fn new_udp_socket_for_remote(raddr Addr) ?&UdpSocket {
panic('Invalid family')
// Appease compiler
Addr{
addr: {
Ip6: {}
addr: AddrData{
Ip6: Ip6{}
}
}
}