comparison src/terminal.c @ 22687:73688eec32ca v8.2.1892

patch 8.2.1892: valgrind warns for using uninitialized access in tests Commit: https://github.com/vim/vim/commit/9c24cd11e2048e16e25271a7a7dbef4593890a18 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Oct 23 15:40:39 2020 +0200 patch 8.2.1892: valgrind warns for using uninitialized access in tests Problem: Valgrind warns for using uninitialized access in tests. Solution: Fix condition for breaking out of loop. (Dominique Pell?, closes #7187)
author Bram Moolenaar <Bram@vim.org>
date Fri, 23 Oct 2020 15:45:04 +0200
parents 5e287462487e
children e82579016863
comparison
equal deleted inserted replaced
22686:931753494510 22687:73688eec32ca
4716 4716
4717 for (i = 0; i < VTERM_MAX_CHARS_PER_CELL; ++i) 4717 for (i = 0; i < VTERM_MAX_CHARS_PER_CELL; ++i)
4718 { 4718 {
4719 int c = cell.chars[i]; 4719 int c = cell.chars[i];
4720 int pc = prev_cell.chars[i]; 4720 int pc = prev_cell.chars[i];
4721 int should_break = c == NUL || pc == NUL;
4721 4722
4722 // For the first character NUL is the same as space. 4723 // For the first character NUL is the same as space.
4723 if (i == 0) 4724 if (i == 0)
4724 { 4725 {
4725 c = (c == NUL) ? ' ' : c; 4726 c = (c == NUL) ? ' ' : c;
4726 pc = (pc == NUL) ? ' ' : pc; 4727 pc = (pc == NUL) ? ' ' : pc;
4727 } 4728 }
4728 if (c != pc) 4729 if (c != pc)
4729 same_chars = FALSE; 4730 same_chars = FALSE;
4730 if (c == NUL || pc == NUL) 4731 if (should_break)
4731 break; 4732 break;
4732 } 4733 }
4733 same_attr = vtermAttr2hl(cell.attrs) 4734 same_attr = vtermAttr2hl(cell.attrs)
4734 == vtermAttr2hl(prev_cell.attrs) 4735 == vtermAttr2hl(prev_cell.attrs)
4735 && vterm_color_is_equal(&cell.fg, &prev_cell.fg) 4736 && vterm_color_is_equal(&cell.fg, &prev_cell.fg)