home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.4 / 7.4.499 < prev    next >
Encoding:
Internet Message Format  |  2014-11-05  |  2.3 KB

  1. To: vim_dev@googlegroups.com
  2. Subject: Patch 7.4.499
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.4.499
  11. Problem:    substitute() can be slow with long strings.
  12. Solution:   Store a pointer to the end, instead of calling strlen() every
  13.         time. (Ozaki Kiichi)
  14. Files:        src/eval.c
  15.  
  16.  
  17. *** ../vim-7.4.498/src/eval.c    2014-10-31 15:45:49.171053328 +0100
  18. --- src/eval.c    2014-11-05 15:49:49.040637923 +0100
  19. ***************
  20. *** 25076,25081 ****
  21. --- 25076,25082 ----
  22.       int        i;
  23.       int        do_all;
  24.       char_u    *tail;
  25. +     char_u    *end;
  26.       garray_T    ga;
  27.       char_u    *ret;
  28.       char_u    *save_cpo;
  29. ***************
  30. *** 25094,25099 ****
  31. --- 25095,25101 ----
  32.       if (regmatch.regprog != NULL)
  33.       {
  34.       tail = str;
  35. +     end = str + STRLEN(str);
  36.       while (vim_regexec_nl(®match, str, (colnr_T)(tail - str)))
  37.       {
  38.           /* Skip empty match except for first match. */
  39. ***************
  40. *** 25120,25126 ****
  41.            * - The text after the match.
  42.            */
  43.           sublen = vim_regsub(®match, sub, tail, FALSE, TRUE, FALSE);
  44. !         if (ga_grow(&ga, (int)(STRLEN(tail) + sublen -
  45.                   (regmatch.endp[0] - regmatch.startp[0]))) == FAIL)
  46.           {
  47.           ga_clear(&ga);
  48. --- 25122,25128 ----
  49.            * - The text after the match.
  50.            */
  51.           sublen = vim_regsub(®match, sub, tail, FALSE, TRUE, FALSE);
  52. !         if (ga_grow(&ga, (int)((end - tail) + sublen -
  53.                   (regmatch.endp[0] - regmatch.startp[0]))) == FAIL)
  54.           {
  55.           ga_clear(&ga);
  56. *** ../vim-7.4.498/src/version.c    2014-11-05 15:46:06.212643292 +0100
  57. --- src/version.c    2014-11-05 15:50:52.880636385 +0100
  58. ***************
  59. *** 743,744 ****
  60. --- 743,746 ----
  61.   {   /* Add new patch number below this line */
  62. + /**/
  63. +     499,
  64.   /**/
  65.  
  66. -- 
  67. ARTHUR:        A scratch?  Your arm's off!
  68. BLACK KNIGHT:  No, it isn't.
  69. ARTHUR:        Well, what's that then?
  70. BLACK KNIGHT:  I've had worse.
  71.                                   The Quest for the Holy Grail (Monty Python)
  72.  
  73.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  74. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  75. \\\  an exciting new programming language -- http://www.Zimbu.org        ///
  76.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  77.