neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit ee2127363463b89ba9d5071babcb9bd16c4db691
parent b3eda5e73f65092d50ccd27a0373e8b9fad076b0
Author: zeertzjq <zeertzjq@outlook.com>
Date:   Wed,  3 Jan 2024 06:57:23 +0800

Merge pull request #26860 from sus-domesticus/fix/clangd

fix/clangd (check size of array before applying qsort on it; set block pointer to null in case map is empty)
Diffstat:
Msrc/nvim/memfile.c | 2+-
Msrc/nvim/winfloat.c | 4+++-
2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/nvim/memfile.c b/src/nvim/memfile.c @@ -391,7 +391,7 @@ int mf_sync(memfile_T *mfp, int flags) // Then we only try to write blocks within the existing file. If that also // fails then we give up. int status = OK; - bhdr_T *hp; + bhdr_T *hp = NULL; // note, "last" block is typically earlier in the hash list map_foreach_value(&mfp->mf_hash, hp, { if (((flags & MFS_ALL) || hp->bh_bnum >= 0) diff --git a/src/nvim/winfloat.c b/src/nvim/winfloat.c @@ -240,7 +240,9 @@ void win_float_remove(bool bang, int count) for (win_T *wp = lastwin; wp && wp->w_floating; wp = wp->w_prev) { kv_push(float_win_arr, wp); } - qsort(float_win_arr.items, float_win_arr.size, sizeof(win_T *), float_zindex_cmp); + if (float_win_arr.size > 0) { + qsort(float_win_arr.items, float_win_arr.size, sizeof(win_T *), float_zindex_cmp); + } for (size_t i = 0; i < float_win_arr.size; i++) { if (win_close(float_win_arr.items[i], false, false) == FAIL) { break;