mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 06:28:35 +00:00
vim-patch:3495497: patch 9.1.1212: too many strlen() calls in edit.c
Problem: too many strlen() calls in edit.c
Solution: refactor edit.c and remove strlen() calls
(John Marriott)
This commit attempts to make edit.c more efficient by:
- in truncate_spaces() pass in the length of the string.
- return a string_T from get_last_insert(), so that the length of the
string is available to the caller.
- refactor stuff_insert():
- replace calls to stuffReadbuff() (which calls STRLEN() on it's
string argument) with stuffReadbuffLen() (which gets the length of
it's string argument passed in).
- replace call to vim_strrchr() which searches from the start of the
string with a loop which searches from end of the string to find the
last ESC character.
- change get_last_insert_save() to call get_last_insert() to get the
last_insert string (the logic is in one place).
closes: vim/vim#16863
34954972c2
Co-authored-by: John Marriott <basilisk@internode.on.net>
This commit is contained in:
@@ -3849,7 +3849,7 @@ void ex_display(exarg_T *eap)
|
||||
}
|
||||
|
||||
// display last inserted text
|
||||
if ((p = get_last_insert()) != NULL
|
||||
if ((p = get_last_insert()->data) != NULL
|
||||
&& (arg == NULL || vim_strchr(arg, '.') != NULL) && !got_int
|
||||
&& !message_filtered(p)) {
|
||||
msg_puts("\n c \". ");
|
||||
|
Reference in New Issue
Block a user