aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliseo Martínez <eliseomarmol@gmail.com>2014-11-13 20:41:19 +0100
committerEliseo Martínez <eliseomarmol@gmail.com>2014-11-15 12:49:18 +0100
commit2aa8c7c41fd49c5763b4552c92b174851c595267 (patch)
tree4bd7f90336a41e284e456cb9b1c2f7cd6f4f4771
parent1adfb558f52f0d8b24140a992ec8e3368e481229 (diff)
downloadrneovim-2aa8c7c41fd49c5763b4552c92b174851c595267.tar.gz
rneovim-2aa8c7c41fd49c5763b4552c92b174851c595267.tar.bz2
rneovim-2aa8c7c41fd49c5763b4552c92b174851c595267.zip
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.
-rw-r--r--src/nvim/spell.c7
1 files changed, 4 insertions, 3 deletions
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 {