From d0a0efaf32b3f42ee4ebd37ff065dea4385b998b Mon Sep 17 00:00:00 2001 From: Eliseo Martínez Date: Wed, 5 Nov 2014 22:31:38 +0100 Subject: 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. --- src/nvim/edit.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') 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; -- cgit