ops: Fix PVS/V547: did_change is almost always set

Only exception is early `goto theend`.
This commit is contained in:
ZyX
2018-04-15 21:44:36 +03:00
parent 4a145f2036
commit 2b7a8ceeb6

View File

@@ -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: