aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliseo Martínez <eliseomarmol@gmail.com>2014-11-05 22:31:38 +0100
committerEliseo Martínez <eliseomarmol@gmail.com>2014-11-06 09:51:58 +0100
commitd0a0efaf32b3f42ee4ebd37ff065dea4385b998b (patch)
tree325b6d0e28543514b26edbe034d710732cc4e0e7
parentcefc26ab63382ce7eb0db7b4b3704ef1f5c3b14b (diff)
downloadrneovim-d0a0efaf32b3f42ee4ebd37ff065dea4385b998b.tar.gz
rneovim-d0a0efaf32b3f42ee4ebd37ff065dea4385b998b.tar.bz2
rneovim-d0a0efaf32b3f42ee4ebd37ff065dea4385b998b.zip
Fix warnings: edit.c: replace_do_bs(): Garbage value: MI.
Problem : Assigned value is garbage or undefined @ 6359. Diagnostic : Multithreading issue. Rationale : Problem only occurs if global `State` changes while function is executing. Resolution : Use local copy of global in function.
-rw-r--r--src/nvim/edit.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 82f9c17f3a..c2fc2acfd1 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -6336,10 +6336,11 @@ static void replace_do_bs(int limit_col)
char_u *p;
int i;
int vcol;
+ const int l_State = State;
cc = replace_pop();
if (cc > 0) {
- if (State & VREPLACE_FLAG) {
+ if (l_State & VREPLACE_FLAG) {
/* Get the number of screen cells used by the character we are
* going to delete. */
getvcol(curwin, &curwin->w_cursor, NULL, &start_vcol, NULL);
@@ -6347,17 +6348,17 @@ static void replace_do_bs(int limit_col)
}
if (has_mbyte) {
(void)del_char_after_col(limit_col);
- if (State & VREPLACE_FLAG)
+ if (l_State & VREPLACE_FLAG)
orig_len = (int)STRLEN(get_cursor_pos_ptr());
replace_push(cc);
} else {
pchar_cursor(cc);
- if (State & VREPLACE_FLAG)
+ if (l_State & VREPLACE_FLAG)
orig_len = (int)STRLEN(get_cursor_pos_ptr()) - 1;
}
replace_pop_ins();
- if (State & VREPLACE_FLAG) {
+ if (l_State & VREPLACE_FLAG) {
/* Get the number of screen cells used by the inserted characters */
p = get_cursor_pos_ptr();
ins_len = (int)STRLEN(p) - orig_len;