Karsten Hopp a13be4
To: vim_dev@googlegroups.com
Karsten Hopp a13be4
Subject: Patch 7.4.526
Karsten Hopp a13be4
Fcc: outbox
Karsten Hopp a13be4
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp a13be4
Mime-Version: 1.0
Karsten Hopp a13be4
Content-Type: text/plain; charset=UTF-8
Karsten Hopp a13be4
Content-Transfer-Encoding: 8bit
Karsten Hopp a13be4
------------
Karsten Hopp a13be4
Karsten Hopp a13be4
Patch 7.4.526
Karsten Hopp a13be4
Problem:    matchstr() fails on long text. Daniel Hahler)
Karsten Hopp a13be4
Solution:   Return NFA_TOO_EXPENSIVE from regexec_nl(). (Christian Brabandt)
Karsten Hopp a13be4
Files:	    src/regexp.c, src/regexec_nfa.c
Karsten Hopp a13be4
Karsten Hopp a13be4
Karsten Hopp a13be4
*** ../vim-7.4.525/src/regexp.c	2014-11-19 16:38:01.508680012 +0100
Karsten Hopp a13be4
--- src/regexp.c	2014-11-20 22:59:03.865027911 +0100
Karsten Hopp a13be4
***************
Karsten Hopp a13be4
*** 3739,3745 ****
Karsten Hopp a13be4
   * Uses curbuf for line count and 'iskeyword'.
Karsten Hopp a13be4
   * if "line_lbr" is TRUE  consider a "\n" in "line" to be a line break.
Karsten Hopp a13be4
   *
Karsten Hopp a13be4
!  * Return TRUE if there is a match, FALSE if not.
Karsten Hopp a13be4
   */
Karsten Hopp a13be4
      static int
Karsten Hopp a13be4
  bt_regexec_nl(rmp, line, col, line_lbr)
Karsten Hopp a13be4
--- 3739,3745 ----
Karsten Hopp a13be4
   * Uses curbuf for line count and 'iskeyword'.
Karsten Hopp a13be4
   * if "line_lbr" is TRUE  consider a "\n" in "line" to be a line break.
Karsten Hopp a13be4
   *
Karsten Hopp a13be4
!  * Returns 0 for failure, number of lines contained in the match otherwise.
Karsten Hopp a13be4
   */
Karsten Hopp a13be4
      static int
Karsten Hopp a13be4
  bt_regexec_nl(rmp, line, col, line_lbr)
Karsten Hopp a13be4
***************
Karsten Hopp a13be4
*** 3759,3765 ****
Karsten Hopp a13be4
      ireg_icombine = FALSE;
Karsten Hopp a13be4
  #endif
Karsten Hopp a13be4
      ireg_maxcol = 0;
Karsten Hopp a13be4
!     return (bt_regexec_both(line, col, NULL) != 0);
Karsten Hopp a13be4
  }
Karsten Hopp a13be4
  
Karsten Hopp a13be4
  static long bt_regexec_multi __ARGS((regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col, proftime_T *tm));
Karsten Hopp a13be4
--- 3759,3766 ----
Karsten Hopp a13be4
      ireg_icombine = FALSE;
Karsten Hopp a13be4
  #endif
Karsten Hopp a13be4
      ireg_maxcol = 0;
Karsten Hopp a13be4
! 
Karsten Hopp a13be4
!     return bt_regexec_both(line, col, NULL);
Karsten Hopp a13be4
  }
Karsten Hopp a13be4
  
Karsten Hopp a13be4
  static long bt_regexec_multi __ARGS((regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col, proftime_T *tm));
Karsten Hopp a13be4
***************
Karsten Hopp a13be4
*** 3781,3788 ****
Karsten Hopp a13be4
      colnr_T	col;		/* column to start looking for match */
Karsten Hopp a13be4
      proftime_T	*tm;		/* timeout limit or NULL */
