jkunstle / rpms / vim

Forked from rpms/vim 3 years ago
Clone

Blame SOURCES/7.4.262

073263
To: vim_dev@googlegroups.com
073263
Subject: Patch 7.4.262
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.262
073263
Problem:    Duplicate code in regexec().
073263
Solution:   Add line_lbr flag to regexec_nl().
073263
Files:	    src/regexp.c, src/regexp_nfa.c, src/regexp.h
073263
073263
073263
*** ../vim-7.4.261/src/regexp.c	2014-04-23 18:48:43.546854558 +0200
073263
--- src/regexp.c	2014-04-23 18:59:38.606838773 +0200
073263
***************
073263
*** 3709,3733 ****
073263
  /* TRUE if using multi-line regexp. */
073263
  #define REG_MULTI	(reg_match == NULL)
073263
  
073263
! static int  bt_regexec __ARGS((regmatch_T *rmp, char_u *line, colnr_T col));
073263
  
073263
  /*
073263
   * Match a regexp against a string.
073263
   * "rmp->regprog" is a compiled regexp as returned by vim_regcomp().
073263
   * Uses curbuf for line count and 'iskeyword'.
073263
   *
073263
   * Return TRUE if there is a match, FALSE if not.
073263
   */
073263
      static int
073263
! bt_regexec(rmp, line, col)
073263
      regmatch_T	*rmp;
073263
      char_u	*line;	/* string to match against */
073263
      colnr_T	col;	/* column to start looking for match */
