summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-04-23 14:33:19 +0200
committerBram Moolenaar <Bram@vim.org>2016-04-23 14:33:19 +0200
commitdc633cf82758f67f656cda7fa8ccc30414ee53f8 (patch)
treee8a018a83d53136a6891b4ee4d37a8eb4183ce53
parent73dfe917ba6357413aaf98a021c91add5ac6e9bc (diff)
patch 7.4.1780v7.4.1780
Problem: Warnings reported by cppcheck. Solution: Fix the warnings. (Dominique Pelle)
-rw-r--r--src/ex_cmds2.c3
-rw-r--r--src/json.c2
-rw-r--r--src/misc1.c2
-rw-r--r--src/ops.c2
-rw-r--r--src/regexp_nfa.c17
-rw-r--r--src/version.c2
6 files changed, 16 insertions, 12 deletions
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 657c77252d..4ddfbe421d 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -335,9 +335,8 @@ do_debug(char_u *cmd)
get_maxbacktrace_level(void)
{
char *p, *q;
- int maxbacktrace = 1;
+ int maxbacktrace = 0;
- maxbacktrace = 0;
if (sourcing_name != NULL)
{
p = (char *)sourcing_name;
diff --git a/src/json.c b/src/json.c
index b4ebe74146..aa168ec117 100644
--- a/src/json.c
+++ b/src/json.c
@@ -539,7 +539,6 @@ json_decode_string(js_read_T *reader, typval_T *res)
char_u *p;
int c;
long nr;
- char_u buf[NUMBUFLEN];
if (res != NULL)
ga_init2(&ga, 1, 200);
@@ -617,6 +616,7 @@ json_decode_string(js_read_T *reader, typval_T *res)
if (res != NULL)
{
#ifdef FEAT_MBYTE
+ char_u buf[NUMBUFLEN];
buf[utf_char2bytes((int)nr, buf)] = NUL;
ga_concat(&ga, buf);
#else
diff --git a/src/misc1.c b/src/misc1.c
index ddd9a07aa5..9fa85781aa 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -1197,7 +1197,7 @@ open_line(
int i;
int l;
- for (i = 0; p[i] != NUL && i < lead_len; i += l)
+ for (i = 0; i < lead_len && p[i] != NUL; i += l)
{
l = (*mb_ptr2len)(p + i);
if (vim_strnsize(p, i + l) > repl_size)
diff --git a/src/ops.c b/src/ops.c
index 0584877eb2..983d9d0e6b 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -5709,7 +5709,7 @@ do_addsub(
if (buf1 == NULL)
goto theend;
ptr = buf1;
- if (negative && (!visual || (visual && was_positive)))
+ if (negative && (!visual || was_positive))
{
*ptr++ = '-';
}
diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c
index 6d06a121de..5e073eeeba 100644
--- a/src/regexp_nfa.c
+++ b/src/regexp_nfa.c
@@ -5515,14 +5515,9 @@ nfa_regmatch(
int add_off = 0;
int toplevel = start->c == NFA_MOPEN;
#ifdef NFA_REGEXP_DEBUG_LOG
- FILE *debug = fopen(NFA_REGEXP_DEBUG_LOG, "a");
-
- if (debug == NULL)
- {
- EMSG2(_("(NFA) COULD NOT OPEN %s !"), NFA_REGEXP_DEBUG_LOG);
- return FALSE;
- }
+ FILE *debug;
#endif
+
/* Some patterns may take a long time to match, especially when using
* recursive_regmatch(). Allow interrupting them with CTRL-C. */
fast_breakcheck();
@@ -5533,6 +5528,14 @@ nfa_regmatch(
return FALSE;
#endif
+#ifdef NFA_REGEXP_DEBUG_LOG
+ debug = fopen(NFA_REGEXP_DEBUG_LOG, "a");
+ if (debug == NULL)
+ {
+ EMSG2(_("(NFA) COULD NOT OPEN %s !"), NFA_REGEXP_DEBUG_LOG);
+ return FALSE;
+ }
+#endif
nfa_match = FALSE;
/* Allocate memory for the lists of nodes. */
diff --git a/src/version.c b/src/version.c
index adbb46a755..4bd5f7eb82 100644
--- a/src/version.c
+++ b/src/version.c
@@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1780,
+/**/
1779,
/**/
1778,