aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/lua/spell.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/lua/spell.c')
-rw-r--r--src/nvim/lua/spell.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/nvim/lua/spell.c b/src/nvim/lua/spell.c
index d510d25e90..c261c5105e 100644
--- a/src/nvim/lua/spell.c
+++ b/src/nvim/lua/spell.c
@@ -1,6 +1,3 @@
-// This is an open source non-commercial project. Dear PVS-Studio, please check
-// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
-
#include <assert.h>
#include <lauxlib.h>
#include <limits.h>
@@ -8,7 +5,7 @@
#include <stdbool.h>
#include <stddef.h>
-#include "nvim/ascii.h"
+#include "nvim/ascii_defs.h"
#include "nvim/buffer_defs.h"
#include "nvim/gettext.h"
#include "nvim/globals.h"
@@ -16,7 +13,6 @@
#include "nvim/lua/spell.h"
#include "nvim/message.h"
#include "nvim/spell.h"
-#include "nvim/types.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "lua/spell.c.generated.h" // IWYU pragma: export
@@ -39,7 +35,7 @@ int nlua_spell_check(lua_State *lstate)
const int wo_spell_save = curwin->w_p_spell;
if (!curwin->w_p_spell) {
- did_set_spelllang(curwin);
+ parse_spelllang(curwin);
curwin->w_p_spell = true;
}
@@ -51,7 +47,6 @@ int nlua_spell_check(lua_State *lstate)
}
hlf_T attr = HLF_COUNT;
- size_t len = 0;
size_t pos = 0;
int capcol = -1;
int no_res = 0;
@@ -61,7 +56,7 @@ int nlua_spell_check(lua_State *lstate)
while (*str != NUL) {
attr = HLF_COUNT;
- len = spell_check(curwin, (char *)str, &attr, &capcol, false);
+ size_t len = spell_check(curwin, (char *)str, &attr, &capcol, false);
assert(len <= INT_MAX);
if (attr != HLF_COUNT) {
@@ -70,11 +65,11 @@ int nlua_spell_check(lua_State *lstate)
lua_pushlstring(lstate, str, len);
lua_rawseti(lstate, -2, 1);
- result = attr == HLF_SPB ? "bad" :
- attr == HLF_SPR ? "rare" :
- attr == HLF_SPL ? "local" :
- attr == HLF_SPC ? "caps" :
- NULL;
+ result = attr == HLF_SPB
+ ? "bad" : (attr == HLF_SPR
+ ? "rare" : (attr == HLF_SPL
+ ? "local" : (attr == HLF_SPC
+ ? "caps" : NULL)));
assert(result != NULL);
@@ -82,7 +77,7 @@ int nlua_spell_check(lua_State *lstate)
lua_rawseti(lstate, -2, 2);
// +1 for 1-indexing
- lua_pushinteger(lstate, (long)pos + 1);
+ lua_pushinteger(lstate, (lua_Integer)pos + 1);
lua_rawseti(lstate, -2, 3);
lua_rawseti(lstate, -2, ++no_res);