diff options
author | ZyX <kp-pav@yandex.ru> | 2018-04-15 21:44:36 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2018-04-15 21:44:36 +0300 |
commit | 2b7a8ceeb6849492b4273814f83e75adf5edd7c1 (patch) | |
tree | be87e2b5da5b285f1894623fe455009050e5bd66 | |
parent | 4a145f2036b0ff13f5db5f3aa7f35d814a1f43a5 (diff) | |
download | rneovim-2b7a8ceeb6849492b4273814f83e75adf5edd7c1.tar.gz rneovim-2b7a8ceeb6849492b4273814f83e75adf5edd7c1.tar.bz2 rneovim-2b7a8ceeb6849492b4273814f83e75adf5edd7c1.zip |
ops: Fix PVS/V547: did_change is almost always set
Only exception is early `goto theend`.
-rw-r--r-- | src/nvim/ops.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 0483cc3e7a..d67737e845 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -4610,9 +4610,7 @@ int do_addsub(int op_type, pos_T *pos, int length, linenr_T Prenum1) } } curwin->w_cursor.col = col; - if (!did_change) { - startpos = curwin->w_cursor; - } + startpos = curwin->w_cursor; did_change = true; (void)del_char(false); ins_char(firstdigit); @@ -4687,9 +4685,7 @@ int do_addsub(int op_type, pos_T *pos, int length, linenr_T Prenum1) // Delete the old number. curwin->w_cursor.col = col; - if (!did_change) { - startpos = curwin->w_cursor; - } + startpos = curwin->w_cursor; did_change = true; todel = length; c = gchar_cursor(); @@ -4775,18 +4771,16 @@ int do_addsub(int op_type, pos_T *pos, int length, linenr_T Prenum1) ins_str(buf1); // insert the new number xfree(buf1); endpos = curwin->w_cursor; - if (did_change && curwin->w_cursor.col) { + if (curwin->w_cursor.col) { curwin->w_cursor.col--; } } - if (did_change) { - // set the '[ and '] marks - curbuf->b_op_start = startpos; - curbuf->b_op_end = endpos; - if (curbuf->b_op_end.col > 0) { - curbuf->b_op_end.col--; - } + // set the '[ and '] marks + curbuf->b_op_start = startpos; + curbuf->b_op_end = endpos; + if (curbuf->b_op_end.col > 0) { + curbuf->b_op_end.col--; } theend: |