|
|
3ef2ca |
To: vim_dev@googlegroups.com
|
|
|
3ef2ca |
Subject: Patch 7.4.499
|
|
|
3ef2ca |
Fcc: outbox
|
|
|
3ef2ca |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
|
3ef2ca |
Mime-Version: 1.0
|
|
|
3ef2ca |
Content-Type: text/plain; charset=UTF-8
|
|
|
3ef2ca |
Content-Transfer-Encoding: 8bit
|
|
|
3ef2ca |
------------
|
|
|
3ef2ca |
|
|
|
3ef2ca |
Patch 7.4.499
|
|
|
3ef2ca |
Problem: substitute() can be slow with long strings.
|
|
|
3ef2ca |
Solution: Store a pointer to the end, instead of calling strlen() every
|
|
|
3ef2ca |
time. (Ozaki Kiichi)
|
|
|
3ef2ca |
Files: src/eval.c
|
|
|
3ef2ca |
|
|
|
3ef2ca |
|
|
|
3ef2ca |
*** ../vim-7.4.498/src/eval.c 2014-10-31 15:45:49.171053328 +0100
|
|
|
3ef2ca |
--- src/eval.c 2014-11-05 15:49:49.040637923 +0100
|
|
|
3ef2ca |
***************
|
|
|
3ef2ca |
*** 25076,25081 ****
|
|
|
3ef2ca |
--- 25076,25082 ----
|
|
|
3ef2ca |
int i;
|
|
|
3ef2ca |
int do_all;
|
|
|
3ef2ca |
char_u *tail;
|
|
|
3ef2ca |
+ char_u *end;
|
|
|
3ef2ca |
garray_T ga;
|
|
|
3ef2ca |
char_u *ret;
|
|
|
3ef2ca |
char_u *save_cpo;
|
|
|
3ef2ca |
***************
|
|
|
3ef2ca |
*** 25094,25099 ****
|
|
|
3ef2ca |
--- 25095,25101 ----
|
|
|
3ef2ca |
if (regmatch.regprog != NULL)
|
|
|
3ef2ca |
{
|
|
|
3ef2ca |
tail = str;
|
|
|
3ef2ca |
+ end = str + STRLEN(str);
|
|
|
3ef2ca |
while (vim_regexec_nl(®match, str, (colnr_T)(tail - str)))
|
|
|
3ef2ca |
{
|
|
|
3ef2ca |
/* Skip empty match except for first match. */
|
|
|
3ef2ca |
***************
|
|
|
3ef2ca |
*** 25120,25126 ****
|
|
|
3ef2ca |
* - The text after the match.
|
|
|
3ef2ca |
*/
|
|
|
3ef2ca |
sublen = vim_regsub(®match, sub, tail, FALSE, TRUE, FALSE);
|
|
|
3ef2ca |
! if (ga_grow(&ga, (int)(STRLEN(tail) + sublen -
|
|
|
3ef2ca |
(regmatch.endp[0] - regmatch.startp[0]))) == FAIL)
|
|
|
3ef2ca |
{
|
|
|
3ef2ca |
ga_clear(&ga);
|
|
|
3ef2ca |
--- 25122,25128 ----
|
|
|
3ef2ca |
* - The text after the match.
|
|
|
3ef2ca |
*/
|
|
|
3ef2ca |
sublen = vim_regsub(®match, sub, tail, FALSE, TRUE, FALSE);
|
|
|
3ef2ca |
! if (ga_grow(&ga, (int)((end - tail) + sublen -
|
|
|
3ef2ca |
(regmatch.endp[0] - regmatch.startp[0]))) == FAIL)
|
|
|
3ef2ca |
{
|
|
|
3ef2ca |
ga_clear(&ga);
|
|
|
3ef2ca |
*** ../vim-7.4.498/src/version.c 2014-11-05 15:46:06.212643292 +0100
|
|
|
3ef2ca |
--- src/version.c 2014-11-05 15:50:52.880636385 +0100
|
|
|
3ef2ca |
***************
|
|
|
3ef2ca |
*** 743,744 ****
|
|
|
3ef2ca |
--- 743,746 ----
|
|
|
3ef2ca |
{ /* Add new patch number below this line */
|
|
|
3ef2ca |
+ /**/
|
|
|
3ef2ca |
+ 499,
|
|
|
3ef2ca |
/**/
|
|
|
3ef2ca |
|
|
|
3ef2ca |
--
|
|
|
3ef2ca |
ARTHUR: A scratch? Your arm's off!
|
|
|
3ef2ca |
BLACK KNIGHT: No, it isn't.
|
|
|
3ef2ca |
ARTHUR: Well, what's that then?
|
|
|
3ef2ca |
BLACK KNIGHT: I've had worse.
|
|
|
3ef2ca |
The Quest for the Holy Grail (Monty Python)
|
|
|
3ef2ca |
|
|
|
3ef2ca |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
|
3ef2ca |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
|
3ef2ca |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
|
3ef2ca |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|