aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2025-03-11 06:54:17 +0800
committerGitHub <noreply@github.com>2025-03-11 06:54:17 +0800
commit7e2b75760f1723c44bf69951dad2cb8da92aa213 (patch)
tree735bd1272e53e1f11e9ed9f878a5f6043efeaa62 /src
parent1f49a59b8bde0aeb3a1ef754bcb3724d9af241bb (diff)
downloadrneovim-7e2b75760f1723c44bf69951dad2cb8da92aa213.tar.gz
rneovim-7e2b75760f1723c44bf69951dad2cb8da92aa213.tar.bz2
rneovim-7e2b75760f1723c44bf69951dad2cb8da92aa213.zip
vim-patch:9.1.1193: Unnecessary use of STRCAT() in au_event_disable() (#32829)
Problem: Unnecessary use of STRCAT() in au_event_disable(). STRCAT() seeks to the end of new_ei, but here the end is already known. Solution: Use STRCPY() and add p_ei_len to new_ei. Also fix a typo in a comment. Add a test that 'eventignore' works in :argdo (zeertzjq). closes: vim/vim#16844 https://github.com/vim/vim/commit/969e11a18b145241dc0ab39fc1be7ed814655dfc Cherry-pick p_ei_len from patch 9.1.0256.
Diffstat (limited to 'src')
-rw-r--r--src/nvim/autocmd.c7
-rw-r--r--src/nvim/ex_getln.c2
2 files changed, 5 insertions, 4 deletions
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c
index c00a5814b1..1246b2fc5c 100644
--- a/src/nvim/autocmd.c
+++ b/src/nvim/autocmd.c
@@ -700,12 +700,13 @@ int check_ei(char *ei)
// Returns the old value of 'eventignore' in allocated memory.
char *au_event_disable(char *what)
{
- char *save_ei = xstrdup(p_ei);
- char *new_ei = xstrnsave(p_ei, strlen(p_ei) + strlen(what));
+ size_t p_ei_len = strlen(p_ei);
+ char *save_ei = xmemdupz(p_ei, p_ei_len);
+ char *new_ei = xstrnsave(p_ei, p_ei_len + strlen(what));
if (*what == ',' && *p_ei == NUL) {
STRCPY(new_ei, what + 1);
} else {
- strcat(new_ei, what);
+ STRCPY(new_ei + p_ei_len, what);
}
set_option_direct(kOptEventignore, CSTR_AS_OPTVAL(new_ei), 0, SID_NONE);
xfree(new_ei);
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 240bdae6cb..22b5d7accd 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -4528,7 +4528,7 @@ static int open_cmdwin(void)
State = MODE_NORMAL;
setmouse();
- // Reset here so it can be set by a CmdWinEnter autocommand.
+ // Reset here so it can be set by a CmdwinEnter autocommand.
cmdwin_result = 0;
// Trigger CmdwinEnter autocommands.