jkunstle / rpms / vim

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