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:
Jan Edmund Lazo
2020-11-08 17:56:58 -05:00
parent 212d4bce48
commit 55fb5324ef

View File

@@ -326,18 +326,18 @@ void marktree_del_itr(MarkTree *b, MarkTreeIter *itr, bool rev)
x->n--;
// 4.
if (adjustment) {
if (adjustment == 1) {
abort();
} else { // adjustment == -1
// if (adjustment == 1) {
// abort();
// }
if (adjustment == -1) {
int ilvl = itr->lvl-1;
mtnode_t *lnode = x;
const mtnode_t *lnode = x;
do {
mtnode_t *p = lnode->parent;
const mtnode_t *const p = lnode->parent;
if (ilvl < 0) {
abort();
}
int i = itr->s[ilvl].i;
const int i = itr->s[ilvl].i;
assert(p->ptr[i] == lnode);
if (i > 0) {
unrelative(p->key[i-1].pos, &intkey.pos);
@@ -360,7 +360,6 @@ void marktree_del_itr(MarkTree *b, MarkTreeIter *itr, bool rev)
}
}
}
}
b->n_keys--;
pmap_del(uint64_t)(b->id2node, ANTIGRAVITY(id));
@@ -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
// TODO(bfredl): with "rev" should point before
if (adjustment == 1) {
abort();
} else if (adjustment == -1) {
// if (adjustment == 1) {
// abort();
// }
if (adjustment == -1) {
// 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
// to skip that one as well.