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

vfmt: change all '$expr' to '${expr}' (#16428)

This commit is contained in:
yuyi
2022-11-15 21:53:13 +08:00
committed by GitHub
parent 56239b4a23
commit 017ace6ea7
859 changed files with 7156 additions and 7135 deletions

View File

@@ -173,7 +173,7 @@ pub fn (mut c StreamConn) close() ! {
pub fn (mut c StreamConn) write_ptr(b &u8, len int) !int {
$if trace_unix ? {
eprintln(
'>>> StreamConn.write_ptr | c.sock.handle: $c.sock.handle | b: ${ptr_str(b)} len: $len |\n' +
'>>> StreamConn.write_ptr | c.sock.handle: ${c.sock.handle} | b: ${ptr_str(b)} len: ${len} |\n' +
unsafe { b.vstring_with_len(len) })
}
unsafe {
@@ -211,7 +211,7 @@ pub fn (mut c StreamConn) write_string(s string) !int {
pub fn (mut c StreamConn) read_ptr(buf_ptr &u8, len int) !int {
mut res := wrap_read_result(C.recv(c.sock.handle, voidptr(buf_ptr), len, 0))!
$if trace_unix ? {
eprintln('<<< StreamConn.read_ptr | c.sock.handle: $c.sock.handle | buf_ptr: ${ptr_str(buf_ptr)} len: $len | res: $res')
eprintln('<<< StreamConn.read_ptr | c.sock.handle: ${c.sock.handle} | buf_ptr: ${ptr_str(buf_ptr)} len: ${len} | res: ${res}')
}
if res > 0 {
return res
@@ -221,7 +221,7 @@ pub fn (mut c StreamConn) read_ptr(buf_ptr &u8, len int) !int {
c.wait_for_read()!
res = wrap_read_result(C.recv(c.sock.handle, voidptr(buf_ptr), len, 0))!
$if trace_unix ? {
eprintln('<<< StreamConn.read_ptr | c.sock.handle: $c.sock.handle | buf_ptr: ${ptr_str(buf_ptr)} len: $len | res: $res')
eprintln('<<< StreamConn.read_ptr | c.sock.handle: ${c.sock.handle} | buf_ptr: ${ptr_str(buf_ptr)} len: ${len} | res: ${res}')
}
return net.socket_error(res)
} else {
@@ -284,5 +284,5 @@ pub fn (mut c StreamConn) wait_for_write() ! {
pub fn (c StreamConn) str() string {
s := c.sock.str().replace('\n', ' ').replace(' ', ' ')
return 'StreamConn{ write_deadline: $c.write_deadline, read_deadline: $c.read_deadline, read_timeout: $c.read_timeout, write_timeout: $c.write_timeout, sock: $s }'
return 'StreamConn{ write_deadline: ${c.write_deadline}, read_deadline: ${c.read_deadline}, read_timeout: ${c.read_timeout}, write_timeout: ${c.write_timeout}, sock: ${s} }'
}

View File

@@ -47,7 +47,7 @@ fn echo() ! {
for i := 0; i < read; i++ {
assert buf[i] == data[i]
}
println('Got "$buf.bytestr()"')
println('Got "${buf.bytestr()}"')
return
}

View File

@@ -45,7 +45,7 @@ fn handle_conn(mut c unix.StreamConn) ! {
for {
mut buf := []u8{len: 100, init: 0}
read := c.read(mut buf) or { return perror('Server: connection dropped') }
eprintln('> server read ${read:3}, buf: |$buf.bytestr()|')
eprintln('> server read ${read:3}, buf: |${buf.bytestr()}|')
c.write(buf[..read]) or { return perror('Server: connection dropped') }
}
}