From de3e2f051e2a59d72498edc61db109a5f09708f0 Mon Sep 17 00:00:00 2001 From: Ihor Antonov Date: Mon, 15 Jul 2019 18:55:10 -0400 Subject: PVS/V1028: cast operands, not the result #10498 The + 1 can be removed. It was used for current_screenline, which now is dedicated linebuf_char buffer. --- src/nvim/screen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 63a465f332..553008c010 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -6079,8 +6079,8 @@ void grid_alloc(ScreenGrid *grid, int rows, int columns, bool copy, bool valid) { int new_row; ScreenGrid new = *grid; - - size_t ncells = (size_t)((rows+1) * columns); + assert(rows >= 0 && columns >= 0); + size_t ncells = (size_t)rows * columns; new.chars = xmalloc(ncells * sizeof(schar_T)); new.attrs = xmalloc(ncells * sizeof(sattr_T)); new.line_offset = xmalloc((size_t)(rows * sizeof(unsigned))); -- cgit