summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-03-21 21:45:34 +0100
committerBram Moolenaar <Bram@vim.org>2019-03-21 21:45:34 +0100
commit2c519cf3bfe76083767ac94c674d2e161ed36587 (patch)
tree6386fbe43e4c710c1a31fe28ea3989cfe35e96a8
parentf7e47af7760fe054cb645dac9a1e96b23c85804d (diff)
downloadvim-git-2c519cf3bfe76083767ac94c674d2e161ed36587.tar.gz
patch 8.1.1032: warnings from clang static analyzerv8.1.1032
Problem: Warnings from clang static analyzer. (Yegappan Lakshmanan) Solution: Fix relevant warnings.
-rw-r--r--src/arabic.c3
-rw-r--r--src/channel.c2
-rw-r--r--src/charset.c6
-rw-r--r--src/edit.c6
-rw-r--r--src/eval.c3
-rw-r--r--src/fileio.c3
-rw-r--r--src/message.c2
-rw-r--r--src/normal.c3
-rw-r--r--src/option.c4
-rw-r--r--src/os_unix.c4
-rw-r--r--src/regexp.c2
-rw-r--r--src/screen.c9
-rw-r--r--src/version.c2
13 files changed, 20 insertions, 29 deletions
diff --git a/src/arabic.c b/src/arabic.c
index 6c15221f6..adf414712 100644
--- a/src/arabic.c
+++ b/src/arabic.c
@@ -578,9 +578,6 @@ arabic_shape(
/* half-shape current and previous character */
shape_c = half_shape(prev_c);
- /* Save away current character */
- curr_c = c;
-
curr_laa = A_firstc_laa(c, *c1p);
prev_laa = A_firstc_laa(prev_c, prev_c1);
diff --git a/src/channel.c b/src/channel.c
index 176a3d7e1..9ce47d3a4 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -1720,7 +1720,7 @@ channel_get(channel_T *channel, ch_part_T part, int *outlen)
channel_get_all(channel_T *channel, ch_part_T part, int *outlen)
{
readq_T *head = &channel->ch_part[part].ch_head;
- readq_T *node = head->rq_next;
+ readq_T *node;
long_u len = 0;
char_u *res;
char_u *p;
diff --git a/src/charset.c b/src/charset.c
index 1d66d617a..3eb5b5805 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1055,7 +1055,6 @@ win_lbr_chartabsize(
if (col2 >= colmax) /* doesn't fit */
{
size = colmax - col + col_adj;
- tab_corr = FALSE;
break;
}
}
@@ -1108,7 +1107,8 @@ win_lbr_chartabsize(
{
/* calculate effective window width */
int width = (colnr_T)wp->w_width - sbrlen - numberwidth;
- int prev_width = col ? ((colnr_T)wp->w_width - (sbrlen + col)) : 0;
+ int prev_width = col
+ ? ((colnr_T)wp->w_width - (sbrlen + col)) : 0;
if (width == 0)
width = (colnr_T)wp->w_width;
added += ((size - prev_width) / width) * vim_strsize(p_sbr);
@@ -1963,7 +1963,7 @@ hexhex2nr(char_u *p)
/*
* Return TRUE if "str" starts with a backslash that should be removed.
- * For MS-DOS, WIN32 and OS/2 this is only done when the character after the
+ * For MS-DOS, MSWIN and OS/2 this is only done when the character after the
* backslash is not a normal file name character.
* '$' is a valid file name character, we don't remove the backslash before
* it. This means it is not possible to use an environment variable after a
diff --git a/src/edit.c b/src/edit.c
index 2f81b52df..452d4a6dc 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -4109,11 +4109,11 @@ ins_compl_fixRedoBufForLeader(char_u *ptr_arg)
static buf_T *
ins_compl_next_buf(buf_T *buf, int flag)
{
- static win_T *wp;
+ static win_T *wp = NULL;
- if (flag == 'w') /* just windows */
+ if (flag == 'w') // just windows
{
- if (buf == curbuf) /* first call for this flag/expansion */
+ if (buf == curbuf || wp == NULL) // first call for this flag/expansion
wp = curwin;
while ((wp = (wp->w_next != NULL ? wp->w_next : firstwin)) != curwin
&& wp->w_buffer->b_scanned)
diff --git a/src/eval.c b/src/eval.c
index 62fe3b5bf..2a138d56c 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -8544,7 +8544,7 @@ ex_execute(exarg_T *eap)
char_u *p;
garray_T ga;
int len;
- int save_did_emsg = did_emsg;
+ int save_did_emsg;
ga_init2(&ga, 1, 80);
@@ -8552,7 +8552,6 @@ ex_execute(exarg_T *eap)
++emsg_skip;
while (*arg != NUL && *arg != '|' && *arg != '\n')
{
- p = arg;
ret = eval1_emsg(&arg, &rettv, !eap->skip);
if (ret == FAIL)
break;
diff --git a/src/fileio.c b/src/fileio.c
index 4060f69d3..22a735f55 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2322,10 +2322,7 @@ failed:
vim_free(fenc);
#ifdef USE_ICONV
if (iconv_fd != (iconv_t)-1)
- {
iconv_close(iconv_fd);
- iconv_fd = (iconv_t)-1;
- }
#endif
if (!read_buffer && !read_stdin)
diff --git a/src/message.c b/src/message.c
index d6acb0991..fa37df12b 100644
--- a/src/message.c
+++ b/src/message.c
@@ -4491,7 +4491,6 @@ vim_vsnprintf_typval(
case 'c':
case 's':
case 'S':
- length_modifier = '\0';
str_arg_l = 1;
switch (fmt_spec)
{
@@ -4872,7 +4871,6 @@ vim_vsnprintf_typval(
* zero value is formatted with an
* explicit precision of zero */
precision = num_of_digits + 1;
- precision_specified = 1;
}
}
/* zero padding to specified precision? */
diff --git a/src/normal.c b/src/normal.c
index 5ae9ff1ae..477907520 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -214,7 +214,7 @@ static const struct nv_cmd
{NL, nv_down, 0, FALSE},
{Ctrl_K, nv_error, 0, 0},
{Ctrl_L, nv_clear, 0, 0},
- {Ctrl_M, nv_down, 0, TRUE},
+ {CAR, nv_down, 0, TRUE},
{Ctrl_N, nv_down, NV_STS, FALSE},
{Ctrl_O, nv_ctrlo, 0, 0},
{Ctrl_P, nv_up, NV_STS, FALSE},
@@ -4263,7 +4263,6 @@ find_decl(
CLEAR_POS(&found_pos);
for (;;)
{
- valid = FALSE;
t = searchit(curwin, curbuf, &curwin->w_cursor, NULL, FORWARD,
pat, 1L, searchflags, RE_LAST, (linenr_T)0, NULL, NULL);
if (curwin->w_cursor.lnum >= old_pos.lnum)
diff --git a/src/option.c b/src/option.c
index b71093b86..f9cbcbd7b 100644
--- a/src/option.c
+++ b/src/option.c
@@ -4405,7 +4405,6 @@ do_set(
key = 0;
if (*arg == '<')
{
- nextchar = 0;
opt_idx = -1;
/* look out for <t_>;> */
if (arg[1] == 't' && arg[2] == '_' && arg[3] && arg[4])
@@ -7945,7 +7944,7 @@ set_chars_option(char_u **varp)
&& p[len] == ':'
&& p[len + 1] != NUL)
{
- c1 = c2 = c3 = 0;
+ c2 = c3 = 0;
s = p + len + 1;
c1 = mb_ptr2char_adv(&s);
if (mb_char2cells(c1) > 1)
@@ -9379,6 +9378,7 @@ set_num_option(
if (!starting && errmsg == NULL && *get_vim_var_str(VV_OPTION_TYPE) == NUL)
{
char_u buf_old[11], buf_new[11], buf_type[7];
+
vim_snprintf((char *)buf_old, 10, "%ld", old_value);
vim_snprintf((char *)buf_new, 10, "%ld", value);
vim_snprintf((char *)buf_type, 7, "%s", (opt_flags & OPT_LOCAL) ? "local" : "global");
diff --git a/src/os_unix.c b/src/os_unix.c
index 47b27cf0e..0d9f69e53 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -6147,9 +6147,9 @@ RealWaitForChar(int fd, long msec, int *check_for_gpm UNUSED, int *interrupted)
}
# endif
#ifdef FEAT_JOB_CHANNEL
- /* also call when ret == 0, we may be polling a keep-open channel */
+ // also call when ret == 0, we may be polling a keep-open channel
if (ret >= 0)
- ret = channel_poll_check(ret, &fds);
+ channel_poll_check(ret, &fds);
#endif
#else /* HAVE_SELECT */
diff --git a/src/regexp.c b/src/regexp.c
index 5557987d5..0a6695cef 100644
--- a/src/regexp.c
+++ b/src/regexp.c
@@ -2785,7 +2785,7 @@ reginsert_nr(int op, long val, char_u *opnd)
*place++ = op;
*place++ = NUL;
*place++ = NUL;
- place = re_put_long(place, (long_u)val);
+ re_put_long(place, (long_u)val);
}
/*
diff --git a/src/screen.c b/src/screen.c
index 111c77d8a..c01a74c44 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -4900,7 +4900,7 @@ win_line(
else
{
char_u *p;
- int len = n_extra;
+ int len;
int i;
int saved_nextra = n_extra;
@@ -5505,8 +5505,8 @@ win_line(
if (vcol < v + col - win_col_off(wp))
vcol = v + col - win_col_off(wp);
#ifdef FEAT_CONCEAL
- /* Get rid of the boguscols now, we want to draw until the right
- * edge for 'cursorcolumn'. */
+ // Get rid of the boguscols now, we want to draw until the right
+ // edge for 'cursorcolumn'.
col -= boguscols;
boguscols = 0;
#endif
@@ -10466,7 +10466,6 @@ draw_tabline(void)
attr = attr_nosel;
tabcount = 0;
- scol = 0;
for (tp = first_tabpage; tp != NULL && col < Columns - 4;
tp = tp->tp_next)
{
@@ -10799,7 +10798,7 @@ win_redr_ruler(win_T *wp, int always, int ignore_pum)
int o;
int this_ru_col;
int off = 0;
- int width = Columns;
+ int width;
/* If 'ruler' off or redrawing disabled, don't do anything */
if (!p_ru)
diff --git a/src/version.c b/src/version.c
index 686a7bd05..0ccf490fb 100644
--- a/src/version.c
+++ b/src/version.c
@@ -780,6 +780,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1032,
+/**/
1031,
/**/
1030,