]> granicus.if.org Git - vim/commitdiff
patch 8.2.1892: valgrind warns for using uninitialized access in tests v8.2.1892
authorBram Moolenaar <Bram@vim.org>
Fri, 23 Oct 2020 13:40:39 +0000 (15:40 +0200)
committerBram Moolenaar <Bram@vim.org>
Fri, 23 Oct 2020 13:40:39 +0000 (15:40 +0200)
Problem:    Valgrind warns for using uninitialized access in tests.
Solution:   Fix condition for breaking out of loop. (Dominique PellĂ©,
            closes #7187)

src/terminal.c
src/version.c

index 867a0e3f3b30a40b0eefe92d7f237ff54a825e52..049e2e7c3e6fdf935cd15bcf93c9d0b7e6c4e976 100644 (file)
@@ -4718,6 +4718,7 @@ f_term_dumpwrite(typval_T *argvars, typval_T *rettv UNUSED)
            {
                int c = cell.chars[i];
                int pc = prev_cell.chars[i];
+               int should_break = c == NUL || pc == NUL;
 
                // For the first character NUL is the same as space.
                if (i == 0)
@@ -4727,7 +4728,7 @@ f_term_dumpwrite(typval_T *argvars, typval_T *rettv UNUSED)
                }
                if (c != pc)
                    same_chars = FALSE;
-               if (c == NUL || pc == NUL)
+               if (should_break)
                    break;
            }
            same_attr = vtermAttr2hl(cell.attrs)
index 4b27b16ec9daf1880e655b2d9c6e30216a1307cc..297d5b47b9bdaf6848883a559bdba7c3039d4526 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1892,
 /**/
     1891,
 /**/