forked from aniani/vim
patch 9.1.1137: ins_str() is inefficient by calling STRLEN()
Problem: ins_str() is inefficient by calling STRLLEN() Solution: refactor ins_str() to take a length argument and let all callers provide the correct length when calling ins_str() (John Marriott) closes: #16711 Signed-off-by: John Marriott <basilisk@internode.on.net> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
066a5340e3
commit
f4b36417e8
@@ -2058,7 +2058,7 @@ insert_special(
|
||||
if (stop_arrow() == FAIL)
|
||||
return;
|
||||
p[len - 1] = NUL;
|
||||
ins_str(p);
|
||||
ins_str(p, len - 1);
|
||||
AppendToRedobuffLit(p, -1);
|
||||
ctrlv = FALSE;
|
||||
}
|
||||
@@ -2275,7 +2275,7 @@ insertchar(
|
||||
do_digraph(buf[i-1]); // may be the start of a digraph
|
||||
#endif
|
||||
buf[i] = NUL;
|
||||
ins_str(buf);
|
||||
ins_str(buf, i);
|
||||
if (flags & INSCHAR_CTRLV)
|
||||
{
|
||||
redo_literal(*buf);
|
||||
@@ -4300,7 +4300,7 @@ ins_bs(
|
||||
ins_char(' ');
|
||||
else
|
||||
{
|
||||
ins_str((char_u *)" ");
|
||||
ins_str((char_u *)" ", 1);
|
||||
if ((State & REPLACE_FLAG))
|
||||
replace_push(NUL);
|
||||
}
|
||||
@@ -4976,7 +4976,7 @@ ins_tab(void)
|
||||
ins_char(' ');
|
||||
else
|
||||
{
|
||||
ins_str((char_u *)" ");
|
||||
ins_str((char_u *)" ", 1);
|
||||
if (State & REPLACE_FLAG) // no char replaced
|
||||
replace_push(NUL);
|
||||
}
|
||||
|
Reference in New Issue
Block a user