Karsten Hopp a13be4
  {
Karsten Hopp a13be4
-     long	r;
Karsten Hopp a13be4
- 
Karsten Hopp a13be4
      reg_match = NULL;
Karsten Hopp a13be4
      reg_mmatch = rmp;
Karsten Hopp a13be4
      reg_buf = buf;
Karsten Hopp a13be4
--- 3782,3787 ----
Karsten Hopp a13be4
***************
Karsten Hopp a13be4
*** 3796,3809 ****
Karsten Hopp a13be4
  #endif
Karsten Hopp a13be4
      ireg_maxcol = rmp->rmm_maxcol;
Karsten Hopp a13be4
  
Karsten Hopp a13be4
!     r = bt_regexec_both(NULL, col, tm);
Karsten Hopp a13be4
! 
Karsten Hopp a13be4
!     return r;
Karsten Hopp a13be4
  }
Karsten Hopp a13be4
  
Karsten Hopp a13be4
  /*
Karsten Hopp a13be4
   * Match a regexp against a string ("line" points to the string) or multiple
Karsten Hopp a13be4
   * lines ("line" is NULL, use reg_getline()).
Karsten Hopp a13be4
   */
Karsten Hopp a13be4
      static long
Karsten Hopp a13be4
  bt_regexec_both(line, col, tm)
Karsten Hopp a13be4
--- 3795,3807 ----
Karsten Hopp a13be4
  #endif
Karsten Hopp a13be4
      ireg_maxcol = rmp->rmm_maxcol;
Karsten Hopp a13be4
  
Karsten Hopp a13be4
!     return bt_regexec_both(NULL, col, tm);
Karsten Hopp a13be4
  }
Karsten Hopp a13be4
  
Karsten Hopp a13be4
  /*
Karsten Hopp a13be4
   * Match a regexp against a string ("line" points to the string) or multiple
Karsten Hopp a13be4
   * lines ("line" is NULL, use reg_getline()).
Karsten Hopp a13be4
+  * Returns 0 for failure, number of lines contained in the match otherwise.
Karsten Hopp a13be4
   */
Karsten Hopp a13be4
      static long
Karsten Hopp a13be4
  bt_regexec_both(line, col, tm)
Karsten Hopp a13be4
***************
Karsten Hopp a13be4
*** 3811,3819 ****
Karsten Hopp a13be4
      colnr_T	col;		/* column to start looking for match */
Karsten Hopp a13be4
      proftime_T	*tm UNUSED;	/* timeout limit or NULL */
Karsten Hopp a13be4
  {
Karsten Hopp a13be4
!     bt_regprog_T	*prog;
Karsten Hopp a13be4
!     char_u	*s;
Karsten Hopp a13be4
!     long	retval = 0L;
Karsten Hopp a13be4
  
Karsten Hopp a13be4
      /* Create "regstack" and "backpos" if they are not allocated yet.
Karsten Hopp a13be4
       * We allocate *_INITIAL amount of bytes first and then set the grow size
Karsten Hopp a13be4
--- 3809,3817 ----
Karsten Hopp a13be4
      colnr_T	col;		/* column to start looking for match */
Karsten Hopp a13be4
      proftime_T	*tm UNUSED;	/* timeout limit or NULL */
Karsten Hopp a13be4
  {
Karsten Hopp a13be4
!     bt_regprog_T    *prog;
Karsten Hopp a13be4
!     char_u	    *s;
Karsten Hopp a13be4
!     long	    retval = 0L;
Karsten Hopp a13be4
  
Karsten Hopp a13be4
      /* Create "regstack" and "backpos" if they are not allocated yet.
Karsten Hopp a13be4
       * We allocate *_INITIAL amount of bytes first and then set the grow size
Karsten Hopp a13be4
***************
Karsten Hopp a13be4
*** 8201,8211 ****
Karsten Hopp a13be4
  
Karsten Hopp a13be4
  	p_re = save_p_re;
Karsten Hopp a13be4
      }
Karsten Hopp a13be4
!     return result;
Karsten Hopp a13be4
  }
Karsten Hopp a13be4
  
Karsten Hopp a13be4
  /*
Karsten Hopp a13be4
   * Note: "*prog" may be freed and changed.
Karsten Hopp a13be4
   */
Karsten Hopp a13be4
      int
Karsten Hopp a13be4
  vim_regexec_prog(prog, ignore_case, line, col)
Karsten Hopp a13be4
--- 8199,8210 ----
Karsten Hopp a13be4
  
Karsten Hopp a13be4
  	p_re = save_p_re;
Karsten Hopp a13be4
      }
Karsten Hopp a13be4
!     return result > 0;
Karsten Hopp a13be4
  }
