aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-11-08 20:34:01 -0500
committerGitHub <noreply@github.com>2020-11-08 20:34:01 -0500
commit94062831b38941a3516bb3bdc8c20486a91fd900 (patch)
tree9bf025fab9640011c76fc5e3b90aaa74df48bfd6
parent5caaacaafeecb71b7526a182f434945be588a827 (diff)
parent55fb5324ef00e5cc777b5022d9c6b659594d4576 (diff)
downloadrneovim-94062831b38941a3516bb3bdc8c20486a91fd900.tar.gz
rneovim-94062831b38941a3516bb3bdc8c20486a91fd900.tar.bz2
rneovim-94062831b38941a3516bb3bdc8c20486a91fd900.zip
Merge pull request #13255 from janlazo/pvs-547-560
pvs: fix v547, v560 errors
-rw-r--r--src/nvim/api/vim.c2
-rw-r--r--src/nvim/decoration.c4
-rw-r--r--src/nvim/marktree.c68
3 files changed, 37 insertions, 37 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index 5050f1842d..6501ae2c89 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -805,7 +805,7 @@ ArrayOf(String) nvim_get_runtime_file(String name, Boolean all, Error *err)
}
int flags = DIP_START | (all ? DIP_ALL : 0);
- do_in_runtimepath(name.size ? (char_u *)name.data : NULL,
+ do_in_runtimepath((char_u *)name.data,
flags, find_runtime_cb, &rv);
return rv;
}
diff --git a/src/nvim/decoration.c b/src/nvim/decoration.c
index d411f22e7a..0721c0c57b 100644
--- a/src/nvim/decoration.c
+++ b/src/nvim/decoration.c
@@ -182,7 +182,7 @@ bool decor_redraw_start(buf_T *buf, int top_row, DecorState *state)
Decoration *decor = item->decor;
if ((!(mark.id&MARKTREE_END_FLAG) && altpos.row < top_row
- && item && !kv_size(decor->virt_text))
+ && !kv_size(decor->virt_text))
|| ((mark.id&MARKTREE_END_FLAG) && altpos.row >= top_row)) {
goto next_mark;
}
@@ -251,7 +251,7 @@ int decor_redraw_col(buf_T *buf, int col, DecorState *state)
if (endpos.row < mark.row
|| (endpos.row == mark.row && endpos.col <= mark.col)) {
- if (item && !kv_size(decor->virt_text)) {
+ if (!kv_size(decor->virt_text)) {
goto next_mark;
}
}
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.