mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
updated for version 7.4.499
Problem: substitute() can be slow with long strings. Solution: Store a pointer to the end, instead of calling strlen() every time. (Ozaki Kiichi)
This commit is contained in:
parent
9c7d98d7c2
commit
e90c853ff6
@ -25076,6 +25076,7 @@ do_string_sub(str, pat, sub, flags)
|
|||||||
int i;
|
int i;
|
||||||
int do_all;
|
int do_all;
|
||||||
char_u *tail;
|
char_u *tail;
|
||||||
|
char_u *end;
|
||||||
garray_T ga;
|
garray_T ga;
|
||||||
char_u *ret;
|
char_u *ret;
|
||||||
char_u *save_cpo;
|
char_u *save_cpo;
|
||||||
@ -25094,6 +25095,7 @@ do_string_sub(str, pat, sub, flags)
|
|||||||
if (regmatch.regprog != NULL)
|
if (regmatch.regprog != NULL)
|
||||||
{
|
{
|
||||||
tail = str;
|
tail = str;
|
||||||
|
end = str + STRLEN(str);
|
||||||
while (vim_regexec_nl(®match, str, (colnr_T)(tail - str)))
|
while (vim_regexec_nl(®match, str, (colnr_T)(tail - str)))
|
||||||
{
|
{
|
||||||
/* Skip empty match except for first match. */
|
/* Skip empty match except for first match. */
|
||||||
@ -25120,7 +25122,7 @@ do_string_sub(str, pat, sub, flags)
|
|||||||
* - The text after the match.
|
* - The text after the match.
|
||||||
*/
|
*/
|
||||||
sublen = vim_regsub(®match, sub, tail, FALSE, TRUE, FALSE);
|
sublen = vim_regsub(®match, sub, tail, FALSE, TRUE, FALSE);
|
||||||
if (ga_grow(&ga, (int)(STRLEN(tail) + sublen -
|
if (ga_grow(&ga, (int)((end - tail) + sublen -
|
||||||
(regmatch.endp[0] - regmatch.startp[0]))) == FAIL)
|
(regmatch.endp[0] - regmatch.startp[0]))) == FAIL)
|
||||||
{
|
{
|
||||||
ga_clear(&ga);
|
ga_clear(&ga);
|
||||||
|
@ -741,6 +741,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
499,
|
||||||
/**/
|
/**/
|
||||||
498,
|
498,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user