aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-11-08 17:56:58 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-11-08 18:09:28 -0500
commit55fb5324ef00e5cc777b5022d9c6b659594d4576 (patch)
tree9bf025fab9640011c76fc5e3b90aaa74df48bfd6 /src
parent212d4bce48e5d9bd18e89ade0d4530aa7dc45713 (diff)
downloadrneovim-55fb5324ef00e5cc777b5022d9c6b659594d4576.tar.gz
rneovim-55fb5324ef00e5cc777b5022d9c6b659594d4576.tar.bz2
rneovim-55fb5324ef00e5cc777b5022d9c6b659594d4576.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/marktree.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/src/nvim/marktree.c b/src/nvim/marktree.c
index 6dd452b5af..e9ea2cbba9 100644
--- a/src/nvim/marktree.c
+++ b/src/nvim/marktree.c
@@ -326,38 +326,37 @@ void marktree_del_itr(MarkTree *b, MarkTreeIter *itr, bool rev)
x->n--;
// 4.
- if (adjustment) {
- if (adjustment == 1) {
- abort();
- } else { // adjustment == -1
- int ilvl = itr->lvl-1;
- mtnode_t *lnode = x;
- do {
- mtnode_t *p = lnode->parent;
- if (ilvl < 0) {
- abort();
- }
- int i = itr->s[ilvl].i;
- assert(p->ptr[i] == lnode);
- if (i > 0) {
- unrelative(p->key[i-1].pos, &intkey.pos);
- }
- lnode = p;
- ilvl--;
- } while (lnode != cur);
-
- mtkey_t deleted = cur->key[curi];
- cur->key[curi] = intkey;
- refkey(b, cur, curi);
- relative(intkey.pos, &deleted.pos);
- mtnode_t *y = cur->ptr[curi+1];
- if (deleted.pos.row || deleted.pos.col) {
- while (y) {
- for (int k = 0; k < y->n; k++) {
- unrelative(deleted.pos, &y->key[k].pos);
- }
- y = y->level ? y->ptr[0] : NULL;
+ // if (adjustment == 1) {
+ // abort();
+ // }
+ if (adjustment == -1) {
+ int ilvl = itr->lvl-1;
+ const mtnode_t *lnode = x;
+ do {
+ const mtnode_t *const p = lnode->parent;
+ if (ilvl < 0) {
+ abort();
+ }
+ const int i = itr->s[ilvl].i;
+ assert(p->ptr[i] == lnode);
+ if (i > 0) {
+ unrelative(p->key[i-1].pos, &intkey.pos);
+ }
+ lnode = p;
+ ilvl--;
+ } while (lnode != cur);
+
+ mtkey_t deleted = cur->key[curi];
+ cur->key[curi] = intkey;
+ refkey(b, cur, curi);
+ relative(intkey.pos, &deleted.pos);
+ mtnode_t *y = cur->ptr[curi+1];
+ if (deleted.pos.row || deleted.pos.col) {
+ while (y) {
+ for (int k = 0; k < y->n; k++) {
+ unrelative(deleted.pos, &y->key[k].pos);
}
+ 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
// 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.