aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-29 14:44:18 +0800
committerGitHub <noreply@github.com>2022-07-29 14:44:18 +0800
commit02efdb4d587242122df99b347a25fd4c96b0ca97 (patch)
tree71d3712b243a728ba933dd845f4c0f690cd8be6d
parent0b8bade493235cda9d8ab3ed138d6c94d7cef759 (diff)
downloadrneovim-02efdb4d587242122df99b347a25fd4c96b0ca97.tar.gz
rneovim-02efdb4d587242122df99b347a25fd4c96b0ca97.tar.bz2
rneovim-02efdb4d587242122df99b347a25fd4c96b0ca97.zip
refactor: fix clang and PVS warnings (#19569)
The last commit didn't actually disable V1028 because of a typo. Fix the typo so it is actually disabled.
-rwxr-xr-xscripts/pvscheck.sh2
-rw-r--r--src/nvim/api/command.c1
-rw-r--r--src/nvim/eval/userfunc.c2
-rw-r--r--src/nvim/normal.c2
-rw-r--r--src/nvim/quickfix.c6
5 files changed, 4 insertions, 9 deletions
diff --git a/scripts/pvscheck.sh b/scripts/pvscheck.sh
index d48fe6f99a..610c20eb48 100755
--- a/scripts/pvscheck.sh
+++ b/scripts/pvscheck.sh
@@ -380,7 +380,7 @@ run_analysis() {(
--sourcetree-root . || true
rm -rf PVS-studio.{xml,err,tsk,html.d}
- local plog_args="PVS-studio.log --srcRoot . --excludedCodes V002,V011,V1024,V1042,V1051,V1074"
+ local plog_args="PVS-studio.log --srcRoot . --excludedCodes V002,V011,V1028,V1042,V1051,V1074"
plog-converter $plog_args --renderTypes xml --output PVS-studio.xml
plog-converter $plog_args --renderTypes errorfile --output PVS-studio.err
plog-converter $plog_args --renderTypes tasklist --output PVS-studio.tsk
diff --git a/src/nvim/api/command.c b/src/nvim/api/command.c
index 96e643f1fe..33efa6b326 100644
--- a/src/nvim/api/command.c
+++ b/src/nvim/api/command.c
@@ -412,7 +412,6 @@ String nvim_cmd(uint64_t channel_id, Dict(cmd) *cmd, Dict(cmd_opts) *opts, Error
}
if (!argc_valid) {
- argc = 0; // Ensure that args array isn't erroneously freed at the end.
VALIDATION_ERROR("Incorrect number of arguments supplied");
}
diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c
index 7283fb3cec..a90148bf23 100644
--- a/src/nvim/eval/userfunc.c
+++ b/src/nvim/eval/userfunc.c
@@ -1268,7 +1268,7 @@ void free_all_functions(void)
// Clean up the current_funccal chain and the funccal stack.
while (current_funccal != NULL) {
tv_clear(current_funccal->rettv);
- cleanup_function_call(current_funccal);
+ cleanup_function_call(current_funccal); // -V595
if (current_funccal == NULL && funccal_stack != NULL) {
restore_funccal();
}
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 92a4b00cd0..e3bd4de9a0 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -2481,7 +2481,7 @@ size_t find_ident_at_pos(win_T *wp, linenr_T lnum, colnr_T startcol, char_u **te
col = 0;
// Search for point of changing multibyte character class.
this_class = mb_get_class(ptr);
- while (ptr[col] != NUL
+ while (ptr[col] != NUL // -V781
&& ((i == 0
? mb_get_class(ptr + col) == this_class
: mb_get_class(ptr + col) != 0)
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index d5797e87e5..bdfaa11935 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -3153,11 +3153,7 @@ static void qf_list_entry(qfline_T *qfp, int qf_idx, bool cursel)
if (len > IOSIZE) {
tbuf = xmalloc(len);
- if (tbuf != NULL) {
- tbuflen = len;
- } else {
- tbuf = IObuff;
- }
+ tbuflen = len;
}
// Remove newlines and leading whitespace from the text. For an