Karsten Hopp a13be4
  
Karsten Hopp a13be4
  /*
Karsten Hopp a13be4
   * Note: "*prog" may be freed and changed.
Karsten Hopp a13be4
+  * Return TRUE if there is a match, FALSE if not.
Karsten Hopp a13be4
   */
Karsten Hopp a13be4
      int
Karsten Hopp a13be4
  vim_regexec_prog(prog, ignore_case, line, col)
Karsten Hopp a13be4
***************
Karsten Hopp a13be4
*** 8226,8231 ****
Karsten Hopp a13be4
--- 8225,8231 ----
Karsten Hopp a13be4
  
Karsten Hopp a13be4
  /*
Karsten Hopp a13be4
   * Note: "rmp->regprog" may be freed and changed.
Karsten Hopp a13be4
+  * Return TRUE if there is a match, FALSE if not.
Karsten Hopp a13be4
   */
Karsten Hopp a13be4
      int
Karsten Hopp a13be4
  vim_regexec(rmp, line, col)
Karsten Hopp a13be4
***************
Karsten Hopp a13be4
*** 8241,8246 ****
Karsten Hopp a13be4
--- 8241,8247 ----
Karsten Hopp a13be4
  /*
Karsten Hopp a13be4
   * Like vim_regexec(), but consider a "\n" in "line" to be a line break.
Karsten Hopp a13be4
   * Note: "rmp->regprog" may be freed and changed.
Karsten Hopp a13be4
+  * Return TRUE if there is a match, FALSE if not.
Karsten Hopp a13be4
   */
Karsten Hopp a13be4
      int
Karsten Hopp a13be4
  vim_regexec_nl(rmp, line, col)
Karsten Hopp a13be4
***************
Karsten Hopp a13be4
*** 8297,8301 ****
Karsten Hopp a13be4
  	p_re = save_p_re;
Karsten Hopp a13be4
      }
Karsten Hopp a13be4
  
Karsten Hopp a13be4
!     return result;
Karsten Hopp a13be4
  }
Karsten Hopp a13be4
--- 8298,8302 ----
Karsten Hopp a13be4
  	p_re = save_p_re;
Karsten Hopp a13be4
      }
Karsten Hopp a13be4
  
Karsten Hopp a13be4
!     return result <= 0 ? 0 : result;
Karsten Hopp a13be4
  }
Karsten Hopp a13be4
*** ../vim-7.4.525/src/version.c	2014-11-19 20:04:43.656099839 +0100
Karsten Hopp a13be4
--- src/version.c	2014-11-20 22:55:15.899663148 +0100
Karsten Hopp a13be4
***************
Karsten Hopp a13be4
*** 743,744 ****
Karsten Hopp a13be4
--- 743,746 ----
Karsten Hopp a13be4
  {   /* Add new patch number below this line */
Karsten Hopp a13be4
+ /**/
Karsten Hopp a13be4
+     526,
Karsten Hopp a13be4
  /**/
Karsten Hopp a13be4
Karsten Hopp a13be4
-- 
Karsten Hopp a13be4
Why don't cannibals eat clowns?
Karsten Hopp a13be4
Because they taste funny.
Karsten Hopp a13be4
Karsten Hopp a13be4
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp a13be4
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp a13be4
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp a13be4
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///