Skip to content

Commit 866c688

Browse files
committed
patch 8.0.0544: cppcheck warnings
Problem: Cppcheck warnings. Solution: Use temp variable. Change NUL to NULL. Swap conditions. (Dominique Pelle)
1 parent ba6ec18 commit 866c688

4 files changed

Lines changed: 11 additions & 4 deletions

File tree

src/channel.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2571,9 +2571,14 @@ may_invoke_callback(channel_T *channel, ch_part_T part)
25712571
if (nl == NULL)
25722572
{
25732573
/* Flush remaining message that is missing a NL. */
2574-
buf = vim_realloc(buf, node->rq_buflen + 1);
2575-
if (buf == NULL)
2574+
char_u *new_buf;
2575+
2576+
new_buf = vim_realloc(buf, node->rq_buflen + 1);
2577+
if (new_buf == NULL)
2578+
/* This might fail over and over again, should the message
2579+
* be dropped? */
25762580
return FALSE;
2581+
buf = new_buf;
25772582
node->rq_buffer = buf;
25782583
nl = buf + node->rq_buflen++;
25792584
*nl = NUL;

src/edit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9524,7 +9524,7 @@ bracketed_paste(paste_mode_T mode, int drop, garray_T *gap)
95249524
#endif
95259525
buf[idx++] = c;
95269526
buf[idx] = NUL;
9527-
if (end != NUL && STRNCMP(buf, end, idx) == 0)
9527+
if (end != NULL && STRNCMP(buf, end, idx) == 0)
95289528
{
95299529
if (end[idx] == NUL)
95309530
break; /* Found the end of paste code. */

src/farsi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1695,7 +1695,7 @@ conv_to_pvim(void)
16951695
ptr[i] = toF_leading(ptr[i]);
16961696
++i;
16971697

1698-
while (canF_Rjoin(ptr[i]) && i < llen)
1698+
while (i < llen && canF_Rjoin(ptr[i]))
16991699
{
17001700
ptr[i] = toF_Rjoin(ptr[i]);
17011701
if (F_isterm(ptr[i]) || !F_isalpha(ptr[i]))

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
544,
767769
/**/
768770
543,
769771
/**/

0 commit comments

Comments
 (0)