mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
all: fix a big mutability bug and update all mutable vars
This commit is contained in:
parent
fb41c6659a
commit
632e27a4a9
17 changed files with 78 additions and 69 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue