From 2aa8c7c41fd49c5763b4552c92b174851c595267 Mon Sep 17 00:00:00 2001 From: Eliseo Martínez Date: Thu, 13 Nov 2014 20:41:19 +0100 Subject: Fix warnings: spell.c: spell_edit_score(): Garbage value: MI. Problem : Assigned value is garbage or undefined @ 12526. Diagnostic : Multithreading issue. Rationale : Error only occurs if global has_mbyte is modified while function is executing. Resolution : Use local copy of global. --- src/nvim/spell.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/spell.c b/src/nvim/spell.c index 0e76fc4b92..ea5ce7ee0d 100644 --- a/src/nvim/spell.c +++ b/src/nvim/spell.c @@ -12503,8 +12503,9 @@ static int spell_edit_score(slang_T *slang, char_u *badword, char_u *goodword) char_u *p; int wbadword[MAXWLEN]; int wgoodword[MAXWLEN]; + const int l_has_mbyte = has_mbyte; - if (has_mbyte) { + if (l_has_mbyte) { // Get the characters from the multi-byte strings and put them in an // int array for easy access. for (p = badword, badlen = 0; *p != NUL; ) @@ -12529,7 +12530,7 @@ static int spell_edit_score(slang_T *slang, char_u *badword, char_u *goodword) for (i = 1; i <= badlen; ++i) { CNT(i, 0) = CNT(i - 1, 0) + SCORE_DEL; for (j = 1; j <= goodlen; ++j) { - if (has_mbyte) { + if (l_has_mbyte) { bc = wbadword[i - 1]; gc = wgoodword[j - 1]; } else { @@ -12553,7 +12554,7 @@ static int spell_edit_score(slang_T *slang, char_u *badword, char_u *goodword) } if (i > 1 && j > 1) { - if (has_mbyte) { + if (l_has_mbyte) { pbc = wbadword[i - 2]; pgc = wgoodword[j - 2]; } else { -- cgit