mirror of
https://github.com/neovim/neovim.git
synced 2025-11-29 13:40:38 +00:00
Fix warnings: spell.c: spell_move_to(): Garbage value: RI.
Problem : Result of operation is garbage or undefined @ 2238.
Diagnostic : Real issue.
Rationale : Problem occurs when searching forward starting on an empty
line. This is, at 2127:
```
p = buf + skip;
endp = buf + len;
while (p < endp) {
```
when skip == 0, len == 0, implying p == endp and therefore
not entering the loop.
Under those conditions, comparison
```
if (attr == HLF_COUNT)
```
at line 2242 is really using a garbage value for `attr`.
Most of the time the error doesn't produce visible problems
as it only affects when dealing with wrapped words.
Resolution : Initialize `attr` at declaration to `HLF_COUNT`, which is
used in the code when no bad word found yet.
This commit is contained in:
@@ -2061,7 +2061,7 @@ spell_move_to (
|
|||||||
char_u *line;
|
char_u *line;
|
||||||
char_u *p;
|
char_u *p;
|
||||||
char_u *endp;
|
char_u *endp;
|
||||||
hlf_T attr;
|
hlf_T attr = HLF_COUNT;
|
||||||
int len;
|
int len;
|
||||||
int has_syntax = syntax_present(wp);
|
int has_syntax = syntax_present(wp);
|
||||||
int col;
|
int col;
|
||||||
|
|||||||
Reference in New Issue
Block a user