]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 7.4.1780 v7.4.1780
authorBram Moolenaar <Bram@vim.org>
Sat, 23 Apr 2016 12:33:19 +0000 (14:33 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 23 Apr 2016 12:33:19 +0000 (14:33 +0200)
Problem:    Warnings reported by cppcheck.
Solution:   Fix the warnings. (Dominique Pelle)

src/ex_cmds2.c
src/json.c
src/misc1.c
src/ops.c
src/regexp_nfa.c
src/version.c

index 657c77252d7a6cc4f846e1abaee1f75ddac861bc..4ddfbe421d862790e3556b4e15bfb7d10a5094c6 100644 (file)
@@ -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;
index b4ebe74146746ed7acf1d0cf74de5263e91a0eb4..aa168ec117f7a04fd2d3e0cc9188e5560dd4d49d 100644 (file)
@@ -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
index ddd9a07aa5ebbae68119c39e843e32149450df65..9fa85781aa0076f2a9fd5e30426d2c3607107ee5 100644 (file)
@@ -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)
index 0584877eb2445cec494d238f4c3ffa3369e5a26f..983d9d0e6b2338b02a13ef8e3215668e5c3745b7 100644 (file)
--- 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++ = '-';
        }
index 6d06a121de5d1d847c29c178473461ce121f6635..5e073eeeba79d0301ae70ccefdae5c1ff0d419ec 100644 (file)
@@ -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. */
index adbb46a7550c809381ad5544b170cc9765696a04..4bd5f7eb8225629a7e0e3e242080b580ca133845 100644 (file)
@@ -753,6 +753,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1780,
 /**/
     1779,
 /**/