Skip to content

Commit dc633cf

Browse files
committed
patch 7.4.1780
Problem: Warnings reported by cppcheck. Solution: Fix the warnings. (Dominique Pelle)
1 parent 73dfe91 commit dc633cf

File tree

6 files changed

+16
-12
lines changed

6 files changed

+16
-12
lines changed

src/ex_cmds2.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,8 @@ do_debug(char_u *cmd)
335335
get_maxbacktrace_level(void)
336336
{
337337
char *p, *q;
338-
int maxbacktrace = 1;
338+
int maxbacktrace = 0;
339339

340-
maxbacktrace = 0;
341340
if (sourcing_name != NULL)
342341
{
343342
p = (char *)sourcing_name;

src/json.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,6 @@ json_decode_string(js_read_T *reader, typval_T *res)
539539
char_u *p;
540540
int c;
541541
long nr;
542-
char_u buf[NUMBUFLEN];
543542

544543
if (res != NULL)
545544
ga_init2(&ga, 1, 200);
@@ -617,6 +616,7 @@ json_decode_string(js_read_T *reader, typval_T *res)
617616
if (res != NULL)
618617
{
619618
#ifdef FEAT_MBYTE
619+
char_u buf[NUMBUFLEN];
620620
buf[utf_char2bytes((int)nr, buf)] = NUL;
621621
ga_concat(&ga, buf);
622622
#else

src/misc1.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1197,7 +1197,7 @@ open_line(
11971197
int i;
11981198
int l;
11991199

1200-
for (i = 0; p[i] != NUL && i < lead_len; i += l)
1200+
for (i = 0; i < lead_len && p[i] != NUL; i += l)
12011201
{
12021202
l = (*mb_ptr2len)(p + i);
12031203
if (vim_strnsize(p, i + l) > repl_size)

src/ops.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5709,7 +5709,7 @@ do_addsub(
57095709
if (buf1 == NULL)
57105710
goto theend;
57115711
ptr = buf1;
5712-
if (negative && (!visual || (visual && was_positive)))
5712+
if (negative && (!visual || was_positive))
57135713
{
57145714
*ptr++ = '-';
57155715
}

src/regexp_nfa.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5515,14 +5515,9 @@ nfa_regmatch(
55155515
int add_off = 0;
55165516
int toplevel = start->c == NFA_MOPEN;
55175517
#ifdef NFA_REGEXP_DEBUG_LOG
5518-
FILE *debug = fopen(NFA_REGEXP_DEBUG_LOG, "a");
5519-
5520-
if (debug == NULL)
5521-
{
5522-
EMSG2(_("(NFA) COULD NOT OPEN %s !"), NFA_REGEXP_DEBUG_LOG);
5523-
return FALSE;
5524-
}
5518+
FILE *debug;
55255519
#endif
5520+
55265521
/* Some patterns may take a long time to match, especially when using
55275522
* recursive_regmatch(). Allow interrupting them with CTRL-C. */
55285523
fast_breakcheck();
@@ -5533,6 +5528,14 @@ nfa_regmatch(
55335528
return FALSE;
55345529
#endif
55355530

5531+
#ifdef NFA_REGEXP_DEBUG_LOG
5532+
debug = fopen(NFA_REGEXP_DEBUG_LOG, "a");
5533+
if (debug == NULL)
5534+
{
5535+
EMSG2(_("(NFA) COULD NOT OPEN %s !"), NFA_REGEXP_DEBUG_LOG);
5536+
return FALSE;
5537+
}
5538+
#endif
55365539
nfa_match = FALSE;
55375540

55385541
/* Allocate memory for the lists of nodes. */

src/version.c

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

754754
static int included_patches[] =
755755
{ /* Add new patch number below this line */
756+
/**/
757+
1780,
756758
/**/
757759
1779,
758760
/**/

0 commit comments

Comments
 (0)