diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-11-14 23:18:25 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-14 23:18:25 +0800 |
commit | 30604320072335122aea0f37890f136b2ba0e445 (patch) | |
tree | d709ae8a0ea58dea790efd1605b11d33a1690312 | |
parent | e8cc489accc435076afb4fdf89778b64f0a48473 (diff) | |
download | rneovim-30604320072335122aea0f37890f136b2ba0e445.tar.gz rneovim-30604320072335122aea0f37890f136b2ba0e445.tar.bz2 rneovim-30604320072335122aea0f37890f136b2ba0e445.zip |
vim-patch:9.0.0878: Coverity warns for dead code (#21053)
Problem: Coverity warns for dead code.
Solution: Remove the dead code.
https://github.com/vim/vim/commit/b298fe6cbae3b240b10dbd55d9c38d0cc8e033d3
Nvim has refactored this function and does not have the dead code.
Co-authored-by: Bram Moolenaar <Bram@vim.org>
-rw-r--r-- | src/nvim/cmdhist.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/cmdhist.c b/src/nvim/cmdhist.c index 5f80c29d72..0ae586743f 100644 --- a/src/nvim/cmdhist.c +++ b/src/nvim/cmdhist.c @@ -124,7 +124,7 @@ void init_history(void) // Tables are circular arrays (current position marked by hisidx[type]). // On copying them to the new arrays, we take the chance to reorder them. for (int type = 0; type < HIST_COUNT; type++) { - histentry_T *temp = (newlen + histentry_T *temp = (newlen > 0 ? xmalloc((size_t)newlen * sizeof(*temp)) : NULL); @@ -159,7 +159,7 @@ void init_history(void) // clear remaining space, if any int l3 = j < 0 ? 0 : MIN(newlen, oldlen); // number of copied entries - if (newlen) { + if (newlen > 0) { memset(temp + l3, 0, (size_t)(newlen - l3) * sizeof(*temp)); } |