073263
  {
073263
      reg_match = rmp;
073263
      reg_mmatch = NULL;
073263
      reg_maxline = 0;
073263
!     reg_line_lbr = FALSE;
073263
      reg_buf = curbuf;
073263
      reg_win = NULL;
073263
      ireg_ic = rmp->rm_ic;
073263
--- 3709,3736 ----
073263
  /* TRUE if using multi-line regexp. */
073263
  #define REG_MULTI	(reg_match == NULL)
073263
  
073263
! static int  bt_regexec_nl __ARGS((regmatch_T *rmp, char_u *line, colnr_T col, int line_lbr));
073263
! 
073263
  
073263
  /*
073263
   * Match a regexp against a string.
073263
   * "rmp->regprog" is a compiled regexp as returned by vim_regcomp().
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
      regmatch_T	*rmp;
073263
      char_u	*line;	/* string to match against */
073263
      colnr_T	col;	/* column to start looking for match */
073263
+     int		line_lbr;
073263
  {
073263
      reg_match = rmp;
073263
      reg_mmatch = NULL;
073263
      reg_maxline = 0;
073263
!     reg_line_lbr = line_lbr;
073263
      reg_buf = curbuf;
073263
      reg_win = NULL;
073263
      ireg_ic = rmp->rm_ic;
073263
***************
073263
*** 3738,3772 ****
073263
      return (bt_regexec_both(line, col, NULL) != 0);
073263
  }
073263
  
073263
- #if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \
073263
- 	|| defined(FIND_REPLACE_DIALOG) || defined(PROTO)
073263
- 
073263
- static int  bt_regexec_nl __ARGS((regmatch_T *rmp, char_u *line, colnr_T col));
073263
- 
073263
- /*
073263
-  * Like vim_regexec(), but consider a "\n" in "line" to be a line break.
073263
-  */
073263
-     static int
073263
- bt_regexec_nl(rmp, line, col)
073263
-     regmatch_T	*rmp;
073263
-     char_u	*line;	/* string to match against */
073263
-     colnr_T	col;	/* column to start looking for match */
073263
- {
073263
-     reg_match = rmp;
073263
-     reg_mmatch = NULL;
073263
-     reg_maxline = 0;
073263
-     reg_line_lbr = TRUE;
073263
-     reg_buf = curbuf;
073263
-     reg_win = NULL;
073263
-     ireg_ic = rmp->rm_ic;
073263
- #ifdef FEAT_MBYTE
073263
-     ireg_icombine = FALSE;
073263
- #endif
073263
-     ireg_maxcol = 0;
073263
-     return (bt_regexec_both(line, col, NULL) != 0);
073263
- }
073263
- #endif
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
  /*
073263
--- 3741,3746 ----
073263
***************
073263
*** 7985,7995 ****
073263
  {
073263
      bt_regcomp,
073263
      bt_regfree,
073263
-     bt_regexec,
073263
- #if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \
073263
- 	|| defined(FIND_REPLACE_DIALOG) || defined(PROTO)
073263
      bt_regexec_nl,
073263
- #endif
073263
      bt_regexec_multi
073263
  #ifdef DEBUG
073263
      ,(char_u *)""
073263
--- 7959,7965 ----
073263
***************
073263
*** 8003,8013 ****
073263
  {
073263
      nfa_regcomp,
073263
      nfa_regfree,
073263
-     nfa_regexec,
073263
- #if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \
073263
- 	|| defined(FIND_REPLACE_DIALOG) || defined(PROTO)
073263
      nfa_regexec_nl,
073263
- #endif
073263
      nfa_regexec_multi
073263
  #ifdef DEBUG
073263
      ,(char_u *)""
073263
--- 7973,7979 ----
073263
***************
073263
*** 8131,8137 ****
073263
      char_u      *line;  /* string to match against */
073263
      colnr_T     col;    /* column to start looking for match */
073263
  {
073263
!     return rmp->regprog->engine->regexec(rmp, line, col);
073263
  }
073263
  
073263
  #if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \
073263
--- 8097,8103 ----
073263
      char_u      *line;  /* string to match against */
073263
      colnr_T     col;    /* column to start looking for match */
073263
  {
073263
!     return rmp->regprog->engine->regexec_nl(rmp, line, col, FALSE);
073263
  }
073263
  
073263
  #if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \
073263
***************
073263
*** 8145,8151 ****
073263
      char_u *line;
073263
      colnr_T col;
073263
  {
073263
!     return rmp->regprog->engine->regexec_nl(rmp, line, col);
073263
  }
073263
  #endif
073263
  
073263
--- 8111,8117 ----
073263
      char_u *line;
073263
      colnr_T col;
073263
  {
073263
!     return rmp->regprog->engine->regexec_nl(rmp, line, col, TRUE);
073263
  }
073263
  #endif
073263
  
073263
*** ../vim-7.4.261/src/regexp_nfa.c	2014-04-06 21:33:39.675363743 +0200
073263
--- src/regexp_nfa.c	2014-04-23 19:00:44.354837189 +0200
073263
***************
073263
*** 311,317 ****
073263
  static long nfa_regexec_both __ARGS((char_u *line, colnr_T col));
073263
  static regprog_T *nfa_regcomp __ARGS((char_u *expr, int re_flags));
073263
  static void nfa_regfree __ARGS((regprog_T *prog));
073263
! static int nfa_regexec __ARGS((regmatch_T *rmp, char_u *line, colnr_T col));
073263
  static long nfa_regexec_multi __ARGS((regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col, proftime_T *tm));
073263
  static int match_follows __ARGS((nfa_state_T *startstate, int depth));
073263
  static int failure_chance __ARGS((nfa_state_T *state, int depth));
073263
--- 311,317 ----
073263
  static long nfa_regexec_both __ARGS((char_u *line, colnr_T col));
073263
  static regprog_T *nfa_regcomp __ARGS((char_u *expr, int re_flags));
073263
  static void nfa_regfree __ARGS((regprog_T *prog));
073263
! static int  nfa_regexec_nl __ARGS((regmatch_T *rmp, char_u *line, colnr_T col, int line_lbr));
073263
  static long nfa_regexec_multi __ARGS((regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col, proftime_T *tm));
073263
  static int match_follows __ARGS((nfa_state_T *startstate, int depth));
073263
  static int failure_chance __ARGS((nfa_state_T *state, int depth));
073263
***************
073263
*** 7060,7078 ****
073263
   * Match a regexp against a string.
073263
   * "rmp->regprog" is a compiled regexp as returned by nfa_regcomp().
073263
   * Uses curbuf for line count and 'iskeyword'.
073263
   *
073263
   * Return TRUE if there is a match, FALSE if not.
073263
   */
073263
      static int
073263
! nfa_regexec(rmp, line, col)
073263
      regmatch_T	*rmp;
073263
      char_u	*line;	/* string to match against */
073263
      colnr_T	col;	/* column to start looking for match */
073263
  {
073263
      reg_match = rmp;
073263
      reg_mmatch = NULL;
073263
      reg_maxline = 0;
073263
!     reg_line_lbr = FALSE;
073263
      reg_buf = curbuf;
073263
      reg_win = NULL;
073263
      ireg_ic = rmp->rm_ic;
073263
--- 7060,7080 ----
073263
   * Match a regexp against a string.
073263
   * "rmp->regprog" is a compiled regexp as returned by nfa_regcomp().
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
! nfa_regexec_nl(rmp, line, col, line_lbr)
073263
      regmatch_T	*rmp;
073263
      char_u	*line;	/* string to match against */
073263
      colnr_T	col;	/* column to start looking for match */
073263
+     int		line_lbr;
073263
  {
073263
      reg_match = rmp;
073263
      reg_mmatch = NULL;
073263
      reg_maxline = 0;
073263
!     reg_line_lbr = line_lbr;
073263
      reg_buf = curbuf;
073263
      reg_win = NULL;
073263
      ireg_ic = rmp->rm_ic;
073263
***************
073263
*** 7083,7117 ****
073263
      return (nfa_regexec_both(line, col) != 0);
073263
  }
073263
  
073263
- #if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \
073263
- 	|| defined(FIND_REPLACE_DIALOG) || defined(PROTO)
073263
- 
073263
- static int  nfa_regexec_nl __ARGS((regmatch_T *rmp, char_u *line, colnr_T col));
073263
- 
073263
- /*
073263
-  * Like nfa_regexec(), but consider a "\n" in "line" to be a line break.
073263
-  */
073263
-     static int
073263
- nfa_regexec_nl(rmp, line, col)
073263
-     regmatch_T	*rmp;
073263
-     char_u	*line;	/* string to match against */
073263
-     colnr_T	col;	/* column to start looking for match */
073263
- {
073263
-     reg_match = rmp;
073263
-     reg_mmatch = NULL;
073263
-     reg_maxline = 0;
073263
-     reg_line_lbr = TRUE;
073263
-     reg_buf = curbuf;
073263
-     reg_win = NULL;
073263
-     ireg_ic = rmp->rm_ic;
073263
- #ifdef FEAT_MBYTE
073263
-     ireg_icombine = FALSE;
073263
- #endif
073263
-     ireg_maxcol = 0;
073263
-     return (nfa_regexec_both(line, col) != 0);
073263
- }
073263
- #endif
073263
- 
073263
  
073263
  /*
073263
   * Match a regexp against multiple lines.
073263
--- 7085,7090 ----
073263
*** ../vim-7.4.261/src/regexp.h	2013-06-11 10:53:14.000000000 +0200
073263
--- src/regexp.h	2014-04-23 18:58:18.614840701 +0200
073263
***************
073263
*** 149,159 ****
073263
  {
073263
      regprog_T	*(*regcomp)(char_u*, int);
073263
      void	(*regfree)(regprog_T *);
073263
!     int		(*regexec)(regmatch_T*, char_u*, colnr_T);
073263
! #if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \
073263
! 	|| defined(FIND_REPLACE_DIALOG) || defined(PROTO)
073263
!     int		(*regexec_nl)(regmatch_T*, char_u*, colnr_T);
073263
! #endif
073263
      long	(*regexec_multi)(regmmatch_T*, win_T*, buf_T*, linenr_T, colnr_T, proftime_T*);
073263
  #ifdef DEBUG
073263
      char_u	*expr;
073263
--- 149,155 ----
073263
  {
073263
      regprog_T	*(*regcomp)(char_u*, int);
073263
      void	(*regfree)(regprog_T *);
073263
!     int		(*regexec_nl)(regmatch_T*, char_u*, colnr_T, int);
073263
      long	(*regexec_multi)(regmmatch_T*, win_T*, buf_T*, linenr_T, colnr_T, proftime_T*);
073263
  #ifdef DEBUG
073263
      char_u	*expr;
073263
*** ../vim-7.4.261/src/version.c	2014-04-23 18:48:43.546854558 +0200
073263
--- src/version.c	2014-04-23 18:52:20.102849340 +0200
073263
***************
073263
*** 736,737 ****
073263
--- 736,739 ----
073263
  {   /* Add new patch number below this line */
073263
+ /**/
073263
+     262,
073263
  /**/
073263
073263
-- 
073263
From "know your smileys":
073263
 ~#:-(	I just washed my hair, and I can't do nuthin' with it.
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    ///