mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 09:26:30 +00:00
pvs/v547: comment out code for 'adjustment == 1'
That code never runs. Comment it out in case that it is required for debugging marktree.c. Use 'const' to mark constant variables.
This commit is contained in:
@@ -326,38 +326,37 @@ void marktree_del_itr(MarkTree *b, MarkTreeIter *itr, bool rev)
|
|||||||
x->n--;
|
x->n--;
|
||||||
|
|
||||||
// 4.
|
// 4.
|
||||||
if (adjustment) {
|
// if (adjustment == 1) {
|
||||||
if (adjustment == 1) {
|
// abort();
|
||||||
abort();
|
// }
|
||||||
} else { // adjustment == -1
|
if (adjustment == -1) {
|
||||||
int ilvl = itr->lvl-1;
|
int ilvl = itr->lvl-1;
|
||||||
mtnode_t *lnode = x;
|
const mtnode_t *lnode = x;
|
||||||
do {
|
do {
|
||||||
mtnode_t *p = lnode->parent;
|
const mtnode_t *const p = lnode->parent;
|
||||||
if (ilvl < 0) {
|
if (ilvl < 0) {
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
int i = itr->s[ilvl].i;
|
const int i = itr->s[ilvl].i;
|
||||||
assert(p->ptr[i] == lnode);
|
assert(p->ptr[i] == lnode);
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
unrelative(p->key[i-1].pos, &intkey.pos);
|
unrelative(p->key[i-1].pos, &intkey.pos);
|
||||||
}
|
}
|
||||||
lnode = p;
|
lnode = p;
|
||||||
ilvl--;
|
ilvl--;
|
||||||
} while (lnode != cur);
|
} while (lnode != cur);
|
||||||
|
|
||||||
mtkey_t deleted = cur->key[curi];
|
mtkey_t deleted = cur->key[curi];
|
||||||
cur->key[curi] = intkey;
|
cur->key[curi] = intkey;
|
||||||
refkey(b, cur, curi);
|
refkey(b, cur, curi);
|
||||||
relative(intkey.pos, &deleted.pos);
|
relative(intkey.pos, &deleted.pos);
|
||||||
mtnode_t *y = cur->ptr[curi+1];
|
mtnode_t *y = cur->ptr[curi+1];
|
||||||
if (deleted.pos.row || deleted.pos.col) {
|
if (deleted.pos.row || deleted.pos.col) {
|
||||||
while (y) {
|
while (y) {
|
||||||
for (int k = 0; k < y->n; k++) {
|
for (int k = 0; k < y->n; k++) {
|
||||||
unrelative(deleted.pos, &y->key[k].pos);
|
unrelative(deleted.pos, &y->key[k].pos);
|
||||||
}
|
|
||||||
y = y->level ? y->ptr[0] : NULL;
|
|
||||||
}
|
}
|
||||||
|
y = y->level ? y->ptr[0] : NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -435,9 +434,10 @@ void marktree_del_itr(MarkTree *b, MarkTreeIter *itr, bool rev)
|
|||||||
|
|
||||||
// BONUS STEP: fix the iterator, so that it points to the key afterwards
|
// BONUS STEP: fix the iterator, so that it points to the key afterwards
|
||||||
// TODO(bfredl): with "rev" should point before
|
// TODO(bfredl): with "rev" should point before
|
||||||
if (adjustment == 1) {
|
// if (adjustment == 1) {
|
||||||
abort();
|
// abort();
|
||||||
} else if (adjustment == -1) {
|
// }
|
||||||
|
if (adjustment == -1) {
|
||||||
// tricky: we stand at the deleted space in the previous leaf node.
|
// tricky: we stand at the deleted space in the previous leaf node.
|
||||||
// But the inner key is now the previous key we stole, so we need
|
// But the inner key is now the previous key we stole, so we need
|
||||||
// to skip that one as well.
|
// to skip that one as well.
|
||||||
|
Reference in New Issue
Block a user