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