Karsten Hopp b3b8b9
To: vim_dev@googlegroups.com
Karsten Hopp b3b8b9
Subject: Patch 7.3.433
Karsten Hopp b3b8b9
Fcc: outbox
Karsten Hopp b3b8b9
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp b3b8b9
Mime-Version: 1.0
Karsten Hopp b3b8b9
Content-Type: text/plain; charset=UTF-8
Karsten Hopp b3b8b9
Content-Transfer-Encoding: 8bit
Karsten Hopp b3b8b9
------------
Karsten Hopp b3b8b9
Karsten Hopp b3b8b9
Patch 7.3.433
Karsten Hopp b3b8b9
Problem:    Using continued lines in a Vim script can be slow.
Karsten Hopp b3b8b9
Solution:   Instead of reallocating for every line use a growarray. (Yasuhiro
Karsten Hopp b3b8b9
            Matsumoto)
Karsten Hopp b3b8b9
Files:      src/ex_cmds2.c
Karsten Hopp b3b8b9
Karsten Hopp b3b8b9
Karsten Hopp b3b8b9
*** ../vim-7.3.432/src/ex_cmds2.c	2012-02-04 21:57:44.000000000 +0100
Karsten Hopp b3b8b9
--- src/ex_cmds2.c	2012-02-05 23:06:31.000000000 +0100
Karsten Hopp b3b8b9
***************
Karsten Hopp b3b8b9
*** 3439,3460 ****
Karsten Hopp b3b8b9
      {
Karsten Hopp b3b8b9
  	/* compensate for the one line read-ahead */
Karsten Hopp b3b8b9
  	--sourcing_lnum;
Karsten Hopp b3b8b9
! 	for (;;)
Karsten Hopp b3b8b9
  	{
Karsten Hopp b3b8b9
! 	    sp->nextline = get_one_sourceline(sp);
Karsten Hopp b3b8b9
! 	    if (sp->nextline == NULL)
Karsten Hopp b3b8b9
! 		break;
Karsten Hopp b3b8b9
! 	    p = skipwhite(sp->nextline);
Karsten Hopp b3b8b9
! 	    if (*p != '\\')
Karsten Hopp b3b8b9
! 		break;
Karsten Hopp b3b8b9
! 	    s = alloc((unsigned)(STRLEN(line) + STRLEN(p)));
Karsten Hopp b3b8b9
! 	    if (s == NULL)	/* out of memory */
Karsten Hopp b3b8b9
! 		break;
Karsten Hopp b3b8b9
! 	    STRCPY(s, line);
Karsten Hopp b3b8b9
! 	    STRCAT(s, p + 1);
Karsten Hopp b3b8b9
  	    vim_free(line);
Karsten Hopp b3b8b9
! 	    line = s;
Karsten Hopp b3b8b9
! 	    vim_free(sp->nextline);
Karsten Hopp b3b8b9
  	}
Karsten Hopp b3b8b9
      }
Karsten Hopp b3b8b9
  
Karsten Hopp b3b8b9
--- 3439,3470 ----
Karsten Hopp b3b8b9
      {
Karsten Hopp b3b8b9
  	/* compensate for the one line read-ahead */
Karsten Hopp b3b8b9
  	--sourcing_lnum;
Karsten Hopp b3b8b9
! 
Karsten Hopp b3b8b9
! 	/* Get the next line and concatenate it when it starts with a
Karsten Hopp b3b8b9
! 	 * backslash. We always need to read the next line, keep it in
Karsten Hopp b3b8b9
! 	 * sp->nextline. */
Karsten Hopp b3b8b9
! 	sp->nextline = get_one_sourceline(sp);
Karsten Hopp b3b8b9
! 	if (sp->nextline != NULL && *(p = skipwhite(sp->nextline)) == '\\')
Karsten Hopp b3b8b9
  	{
Karsten Hopp b3b8b9
! 	    garray_T    ga;
Karsten Hopp b3b8b9
! 
Karsten Hopp b3b8b9
! 	    ga_init2(&ga, (int)sizeof(char_u), 200);
Karsten Hopp b3b8b9
! 	    ga_concat(&ga, line);
Karsten Hopp b3b8b9
! 	    ga_concat(&ga, p + 1);
Karsten Hopp b3b8b9
! 	    for (;;)
Karsten Hopp b3b8b9
! 	    {
Karsten Hopp b3b8b9
! 		vim_free(sp->nextline);
Karsten Hopp b3b8b9
! 		sp->nextline = get_one_sourceline(sp);
Karsten Hopp b3b8b9
! 		if (sp->nextline == NULL)
Karsten Hopp b3b8b9
! 		    break;
Karsten Hopp b3b8b9
! 		p = skipwhite(sp->nextline);
Karsten Hopp b3b8b9
! 		if (*p != '\\')
Karsten Hopp b3b8b9
! 		    break;
Karsten Hopp b3b8b9
! 		ga_concat(&ga, p + 1);
Karsten Hopp b3b8b9
! 	    }
Karsten Hopp b3b8b9
! 	    ga_append(&ga, NUL);
Karsten Hopp b3b8b9
  	    vim_free(line);
Karsten Hopp b3b8b9
! 	    line = ga.ga_data;
Karsten Hopp b3b8b9
  	}
Karsten Hopp b3b8b9
      }
Karsten Hopp b3b8b9
  
Karsten Hopp b3b8b9
*** ../vim-7.3.432/src/version.c	2012-02-05 22:51:27.000000000 +0100
Karsten Hopp b3b8b9
--- src/version.c	2012-02-05 23:09:21.000000000 +0100
Karsten Hopp b3b8b9
***************
Karsten Hopp b3b8b9
*** 716,717 ****
Karsten Hopp b3b8b9
--- 716,719 ----
Karsten Hopp b3b8b9
  {   /* Add new patch number below this line */
Karsten Hopp b3b8b9
+ /**/
Karsten Hopp b3b8b9
+     433,
Karsten Hopp b3b8b9
  /**/
Karsten Hopp b3b8b9
Karsten Hopp b3b8b9
-- 
Karsten Hopp b3b8b9
Due knot trussed yore spell chequer two fined awl miss steaks.
Karsten Hopp b3b8b9
Karsten Hopp b3b8b9
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp b3b8b9
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp b3b8b9
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp b3b8b9
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///