mirror of
https://github.com/neovim/neovim.git
synced 2025-09-14 07:18:17 +00:00
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.
This commit is contained in:
@@ -6336,10 +6336,11 @@ static void replace_do_bs(int limit_col)
|
|||||||
char_u *p;
|
char_u *p;
|
||||||
int i;
|
int i;
|
||||||
int vcol;
|
int vcol;
|
||||||
|
const int l_State = State;
|
||||||
|
|
||||||
cc = replace_pop();
|
cc = replace_pop();
|
||||||
if (cc > 0) {
|
if (cc > 0) {
|
||||||
if (State & VREPLACE_FLAG) {
|
if (l_State & VREPLACE_FLAG) {
|
||||||
/* Get the number of screen cells used by the character we are
|
/* Get the number of screen cells used by the character we are
|
||||||
* going to delete. */
|
* going to delete. */
|
||||||
getvcol(curwin, &curwin->w_cursor, NULL, &start_vcol, NULL);
|
getvcol(curwin, &curwin->w_cursor, NULL, &start_vcol, NULL);
|
||||||
@@ -6347,17 +6348,17 @@ static void replace_do_bs(int limit_col)
|
|||||||
}
|
}
|
||||||
if (has_mbyte) {
|
if (has_mbyte) {
|
||||||
(void)del_char_after_col(limit_col);
|
(void)del_char_after_col(limit_col);
|
||||||
if (State & VREPLACE_FLAG)
|
if (l_State & VREPLACE_FLAG)
|
||||||
orig_len = (int)STRLEN(get_cursor_pos_ptr());
|
orig_len = (int)STRLEN(get_cursor_pos_ptr());
|
||||||
replace_push(cc);
|
replace_push(cc);
|
||||||
} else {
|
} else {
|
||||||
pchar_cursor(cc);
|
pchar_cursor(cc);
|
||||||
if (State & VREPLACE_FLAG)
|
if (l_State & VREPLACE_FLAG)
|
||||||
orig_len = (int)STRLEN(get_cursor_pos_ptr()) - 1;
|
orig_len = (int)STRLEN(get_cursor_pos_ptr()) - 1;
|
||||||
}
|
}
|
||||||
replace_pop_ins();
|
replace_pop_ins();
|
||||||
|
|
||||||
if (State & VREPLACE_FLAG) {
|
if (l_State & VREPLACE_FLAG) {
|
||||||
/* Get the number of screen cells used by the inserted characters */
|
/* Get the number of screen cells used by the inserted characters */
|
||||||
p = get_cursor_pos_ptr();
|
p = get_cursor_pos_ptr();
|
||||||
ins_len = (int)STRLEN(p) - orig_len;
|
ins_len = (int)STRLEN(p) - orig_len;
|
||||||
|
Reference in New Issue
Block a user