summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYegappan Lakshmanan <yegappan@yahoo.com>2022-09-03 10:52:24 +0100
committerBram Moolenaar <Bram@vim.org>2022-09-03 10:52:24 +0100
commitc99e182e1fb54e39540d25d0ccd8dcdde25bb96c (patch)
treed0cec00ea2cd55d8fb68d353712b70d8be952e5f /src
parentb18b49699776485150b71626069a40d12d2c5590 (diff)
patch 9.0.0364: clang static analyzer gives warningsv9.0.0364
Problem: Clang static analyzer gives warnings. Solution: Avoid the warnings. (Yegappan Lakshmanan, closes #11043)
Diffstat (limited to 'src')
-rw-r--r--src/evalvars.c2
-rw-r--r--src/float.c6
-rw-r--r--src/highlight.c2
-rw-r--r--src/mbyte.c1
-rw-r--r--src/ops.c4
-rw-r--r--src/tag.c7
-rw-r--r--src/version.c2
-rw-r--r--src/vim9compile.c4
8 files changed, 15 insertions, 13 deletions
diff --git a/src/evalvars.c b/src/evalvars.c
index f5761f958c..0d1fe821cc 100644
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -1089,7 +1089,6 @@ ex_let(exarg_T *eap)
{
// +=, /=, etc. require an existing variable
semsg(_(e_cannot_use_operator_on_new_variable), eap->arg);
- i = FAIL;
}
else if (vim_strchr((char_u *)"+-*/%.", *expr) != NULL)
{
@@ -1112,7 +1111,6 @@ ex_let(exarg_T *eap)
vim_strncpy(op, expr - len, len);
semsg(_(e_white_space_required_before_and_after_str_at_str),
op, argend);
- i = FAIL;
}
if (eap->skip)
diff --git a/src/float.c b/src/float.c
index ef9b8309e0..aa7d697c6f 100644
--- a/src/float.c
+++ b/src/float.c
@@ -54,12 +54,11 @@ string2float(
if (skip_quotes && vim_strchr((char_u *)s, '\'') != NULL)
{
char_u buf[100];
- char_u *p = buf;
+ char_u *p;
int quotes = 0;
vim_strncpy(buf, (char_u *)s, 99);
- p = buf;
- for (;;)
+ for (p = buf; ; p = skipdigits(p))
{
// remove single quotes between digits, not in the exponent
if (*p == '\'')
@@ -69,7 +68,6 @@ string2float(
}
if (!vim_isdigit(*p))
break;
- p = skipdigits(p);
}
s = (char *)buf;
f = strtod(s, &s);
diff --git a/src/highlight.c b/src/highlight.c
index 303d5c294f..d0d6fdef6b 100644
--- a/src/highlight.c
+++ b/src/highlight.c
@@ -4515,7 +4515,7 @@ hlg_add_or_update(dict_T *dict)
# endif
p = add_attr_and_value(p, (char_u *)" guifg=", 7, guifg);
p = add_attr_and_value(p, (char_u *)" guibg=", 7, guibg);
- p = add_attr_and_value(p, (char_u *)" guisp=", 7, guisp);
+ (void)add_attr_and_value(p, (char_u *)" guisp=", 7, guisp);
do_highlight(hlsetBuf, forceit, FALSE);
diff --git a/src/mbyte.c b/src/mbyte.c
index 54f7fa4fbb..d3a4644bf7 100644
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -5617,7 +5617,6 @@ f_setcellwidths(typval_T *argvars, typval_T *rettv UNUSED)
}
// Store the items in the new table.
- item = 0;
for (item = 0; item < l->lv_len; ++item)
{
listitem_T *lili = ptrs[item];
diff --git a/src/ops.c b/src/ops.c
index 4733976527..5629a1a669 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -1282,11 +1282,11 @@ op_tilde(oparg_T *oap)
#ifdef FEAT_NETBEANS_INTG
if (netbeans_active() && one_change)
{
- char_u *ptr = ml_get_buf(curbuf, pos.lnum, FALSE);
+ char_u *ptr;
netbeans_removed(curbuf, pos.lnum, bd.textcol,
(long)bd.textlen);
- // get the line again, it may have been flushed
+ // get the line now, it may have been flushed
ptr = ml_get_buf(curbuf, pos.lnum, FALSE);
netbeans_inserted(curbuf, pos.lnum, bd.textcol,
&ptr[bd.textcol], bd.textlen);
diff --git a/src/tag.c b/src/tag.c
index 3141e7686f..c1f6e65f45 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -4368,7 +4368,12 @@ get_tags(list_T *list, char_u *pat, char_u *buf_fname)
{
for (i = 0; i < num_matches; ++i)
{
- parse_match(matches[i], &tp);
+ if (parse_match(matches[i], &tp) == FAIL)
+ {
+ vim_free(matches[i]);
+ continue;
+ }
+
is_static = test_for_static(&tp);
// Skip pseudo-tag lines.
diff --git a/src/version.c b/src/version.c
index a681292ced..a3d8f2c0bf 100644
--- a/src/version.c
+++ b/src/version.c
@@ -708,6 +708,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 364,
+/**/
363,
/**/
362,
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 20366752cf..a785ba98db 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -2243,9 +2243,9 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
r = compile_expr0_ext(&p, cctx, &is_const);
if (lhs.lhs_new_local)
++cctx->ctx_locals.ga_len;
- if (r == FAIL)
- goto theend;
}
+ if (r == FAIL)
+ goto theend;
}
else if (semicolon && var_idx == var_count - 1)
{