aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-11-13 06:12:46 -0500
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2019-11-13 19:25:40 -0500
commita0c18bf2017ac7d38d13014a810bda44d09dfcbb (patch)
tree0b71ac24805ad8f7d33cd31339dea96e416bd5d5
parentc2ceed49947c8266e2fdfbf596dab23dd3d39279 (diff)
downloadrneovim-a0c18bf2017ac7d38d13014a810bda44d09dfcbb.tar.gz
rneovim-a0c18bf2017ac7d38d13014a810bda44d09dfcbb.tar.bz2
rneovim-a0c18bf2017ac7d38d13014a810bda44d09dfcbb.zip
spell: fix clang logic error
https://neovim.io/doc/reports/clang/report-487b01.html#EndPath https://neovim.io/doc/reports/clang/report-ce4c3c.html#EndPath
-rw-r--r--src/nvim/spell.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index 687c86b4a8..5feb7efda9 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -1910,11 +1910,11 @@ int init_syl_tab(slang_T *slang)
// Count the number of syllables in "word".
// When "word" contains spaces the syllables after the last space are counted.
// Returns zero if syllables are not defines.
-static int count_syllables(slang_T *slang, char_u *word)
+static int count_syllables(slang_T *slang, const char_u *word)
+ FUNC_ATTR_NONNULL_ALL
{
int cnt = 0;
bool skip = false;
- char_u *p;
int len;
syl_item_T *syl;
int c;
@@ -1922,7 +1922,7 @@ static int count_syllables(slang_T *slang, char_u *word)
if (slang->sl_syllable == NULL)
return 0;
- for (p = word; *p != NUL; p += len) {
+ for (const char_u *p = word; *p != NUL; p += len) {
// When running into a space reset counter.
if (*p == ' ') {
len = 1;
@@ -2625,9 +2625,10 @@ static bool spell_mb_isword_class(int cl, const win_T *wp)
// Returns true if "p" points to a word character.
// Wide version of spell_iswordp().
-static bool spell_iswordp_w(int *p, win_T *wp)
+static bool spell_iswordp_w(const int *p, const win_T *wp)
+ FUNC_ATTR_NONNULL_ALL
{
- int *s;
+ const int *s;
if (*p < 256 ? wp->w_s->b_spell_ismw[*p]
: (wp->w_s->b_spell_ismw_mb != NULL