From 5ae8853648d2f94d32fa2b485279ab661340f080 Mon Sep 17 00:00:00 2001 From: yuyi Date: Thu, 4 Jun 2020 16:35:40 +0800 Subject: [PATCH] all: change `f mut Foo` to `mut f Foo` --- cmd/tools/gen_vc.v | 2 +- cmd/tools/modules/testing/common.v | 2 +- cmd/tools/modules/vgit/vgit.v | 2 +- examples/nbody.v | 4 ++-- examples/pico/pico.v | 2 +- examples/quick_sort.v | 4 ++-- examples/sokol/fonts.v | 2 +- examples/spectral.v | 7 +++---- examples/tetris/tetris.v | 2 +- vlib/builtin/array_test.v | 6 +++--- vlib/builtin/map_test.v | 2 +- vlib/builtin/sorted_map.v | 4 ++-- vlib/crypto/aes/aes_cbc.v | 4 ++-- vlib/crypto/aes/block_generic.v | 2 +- vlib/crypto/cipher/xor_generic.v | 6 +++--- vlib/crypto/md5/md5.v | 2 +- vlib/crypto/md5/md5block_generic.v | 2 +- vlib/crypto/rc4/rc4.v | 2 +- vlib/crypto/sha1/sha1block_generic.v | 4 ++-- vlib/crypto/sha256/sha256.v | 2 +- vlib/crypto/sha256/sha256block_generic.v | 4 ++-- vlib/crypto/sha512/sha512.v | 2 +- vlib/crypto/sha512/sha512block_generic.v | 3 +-- vlib/encoding/binary/binary.v | 13 ++++++------- vlib/glm/glm.v | 4 ++-- vlib/live/executable/reloader.v | 14 +++++++------- vlib/net/urllib/urllib.v | 2 +- vlib/net/websocket/examples/client.v | 2 +- vlib/picoev/picoev.v | 4 ++-- vlib/strconv/atof.v | 2 +- vlib/sync/pool.v | 2 +- vlib/v/fmt/fmt.v | 2 +- vlib/v/pref/pref.v | 2 +- vlib/v/tests/defer_test.v | 4 ++-- vlib/v/tests/mut_test.v | 2 +- vlib/v/tests/repl/repl_test.v | 2 +- 36 files changed, 62 insertions(+), 65 deletions(-) diff --git a/cmd/tools/gen_vc.v b/cmd/tools/gen_vc.v index f8350d1c2b..4115d8d53d 100644 --- a/cmd/tools/gen_vc.v +++ b/cmd/tools/gen_vc.v @@ -177,7 +177,7 @@ pub fn (ws &WebhookServer) reset() { // parse flags to FlagOptions struct -fn parse_flags(fp mut flag.FlagParser) FlagOptions { +fn parse_flags(mut fp flag.FlagParser) FlagOptions { return FlagOptions{ serve : fp.bool('serve', 0, false, 'run in webhook server mode') work_dir : fp.string('work-dir', 0, work_dir, 'gen_vc working directory') diff --git a/cmd/tools/modules/testing/common.v b/cmd/tools/modules/testing/common.v index 9932a689af..bf79f7d3eb 100644 --- a/cmd/tools/modules/testing/common.v +++ b/cmd/tools/modules/testing/common.v @@ -127,7 +127,7 @@ pub fn (mut m TestMessageHandler) display_message() { } } -fn worker_trunner(p mut sync.PoolProcessor, idx int, thread_id int) voidptr { +fn worker_trunner(mut p sync.PoolProcessor, idx int, thread_id int) voidptr { mut ts := &TestSession(p.get_shared_context()) defer { ts.message_handler.display_message() } tmpd := os.temp_dir() diff --git a/cmd/tools/modules/vgit/vgit.v b/cmd/tools/modules/vgit/vgit.v index 0bfd6c9396..27a89cc9b4 100644 --- a/cmd/tools/modules/vgit/vgit.v +++ b/cmd/tools/modules/vgit/vgit.v @@ -142,7 +142,7 @@ pub mut: verbose bool // should the tool be much more verbose } -pub fn add_common_tool_options(context mut VGitOptions, fp mut flag.FlagParser) []string { +pub fn add_common_tool_options(mut context VGitOptions, mut fp flag.FlagParser) []string { tdir := os.temp_dir() context.workdir = os.real_path(fp.string('workdir', `w`, tdir, 'A writable base folder. Default: $tdir')) context.v_repo_url = fp.string('vrepo', 0, vgit.remote_v_repo_url, 'The url of the V repository. You can clone it locally too. See also --vcrepo below.') diff --git a/examples/nbody.v b/examples/nbody.v index 0d434c61ec..98443e2432 100644 --- a/examples/nbody.v +++ b/examples/nbody.v @@ -32,7 +32,7 @@ pub mut: s []Position } -fn advance(sys mut System, dt f64) { +fn advance(mut sys System, dt f64) { for i in 0..c_n - 1 { mut vx := sys.v[i].x mut vy := sys.v[i].y @@ -68,7 +68,7 @@ fn advance(sys mut System, dt f64) { } } -fn offsetmomentum(sys mut System) { +fn offsetmomentum(mut sys System) { mut px := f64(0) mut py := f64(0) mut pz := f64(0) diff --git a/examples/pico/pico.v b/examples/pico/pico.v index 663a5426aa..43b430fdae 100644 --- a/examples/pico/pico.v +++ b/examples/pico/pico.v @@ -20,7 +20,7 @@ fn hello_response() string { } -fn callback(req picohttpparser.Request, res mut picohttpparser.Response) { +fn callback(req picohttpparser.Request, mut res picohttpparser.Response) { if picohttpparser.cmpn(req.method, 'GET ', 4) { if picohttpparser.cmp(req.path, '/t') { res.http_ok().header_server().header_date().plain().body(hello_response()) diff --git a/examples/quick_sort.v b/examples/quick_sort.v index d424dbdb81..c92413bf79 100644 --- a/examples/quick_sort.v +++ b/examples/quick_sort.v @@ -19,7 +19,7 @@ fn main() { println('after quick sort whether array is sorted: ${is_sorted(arr)}') } -fn quick_sort(arr mut []int, l int, r int) { +fn quick_sort(mut arr []int, l int, r int) { if l>=r { return } mut sep := l // what is sep: [...all_value=arr[sep]...] for i in l+1..r+1 { @@ -34,7 +34,7 @@ fn quick_sort(arr mut []int, l int, r int) { } [inline] -fn swap(arr mut []int, i int, j int) { +fn swap(mut arr []int, i int, j int) { temp := arr[i] arr[i] = arr[j] arr[j] = temp diff --git a/examples/sokol/fonts.v b/examples/sokol/fonts.v index fa99a11161..2b79d5c66a 100644 --- a/examples/sokol/fonts.v +++ b/examples/sokol/fonts.v @@ -38,7 +38,7 @@ fn main() { sapp.run(&desc) } -fn init(state mut AppState) { +fn init(mut state AppState) { // dont actually alocate this on the heap in real life gfx.setup(&C.sg_desc{ mtl_device: sapp.metal_get_device() diff --git a/examples/spectral.v b/examples/spectral.v index 02ba22cd3a..63efb57e50 100644 --- a/examples/spectral.v +++ b/examples/spectral.v @@ -18,7 +18,7 @@ fn evala(i, j int) int { return ((i + j) * (i + j + 1) / 2 + i + 1) } -fn times(v mut []f64, u []f64) { +fn times(mut v []f64, u []f64) { for i in 0..v.len { mut a := f64(0) for j in 0..u.len { @@ -28,7 +28,7 @@ fn times(v mut []f64, u []f64) { } } -fn times_trans(v mut []f64, u []f64) { +fn times_trans(mut v []f64, u []f64) { for i in 0..v.len { mut a := f64(0) for j in 0..u.len { @@ -38,7 +38,7 @@ fn times_trans(v mut []f64, u []f64) { } } -fn a_times_transp(v mut []f64, u []f64) { +fn a_times_transp(mut v []f64, u []f64) { mut x := []f64{len:u.len, init:0} times(mut x, u) times_trans(mut v, x) @@ -69,4 +69,3 @@ fn main() { ans := math.sqrt(vbv / vv) println('${ans:0.9f}') } - diff --git a/examples/tetris/tetris.v b/examples/tetris/tetris.v index 463bc7c629..04cb3b755e 100644 --- a/examples/tetris/tetris.v +++ b/examples/tetris/tetris.v @@ -402,7 +402,7 @@ fn parse_binary_tetro(t_ int) []Block { return res } -fn on_event(e &sapp.Event, game mut Game) { +fn on_event(e &sapp.Event, mut game Game) { if e.typ == .key_down { game.key_down(e.key_code) } diff --git a/vlib/builtin/array_test.v b/vlib/builtin/array_test.v index dfa510433e..62d35433dc 100644 --- a/vlib/builtin/array_test.v +++ b/vlib/builtin/array_test.v @@ -311,7 +311,7 @@ fn test_fixed() { assert nums2[c_n - 1] == 0 } -fn modify(numbers mut []int) { +fn modify(mut numbers []int) { numbers[0] = 777 } @@ -328,13 +328,13 @@ fn test_mut_slice() { */ } -fn double_up(a mut []int) { +fn double_up(mut a []int) { for i := 0; i < a.len; i++ { a[i] = a[i]*2 } } -fn double_up_v2(a mut []int) { +fn double_up_v2(mut a []int) { for i, _ in a { a[i] = a[i]*2 // or val*2, doesn't matter } diff --git a/vlib/builtin/map_test.v b/vlib/builtin/map_test.v index 0b4a44eaf3..810d0c5463 100644 --- a/vlib/builtin/map_test.v +++ b/vlib/builtin/map_test.v @@ -160,7 +160,7 @@ fn test_string_arr() { assert m['a'][1] == 'two' } -fn mut_map(m mut map[string]int) { +fn mut_map(mut m map[string]int) { m['a'] = 10 } diff --git a/vlib/builtin/sorted_map.v b/vlib/builtin/sorted_map.v index 2e35c7ee57..4b92ca2b7b 100644 --- a/vlib/builtin/sorted_map.v +++ b/vlib/builtin/sorted_map.v @@ -112,7 +112,7 @@ fn (mut m SortedMap) set(key string, value voidptr) { } } -fn (mut n mapnode) split_child(child_index int, y mut mapnode) { +fn (mut n mapnode) split_child(child_index int, mut y mapnode) { mut z := new_node() z.size = mid_index y.size = mid_index @@ -353,7 +353,7 @@ pub fn (mut m SortedMap) delete(key string) { // Insert all keys of the subtree into array `keys` // starting at `at`. Keys are inserted in order. -fn (n &mapnode) subkeys(keys mut []string, at int) int { +fn (n &mapnode) subkeys(mut keys []string, at int) int { mut position := at if !isnil(n.children) { // Traverse children and insert diff --git a/vlib/crypto/aes/aes_cbc.v b/vlib/crypto/aes/aes_cbc.v index 99ef4e8418..9694bc7c87 100644 --- a/vlib/crypto/aes/aes_cbc.v +++ b/vlib/crypto/aes/aes_cbc.v @@ -46,7 +46,7 @@ pub fn new_cbc(b AesCipher, iv []byte) AesCbc { pub fn (x &AesCbc) block_size() int { return x.block_size } -pub fn (x &AesCbc) encrypt_blocks(dst mut []byte, src_ []byte) { +pub fn (x &AesCbc) encrypt_blocks(mut dst []byte, src_ []byte) { mut src := src_ if src.len%x.block_size != 0 { panic('crypto.cipher: input not full blocks') @@ -79,7 +79,7 @@ pub fn (x &AesCbc) encrypt_blocks(dst mut []byte, src_ []byte) { copy(x.iv, iv) } -pub fn (mut x AesCbc) decrypt_blocks(dst mut []byte, src []byte) { +pub fn (mut x AesCbc) decrypt_blocks(mut dst []byte, src []byte) { if src.len%x.block_size != 0 { panic('crypto.cipher: input not full blocks') } diff --git a/vlib/crypto/aes/block_generic.v b/vlib/crypto/aes/block_generic.v index f3f833d97d..6b63937917 100644 --- a/vlib/crypto/aes/block_generic.v +++ b/vlib/crypto/aes/block_generic.v @@ -156,7 +156,7 @@ fn rotw(w u32) u32 { return (w<<8) | (w>>24) } // Key expansion algorithm. See FIPS-197, Figure 11. // Their rcon[i] is our powx[i-1] << 24. -fn expand_key_generic(key []byte, enc mut []u32, dec mut []u32) { +fn expand_key_generic(key []byte, mut enc []u32, mut dec []u32) { // Encryption key setup. mut i := 0 nk := key.len / 4 diff --git a/vlib/crypto/cipher/xor_generic.v b/vlib/crypto/cipher/xor_generic.v index d93336b7b9..71ae4f010b 100644 --- a/vlib/crypto/cipher/xor_generic.v +++ b/vlib/crypto/cipher/xor_generic.v @@ -8,7 +8,7 @@ module cipher // xor_bytes xors the bytes in a and b. The destination should have enough // space, otherwise xor_bytes will panic. Returns the number of bytes xor'd. -pub fn xor_bytes(dst mut []byte, a, b []byte) int { +pub fn xor_bytes(mut dst []byte, a, b []byte) int { mut n := a.len if b.len < n { n = b.len @@ -23,7 +23,7 @@ pub fn xor_bytes(dst mut []byte, a, b []byte) int { } // n needs to be smaller or equal than the length of a and b. -pub fn safe_xor_bytes(dst mut []byte, a, b []byte, n int) { +pub fn safe_xor_bytes(mut dst []byte, a, b []byte, n int) { for i in 0..n { dst[i] = a[i] ^ b[i] } @@ -31,6 +31,6 @@ pub fn safe_xor_bytes(dst mut []byte, a, b []byte, n int) { // fast_xor_words XORs multiples of 4 or 8 bytes (depending on architecture.) // The slice arguments a and b are assumed to be of equal length. -pub fn xor_words(dst mut []byte, a, b []byte) { +pub fn xor_words(mut dst []byte, a, b []byte) { safe_xor_bytes(mut dst, a, b, b.len) } diff --git a/vlib/crypto/md5/md5.v b/vlib/crypto/md5/md5.v index 396d012cab..d822175200 100644 --- a/vlib/crypto/md5/md5.v +++ b/vlib/crypto/md5/md5.v @@ -133,7 +133,7 @@ pub fn sum(data []byte) []byte { return d.checksum() } -fn block(dig mut Digest, p []byte) { +fn block(mut dig Digest, p []byte) { // For now just use block_generic until we have specific // architecture optimized versions block_generic(mut dig, p) diff --git a/vlib/crypto/md5/md5block_generic.v b/vlib/crypto/md5/md5block_generic.v index f2eaabcef6..f381bd6709 100644 --- a/vlib/crypto/md5/md5block_generic.v +++ b/vlib/crypto/md5/md5block_generic.v @@ -11,7 +11,7 @@ module md5 import math.bits import encoding.binary -fn block_generic(dig mut Digest, p []byte) { +fn block_generic(mut dig Digest, p []byte) { // load state mut a := dig.s[0] mut b := dig.s[1] diff --git a/vlib/crypto/rc4/rc4.v b/vlib/crypto/rc4/rc4.v index 4c7d2f3d63..2f97c560bb 100644 --- a/vlib/crypto/rc4/rc4.v +++ b/vlib/crypto/rc4/rc4.v @@ -59,7 +59,7 @@ pub fn (mut c Cipher) reset() { // xor_key_stream sets dst to the result of XORing src with the key stream. // Dst and src must overlap entirely or not at all. -pub fn (mut c Cipher) xor_key_stream(dst mut []byte, src []byte) { +pub fn (mut c Cipher) xor_key_stream(mut dst []byte, src []byte) { if src.len == 0 { return } diff --git a/vlib/crypto/sha1/sha1block_generic.v b/vlib/crypto/sha1/sha1block_generic.v index 8258f98a68..55d7a1f1fe 100644 --- a/vlib/crypto/sha1/sha1block_generic.v +++ b/vlib/crypto/sha1/sha1block_generic.v @@ -17,7 +17,7 @@ const ( _k3 = 0xCA62C1D6 ) -fn block_generic(dig mut Digest, p_ []byte) { +fn block_generic(mut dig Digest, p_ []byte) { mut p := p_ mut w := [u32(0)].repeat(16) mut h0 := dig.h[0] @@ -113,7 +113,7 @@ fn block_generic(dig mut Digest, p_ []byte) { } else { p = p[chunk..] } - + } dig.h[0] = h0 diff --git a/vlib/crypto/sha256/sha256.v b/vlib/crypto/sha256/sha256.v index f39dbacba8..5aa34ec382 100644 --- a/vlib/crypto/sha256/sha256.v +++ b/vlib/crypto/sha256/sha256.v @@ -199,7 +199,7 @@ pub fn sum224(data []byte) []byte { return sum224 } -fn block(dig mut Digest, p []byte) { +fn block(mut dig Digest, p []byte) { // For now just use block_generic until we have specific // architecture optimized versions block_generic(mut dig, p) diff --git a/vlib/crypto/sha256/sha256block_generic.v b/vlib/crypto/sha256/sha256block_generic.v index 12328b240c..dafc014364 100644 --- a/vlib/crypto/sha256/sha256block_generic.v +++ b/vlib/crypto/sha256/sha256block_generic.v @@ -80,11 +80,11 @@ const ( ] ) -fn block_generic(dig mut Digest, p_ []byte) { +fn block_generic(mut dig Digest, p_ []byte) { mut p := p_ mut w := [u32(0)].repeat(64) - + mut h0 := dig.h[0] mut h1 := dig.h[1] mut h2 := dig.h[2] diff --git a/vlib/crypto/sha512/sha512.v b/vlib/crypto/sha512/sha512.v index 377481ad68..3e87dac01d 100644 --- a/vlib/crypto/sha512/sha512.v +++ b/vlib/crypto/sha512/sha512.v @@ -279,7 +279,7 @@ pub fn sum512_256(data []byte) []byte { return sum256 } -fn block(dig mut Digest, p []byte) { +fn block(mut dig Digest, p []byte) { // For now just use block_generic until we have specific // architecture optimized versions block_generic(mut dig, p) diff --git a/vlib/crypto/sha512/sha512block_generic.v b/vlib/crypto/sha512/sha512block_generic.v index fcb36f5f14..9b90960ddf 100644 --- a/vlib/crypto/sha512/sha512block_generic.v +++ b/vlib/crypto/sha512/sha512block_generic.v @@ -93,7 +93,7 @@ const ( ] ) -fn block_generic(dig mut Digest, p_ []byte) { +fn block_generic(mut dig Digest, p_ []byte) { mut p := p_ mut w := [u64(0)].repeat(80) mut h0 := dig.h[0] @@ -160,4 +160,3 @@ fn block_generic(dig mut Digest, p_ []byte) { dig.h[6] = h6 dig.h[7] = h7 } - diff --git a/vlib/encoding/binary/binary.v b/vlib/encoding/binary/binary.v index 8ef0e0f6eb..e649cfaf6b 100644 --- a/vlib/encoding/binary/binary.v +++ b/vlib/encoding/binary/binary.v @@ -10,7 +10,7 @@ pub fn little_endian_u16(b []byte) u16 { } [inline] -pub fn little_endian_put_u16(b mut []byte, v u16) { +pub fn little_endian_put_u16(mut b []byte, v u16) { _ = b[1] // bounds check b[0] = byte(v) b[1] = byte(v>>u16(8)) @@ -23,7 +23,7 @@ pub fn little_endian_u32(b []byte) u32 { } [inline] -pub fn little_endian_put_u32(b mut []byte, v u32) { +pub fn little_endian_put_u32(mut b []byte, v u32) { _ = b[3] // bounds check b[0] = byte(v) b[1] = byte(v>>u32(8)) @@ -38,7 +38,7 @@ pub fn little_endian_u64(b []byte) u64 { } [inline] -pub fn little_endian_put_u64(b mut []byte, v u64) { +pub fn little_endian_put_u64(mut b []byte, v u64) { _ = b[7] // bounds check b[0] = byte(v) b[1] = byte(v>>u64(8)) @@ -58,7 +58,7 @@ pub fn big_endian_u16(b []byte) u16 { } [inline] -pub fn big_endian_put_u16(b mut []byte, v u16) { +pub fn big_endian_put_u16(mut b []byte, v u16) { _ = b[1] // bounds check b[0] = byte(v>>u16(8)) b[1] = byte(v) @@ -71,7 +71,7 @@ pub fn big_endian_u32(b []byte) u32 { } [inline] -pub fn big_endian_put_u32(b mut []byte, v u32) { +pub fn big_endian_put_u32(mut b []byte, v u32) { _ = b[3] // bounds check b[0] = byte(v>>u32(24)) b[1] = byte(v>>u32(16)) @@ -86,7 +86,7 @@ pub fn big_endian_u64(b []byte) u64 { } [inline] -pub fn big_endian_put_u64(b mut []byte, v u64) { +pub fn big_endian_put_u64(mut b []byte, v u64) { _ = b[7] // bounds check b[0] = byte(v>>u64(56)) b[1] = byte(v>>u64(48)) @@ -97,4 +97,3 @@ pub fn big_endian_put_u64(b mut []byte, v u64) { b[6] = byte(v>>u64(8)) b[7] = byte(v) } - diff --git a/vlib/glm/glm.v b/vlib/glm/glm.v index 40b5c3878d..e55cf5fa5b 100644 --- a/vlib/glm/glm.v +++ b/vlib/glm/glm.v @@ -315,7 +315,7 @@ pub fn rotate(angle f32, axis Vec3, src Mat4) Mat4 { dest[10] = data[2] * f20 + data[6] * f21 + data[10] * f22 dest[11] = data[3] * f20 + data[7] * f21 + data[11] * f22 - dest[0] = t00 dest[1] = t01 dest[2] = t02 dest[3] = t03 + dest[0] = t00 dest[1] = t01 dest[2] = t02 dest[3] = t03 dest[4] = t10 dest[5] = t11 dest[6] = t12 dest[7] = t13 return mat4(dest) @@ -370,7 +370,7 @@ pub fn identity() Mat4 { } // returns *f32 without allocation -pub fn identity2(res mut &f32) { +pub fn identity2(mut res &f32) { res[0] = 1 res[5] = 1 res[10] = 1 diff --git a/vlib/live/executable/reloader.v b/vlib/live/executable/reloader.v index 1f0677ab68..ac17dc0243 100644 --- a/vlib/live/executable/reloader.v +++ b/vlib/live/executable/reloader.v @@ -31,7 +31,7 @@ pub fn new_live_reload_info(original string, vexe string, vopts string, live_fn_ // NB: start_reloader will be called by generated code inside main(), to start // the hot code reloader thread. start_reloader is executed in the context of // the original main thread. -pub fn start_reloader(r mut live.LiveReloadInfo) { +pub fn start_reloader(mut r live.LiveReloadInfo) { // The shared library should be loaded once in the main thread // If that fails, the program would crash anyway, just provide // an error message to the user and exit: @@ -48,7 +48,7 @@ fn elog(r &live.LiveReloadInfo, s string){ eprintln(s) } -fn compile_and_reload_shared_lib(r mut live.LiveReloadInfo) ?bool { +fn compile_and_reload_shared_lib(mut r live.LiveReloadInfo) ?bool { sw := time.new_stopwatch({}) new_lib_path := compile_lib(mut r) or { return error('errors while compiling $r.original') @@ -59,7 +59,7 @@ fn compile_and_reload_shared_lib(r mut live.LiveReloadInfo) ?bool { return true } -fn compile_lib(r mut live.LiveReloadInfo) ?string { +fn compile_lib(mut r live.LiveReloadInfo) ?string { new_lib_path, new_lib_path_with_extension := current_shared_library_path(mut r) cmd := '$r.vexe $r.vopts -o $new_lib_path $r.original' elog(r,'> compilation cmd: $cmd') @@ -81,13 +81,13 @@ fn compile_lib(r mut live.LiveReloadInfo) ?string { return new_lib_path_with_extension } -fn current_shared_library_path(r mut live.LiveReloadInfo) (string, string) { +fn current_shared_library_path(mut r live.LiveReloadInfo) (string, string) { lib_path := strconv.v_sprintf(r.so_name_template.replace('\\', '\\\\'), r.reloads) lib_path_with_extension := lib_path + r.so_extension return lib_path, lib_path_with_extension } -fn load_lib(r mut live.LiveReloadInfo, new_lib_path string) { +fn load_lib(mut r live.LiveReloadInfo, new_lib_path string) { elog(r,'live mutex locking...') C.pthread_mutex_lock(r.live_fn_mutex) elog(r,'live mutex locked') @@ -108,7 +108,7 @@ fn load_lib(r mut live.LiveReloadInfo, new_lib_path string) { elog(r,'live mutex unlocked') } -fn protected_load_lib(r mut live.LiveReloadInfo, new_lib_path string) { +fn protected_load_lib(mut r live.LiveReloadInfo, new_lib_path string) { if r.live_lib != 0 { dl.close( r.live_lib ) r.live_lib = 0 @@ -126,7 +126,7 @@ fn protected_load_lib(r mut live.LiveReloadInfo, new_lib_path string) { } // NB: r.reloader() is executed in a new, independent thread -fn reloader(r mut live.LiveReloadInfo) { +fn reloader(mut r live.LiveReloadInfo) { // elog(r,'reloader, r: $r') mut last_ts := os.file_last_mod_unix( r.original ) for { diff --git a/vlib/net/urllib/urllib.v b/vlib/net/urllib/urllib.v index be1cfefc7c..d22d69953a 100644 --- a/vlib/net/urllib/urllib.v +++ b/vlib/net/urllib/urllib.v @@ -836,7 +836,7 @@ fn parse_query_silent(query string) Values { return m } -fn parse_query_values(m mut Values, query string) ?bool { +fn parse_query_values(mut m Values, query string) ?bool { mut had_error := false mut q := query for q != '' { diff --git a/vlib/net/websocket/examples/client.v b/vlib/net/websocket/examples/client.v index 33f9d8d902..7bf4a0a44d 100644 --- a/vlib/net/websocket/examples/client.v +++ b/vlib/net/websocket/examples/client.v @@ -95,7 +95,7 @@ fn on_message(sender voidptr, mut ws websocket.Client, msg websocket.Message) { } } -fn start_tests(ws mut websocket.Client, num int) { +fn start_tests(mut ws websocket.Client, num int) { for i := 1; i < num; i++ { println('Running test: ' + i.str()) ws.uri = 'ws://localhost:9001/runCase?case=${i.str()}&agent=vws/1.0a' diff --git a/vlib/picoev/picoev.v b/vlib/picoev/picoev.v index 230003e0a1..cb25a6d641 100644 --- a/vlib/picoev/picoev.v +++ b/vlib/picoev/picoev.v @@ -64,7 +64,7 @@ struct C.picoev_loop {} struct Picoev { loop &C.picoev_loop - cb fn(req picohttpparser.Request, res mut picohttpparser.Response) + cb fn(req picohttpparser.Request, mut res picohttpparser.Response) mut: date byteptr buf byteptr @@ -229,7 +229,7 @@ pub fn (p Picoev) serve() { } } -fn update_date(p mut Picoev) { +fn update_date(mut p Picoev) { for { p.date = C.get_date() C.usleep(1000000) diff --git a/vlib/strconv/atof.v b/vlib/strconv/atof.v index 1c0f60a945..eca5aa217a 100644 --- a/vlib/strconv/atof.v +++ b/vlib/strconv/atof.v @@ -360,7 +360,7 @@ fn parser(s string) (int,PrepNumber) { **********************************************************************/ // converter return a u64 with the bit image of the f64 number -fn converter(pn mut PrepNumber) u64 { +fn converter(mut pn PrepNumber) u64 { mut binexp := 92 mut s2 := u32(0) // 96-bit precision integer mut s1 := u32(0) diff --git a/vlib/sync/pool.v b/vlib/sync/pool.v index 52ed9b08e9..7e2cb5834d 100644 --- a/vlib/sync/pool.v +++ b/vlib/sync/pool.v @@ -124,7 +124,7 @@ pub fn (mut pool PoolProcessor) work_on_pointers(items []voidptr) { // process_in_thread does the actual work of worker thread. // It is a workaround for the current inability to pass a // method in a callback. -fn process_in_thread(pool mut PoolProcessor, task_id int) { +fn process_in_thread(mut pool PoolProcessor, task_id int) { cb := ThreadCB(pool.thread_cb) mut idx := 0 ilen := pool.items.len diff --git a/vlib/v/fmt/fmt.v b/vlib/v/fmt/fmt.v index 9ac5ccbb93..afe355ece0 100644 --- a/vlib/v/fmt/fmt.v +++ b/vlib/v/fmt/fmt.v @@ -64,7 +64,7 @@ pub fn fmt(file ast.File, table &table.Table, is_debug bool) string { } /* -fn (f mut Fmt) find_comment(line_nr int) { +fn (mut f Fmt) find_comment(line_nr int) { for comment in f.file.comments { if comment.line_nr == line_nr { f.writeln('// FFF $comment.line_nr $comment.text') diff --git a/vlib/v/pref/pref.v b/vlib/v/pref/pref.v index 9c1cd6db77..f719ad170c 100644 --- a/vlib/v/pref/pref.v +++ b/vlib/v/pref/pref.v @@ -327,7 +327,7 @@ pub fn backend_from_string(s string) ?Backend { } } -fn parse_define(prefs mut Preferences, define string) { +fn parse_define(mut prefs Preferences, define string) { define_parts := define.split('=') if define_parts.len == 1 { prefs.compile_defines << define diff --git a/vlib/v/tests/defer_test.v b/vlib/v/tests/defer_test.v index b0e48870d2..684dc9f6e7 100644 --- a/vlib/v/tests/defer_test.v +++ b/vlib/v/tests/defer_test.v @@ -19,7 +19,7 @@ fn test_defer() { assert foo2() == 'foo' } -fn set_num(i int, n mut Num) { +fn set_num(i int, mut n Num) { defer { println('exiting') n.val++ @@ -33,7 +33,7 @@ fn set_num(i int, n mut Num) { } } -fn set_num_opt(n mut Num) ?int { +fn set_num_opt(mut n Num) ?int { defer { n.val = 1 } diff --git a/vlib/v/tests/mut_test.v b/vlib/v/tests/mut_test.v index 3b3b4437b6..f4e5f02c74 100644 --- a/vlib/v/tests/mut_test.v +++ b/vlib/v/tests/mut_test.v @@ -8,7 +8,7 @@ pub mut: a []Aaa } -fn foo(b int, a mut []int) { +fn foo(b int, mut a []int) { a[0] = 7 // a << 4 } diff --git a/vlib/v/tests/repl/repl_test.v b/vlib/v/tests/repl/repl_test.v index e81ba8b4f3..e4858a7a12 100644 --- a/vlib/v/tests/repl/repl_test.v +++ b/vlib/v/tests/repl/repl_test.v @@ -53,7 +53,7 @@ fn test_all_v_repl_files() { println(session.bmark.total_message('total time spent running REPL files')) } -fn worker_repl(p mut sync.PoolProcessor, idx int, thread_id int) voidptr { +fn worker_repl(mut p sync.PoolProcessor, idx int, thread_id int) voidptr { cdir := os.cache_dir() mut session := &Session(p.get_shared_context()) mut tls_bench := &benchmark.Benchmark(p.get_thread_context(idx))