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

all: fix a big mutability bug and update all mutable vars

This commit is contained in:
Alexander Medvednikov
2020-07-23 23:16:36 +02:00
parent fb41c6659a
commit 632e27a4a9
17 changed files with 78 additions and 69 deletions

View File

@@ -123,7 +123,7 @@ fn print_backtrace_skipping_top_frames_linux(skipframes int) bool {
fn break_if_debugger_attached() {
unsafe {
ptr := &voidptr(0)
mut ptr := &voidptr(0)
*ptr = 0
}
}

View File

@@ -250,7 +250,7 @@ fn (mut n mapnode) remove_from_non_leaf(idx int) {
predecessor := current.keys[current.len - 1]
n.keys[idx] = predecessor
n.values[idx] = current.values[current.len - 1]
node := unsafe {&mapnode(n.children[idx])}
mut node := unsafe {&mapnode(n.children[idx])}
node.remove_key(predecessor)
} else if unsafe {&mapnode(n.children[idx + 1])}.len >= degree {
mut current := unsafe {&mapnode(n.children[idx + 1])}
@@ -260,11 +260,11 @@ fn (mut n mapnode) remove_from_non_leaf(idx int) {
successor := current.keys[0]
n.keys[idx] = successor
n.values[idx] = current.values[0]
node := unsafe {&mapnode(n.children[idx + 1])}
mut node := unsafe {&mapnode(n.children[idx + 1])}
node.remove_key(successor)
} else {
n.merge(idx)
node := unsafe {&mapnode(n.children[idx])}
mut node := unsafe {&mapnode(n.children[idx])}
node.remove_key(k)
}
}