diff options
author | zeertzjq <zeertzjq@outlook.com> | 2024-05-22 06:54:09 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-22 06:54:09 +0800 |
commit | 2d8cb1bc9bb06920ed7423861fb20038848e79ae (patch) | |
tree | 6a9e75cb83c78c1828ef96fda8d6b1a607a461d3 /src/nvim/ex_getln.c | |
parent | 879d17ea8d62c199ea0c91c5f37a4f25495be7ce (diff) | |
parent | 59fe8ffdeaacc08b811aa97d270daec6d6ed2769 (diff) | |
download | rneovim-2d8cb1bc9bb06920ed7423861fb20038848e79ae.tar.gz rneovim-2d8cb1bc9bb06920ed7423861fb20038848e79ae.tar.bz2 rneovim-2d8cb1bc9bb06920ed7423861fb20038848e79ae.zip |
Merge pull request #28905 from zeertzjq/vim-9.1.0426
vim-patch:9.1.{0426,0428}: too many strlen() calls in search.c
Diffstat (limited to 'src/nvim/ex_getln.c')
-rw-r--r-- | src/nvim/ex_getln.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 8c9e6e454a..f18dc0f747 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -470,7 +470,7 @@ static void may_do_incsearch_highlighting(int firstc, int count, incsearch_state .sa_tm = &tm, }; found = do_search(NULL, firstc == ':' ? '/' : firstc, search_delim, - ccline.cmdbuff + skiplen, count, + ccline.cmdbuff + skiplen, (size_t)patlen, count, search_flags, &sia); ccline.cmdbuff[skiplen + patlen] = next_char; emsg_off--; @@ -884,11 +884,12 @@ static uint8_t *command_line_enter(int firstc, int count, int indent, bool clear && ccline.cmdlen && s->firstc != NUL && (s->some_key_typed || s->histype == HIST_SEARCH)) { - add_to_history(s->histype, ccline.cmdbuff, true, + size_t cmdbufflen = strlen(ccline.cmdbuff); + add_to_history(s->histype, ccline.cmdbuff, cmdbufflen, true, s->histype == HIST_SEARCH ? s->firstc : NUL); if (s->firstc == ':') { xfree(new_last_cmdline); - new_last_cmdline = xstrdup(ccline.cmdbuff); + new_last_cmdline = xstrnsave(ccline.cmdbuff, cmdbufflen); } } @@ -1451,7 +1452,7 @@ static int may_do_command_line_next_incsearch(int firstc, int count, incsearch_s pat[patlen] = NUL; int found = searchit(curwin, curbuf, &t, NULL, next_match ? FORWARD : BACKWARD, - pat, count, search_flags, + pat, (size_t)patlen, count, search_flags, RE_SEARCH, NULL); emsg_off--; pat[patlen] = save; |