summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-04-07 14:02:01 +0200
committerBram Moolenaar <Bram@vim.org>2017-04-07 14:02:01 +0200
commit866c68861071f8cd1ef5a82445bebaafc8626e7e (patch)
tree404ce70bd6716788176cb6a24448de162de57cda
parentba6ec182973af726ce9b7b7eb3753fc3a7ae7d1b (diff)
downloadvim-git-866c68861071f8cd1ef5a82445bebaafc8626e7e.tar.gz
patch 8.0.0544: cppcheck warningsv8.0.0544
Problem: Cppcheck warnings. Solution: Use temp variable. Change NUL to NULL. Swap conditions. (Dominique Pelle)
-rw-r--r--src/channel.c9
-rw-r--r--src/edit.c2
-rw-r--r--src/farsi.c2
-rw-r--r--src/version.c2
4 files changed, 11 insertions, 4 deletions
diff --git a/src/channel.c b/src/channel.c
index 410f92800..54a141c7d 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -2571,9 +2571,14 @@ may_invoke_callback(channel_T *channel, ch_part_T part)
if (nl == NULL)
{
/* Flush remaining message that is missing a NL. */
- buf = vim_realloc(buf, node->rq_buflen + 1);
- if (buf == NULL)
+ char_u *new_buf;
+
+ new_buf = vim_realloc(buf, node->rq_buflen + 1);
+ if (new_buf == NULL)
+ /* This might fail over and over again, should the message
+ * be dropped? */
return FALSE;
+ buf = new_buf;
node->rq_buffer = buf;
nl = buf + node->rq_buflen++;
*nl = NUL;
diff --git a/src/edit.c b/src/edit.c
index ad8b89a95..0153f3b9d 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -9524,7 +9524,7 @@ bracketed_paste(paste_mode_T mode, int drop, garray_T *gap)
#endif
buf[idx++] = c;
buf[idx] = NUL;
- if (end != NUL && STRNCMP(buf, end, idx) == 0)
+ if (end != NULL && STRNCMP(buf, end, idx) == 0)
{
if (end[idx] == NUL)
break; /* Found the end of paste code. */
diff --git a/src/farsi.c b/src/farsi.c
index bac15109e..ebed47e6e 100644
--- a/src/farsi.c
+++ b/src/farsi.c
@@ -1695,7 +1695,7 @@ conv_to_pvim(void)
ptr[i] = toF_leading(ptr[i]);
++i;
- while (canF_Rjoin(ptr[i]) && i < llen)
+ while (i < llen && canF_Rjoin(ptr[i]))
{
ptr[i] = toF_Rjoin(ptr[i]);
if (F_isterm(ptr[i]) || !F_isalpha(ptr[i]))
diff --git a/src/version.c b/src/version.c
index 4e37cf310..9db3ea007 100644
--- a/src/version.c
+++ b/src/version.c
@@ -765,6 +765,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 544,
+/**/
543,
/**/
542,