From 27177e581902967dcf4f2f426464da1b636ca420 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sat, 11 Feb 2023 14:14:24 +0100 Subject: refactor: reduce scope of locals as per the style guide (#22211) --- src/nvim/lua/spell.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/nvim/lua/spell.c') diff --git a/src/nvim/lua/spell.c b/src/nvim/lua/spell.c index d510d25e90..78e023c26d 100644 --- a/src/nvim/lua/spell.c +++ b/src/nvim/lua/spell.c @@ -51,7 +51,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 +60,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) { -- cgit From 3b0df1780e2c8526bda5dead18ee7cc45925caba Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Wed, 26 Apr 2023 23:23:44 +0200 Subject: refactor: uncrustify Notable changes: replace all infinite loops to `while(true)` and remove `int` from `unsigned int`. --- src/nvim/lua/spell.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/nvim/lua/spell.c') diff --git a/src/nvim/lua/spell.c b/src/nvim/lua/spell.c index 78e023c26d..742e8720f9 100644 --- a/src/nvim/lua/spell.c +++ b/src/nvim/lua/spell.c @@ -69,10 +69,10 @@ 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" : + result = attr == HLF_SPB ? "bad" : + attr == HLF_SPR ? "rare" : attr == HLF_SPL ? "local" : - attr == HLF_SPC ? "caps" : + attr == HLF_SPC ? "caps" : NULL; assert(result != NULL); -- cgit From ff34c91194f9ab9d02808f2880029c38a4655eb5 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Mon, 17 Apr 2023 17:23:47 +0100 Subject: vim-patch:9.0.1330: handling new value of an option has a long "else if" chain Problem: Handling new value of an option has a long "else if" chain. Solution: Use a function pointer. (Yegappan Lakshmanan, closes vim/vim#12015) https://github.com/vim/vim/commit/af93691b53f38784efce0b93fe7644c44a7e382e --- src/nvim/lua/spell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/lua/spell.c') diff --git a/src/nvim/lua/spell.c b/src/nvim/lua/spell.c index 742e8720f9..37f1c5216d 100644 --- a/src/nvim/lua/spell.c +++ b/src/nvim/lua/spell.c @@ -39,7 +39,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; } -- cgit From cf8b2c0e74fd5e723b0c15c2ce84e6900fd322d3 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 30 Sep 2023 12:05:28 +0800 Subject: build(iwyu): add a few more _defs.h mappings (#25435) --- src/nvim/lua/spell.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/nvim/lua/spell.c') diff --git a/src/nvim/lua/spell.c b/src/nvim/lua/spell.c index 37f1c5216d..04304719d0 100644 --- a/src/nvim/lua/spell.c +++ b/src/nvim/lua/spell.c @@ -16,7 +16,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 -- cgit From acc646ad8fc3ef11fcc63b69f3d8484e4a91accd Mon Sep 17 00:00:00 2001 From: dundargoc Date: Fri, 29 Sep 2023 14:58:48 +0200 Subject: refactor: the long goodbye long is 32 bits on windows, while it is 64 bits on other architectures. This makes the type suboptimal for a codebase meant to be cross-platform. Replace it with more appropriate integer types. --- src/nvim/lua/spell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/lua/spell.c') diff --git a/src/nvim/lua/spell.c b/src/nvim/lua/spell.c index 04304719d0..8f80744ac8 100644 --- a/src/nvim/lua/spell.c +++ b/src/nvim/lua/spell.c @@ -80,7 +80,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); -- cgit From 353a4be7e84fdc101318215bdcc8a7e780d737fe Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sun, 12 Nov 2023 13:13:58 +0100 Subject: build: remove PVS We already have an extensive suite of static analysis tools we use, which causes a fair bit of redundancy as we get duplicate warnings. PVS is also prone to give false warnings which creates a lot of work to identify and disable. --- src/nvim/lua/spell.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/nvim/lua/spell.c') diff --git a/src/nvim/lua/spell.c b/src/nvim/lua/spell.c index 8f80744ac8..2575c3d95d 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 #include #include -- cgit From a6e3d93421ba13c407a96fac9cc01fa41ec7ad98 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Thu, 16 Nov 2023 10:59:11 +0100 Subject: refactor: enable formatting for ternaries This requires removing the "Inner expression should be aligned" rule from clint as it prevents essentially any formatting regarding ternary operators. --- src/nvim/lua/spell.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/nvim/lua/spell.c') diff --git a/src/nvim/lua/spell.c b/src/nvim/lua/spell.c index 2575c3d95d..8f4a684219 100644 --- a/src/nvim/lua/spell.c +++ b/src/nvim/lua/spell.c @@ -65,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); -- cgit From 79b6ff28ad1204fbb4199b9092f5c578d88cb28e Mon Sep 17 00:00:00 2001 From: dundargoc Date: Tue, 28 Nov 2023 20:31:00 +0100 Subject: refactor: fix headers with IWYU --- src/nvim/lua/spell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/lua/spell.c') diff --git a/src/nvim/lua/spell.c b/src/nvim/lua/spell.c index 8f4a684219..c261c5105e 100644 --- a/src/nvim/lua/spell.c +++ b/src/nvim/lua/spell.c @@ -5,7 +5,7 @@ #include #include -#include "nvim/ascii.h" +#include "nvim/ascii_defs.h" #include "nvim/buffer_defs.h" #include "nvim/gettext.h" #include "nvim/globals.h" -- cgit