073263
To: vim_dev@googlegroups.com
073263
Subject: Patch 7.4.519
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.519 (after 7.4.497)
073263
Problem:    Crash when using syntax highlighting.
073263
Solution:   When regprog is freed and replaced, store the result.
073263
Files:	    src/buffer.c, src/regexp.c, src/syntax.c, src/spell.c,
073263
	    src/ex_cmds2.c, src/fileio.c, src/proto/fileio.pro,
073263
	    src/proto/regexp.pro, src/os_unix.c
073263
073263
073263
*** ../vim-7.4.518/src/buffer.c	2014-09-23 15:45:04.870801055 +0200
073263
--- src/buffer.c	2014-11-19 15:50:34.129292586 +0100
073263
***************
073263
*** 28,36 ****
073263
  #include "vim.h"
073263
  
073263
  #if defined(FEAT_CMDL_COMPL) || defined(FEAT_LISTCMDS) || defined(FEAT_EVAL) || defined(FEAT_PERL)
073263
! static char_u	*buflist_match __ARGS((regprog_T *prog, buf_T *buf, int ignore_case));
073263
  # define HAVE_BUFLIST_MATCH
073263
! static char_u	*fname_match __ARGS((regprog_T *prog, char_u *name, int ignore_case));
073263
  #endif
073263
  static void	buflist_setfpos __ARGS((buf_T *buf, win_T *win, linenr_T lnum, colnr_T col, int copy_options));
073263
  static wininfo_T *find_wininfo __ARGS((buf_T *buf, int skip_diff_buffer));
073263
--- 28,36 ----
073263
  #include "vim.h"
073263
  
073263
  #if defined(FEAT_CMDL_COMPL) || defined(FEAT_LISTCMDS) || defined(FEAT_EVAL) || defined(FEAT_PERL)
073263
! static char_u	*buflist_match __ARGS((regmatch_T *rmp, buf_T *buf, int ignore_case));
073263
  # define HAVE_BUFLIST_MATCH
073263
! static char_u	*fname_match __ARGS((regmatch_T *rmp, char_u *name, int ignore_case));
073263
  #endif
073263
  static void	buflist_setfpos __ARGS((buf_T *buf, win_T *win, linenr_T lnum, colnr_T col, int copy_options));
073263
  static wininfo_T *find_wininfo __ARGS((buf_T *buf, int skip_diff_buffer));
073263
***************
073263
*** 2220,2226 ****
073263
      int		curtab_only;	/* find buffers in current tab only */
073263
  {
073263
      buf_T	*buf;
073263
-     regprog_T	*prog;
073263
      int		match = -1;
073263
      int		find_listed;
073263
      char_u	*pat;
073263
--- 2220,2225 ----
073263
***************
073263
*** 2265,2278 ****
073263
  	{
073263
  	    for (attempt = 0; attempt <= 3; ++attempt)
073263
  	    {
073263
  		/* may add '^' and '$' */
073263
  		if (toggledollar)
073263
  		    *patend = (attempt < 2) ? NUL : '$'; /* add/remove '$' */
073263
  		p = pat;
073263
  		if (*p == '^' && !(attempt & 1))	 /* add/remove '^' */
073263
  		    ++p;
073263
! 		prog = vim_regcomp(p, p_magic ? RE_MAGIC : 0);
073263
! 		if (prog == NULL)
073263
  		{
073263
  		    vim_free(pat);
073263
  		    return -1;
073263
--- 2264,2279 ----
073263
  	{
073263
  	    for (attempt = 0; attempt <= 3; ++attempt)
073263
  	    {
073263
+ 		regmatch_T	regmatch;
073263
+ 
073263
  		/* may add '^' and '$' */
073263
  		if (toggledollar)
073263
  		    *patend = (attempt < 2) ? NUL : '$'; /* add/remove '$' */
073263
  		p = pat;
073263
  		if (*p == '^' && !(attempt & 1))	 /* add/remove '^' */
073263
  		    ++p;
073263
! 		regmatch.regprog = vim_regcomp(p, p_magic ? RE_MAGIC : 0);
073263
! 		if (regmatch.regprog == NULL)
073263
  		{
073263
  		    vim_free(pat);
073263
  		    return -1;
073263
***************
073263
*** 2283,2289 ****
073263
  #ifdef FEAT_DIFF
073263
  			    && (!diffmode || diff_mode_buf(buf))
073263
  #endif
073263
! 			    && buflist_match(prog, buf, FALSE) != NULL)
073263
  		    {
073263
  			if (curtab_only)
073263
  			{
073263
--- 2284,2290 ----
073263
  #ifdef FEAT_DIFF
073263
  			    && (!diffmode || diff_mode_buf(buf))
073263
  #endif
073263
! 			    && buflist_match(&regmatch, buf, FALSE) != NULL)
073263
  		    {
073263
  			if (curtab_only)
073263
  			{
073263
***************
073263
*** 2310,2316 ****
073263
  			match = buf->b_fnum;	/* remember first match */
073263
  		    }
073263
  
073263
! 		vim_regfree(prog);
073263
  		if (match >= 0)			/* found one match */
073263
  		    break;
073263
  	    }
073263
--- 2311,2317 ----
073263
  			match = buf->b_fnum;	/* remember first match */
073263
  		    }
073263
  
073263
! 		vim_regfree(regmatch.regprog);
073263
  		if (match >= 0)			/* found one match */
073263
  		    break;
073263
  	    }
073263
***************
073263
*** 2352,2358 ****
073263
      int		round;
073263
      char_u	*p;
073263
      int		attempt;
073263
-     regprog_T	*prog;
073263
      char_u	*patc;
073263
  
073263
      *num_file = 0;		    /* return values in case of FAIL */
073263
--- 2353,2358 ----
073263
***************
073263
*** 2376,2385 ****
073263
       */
073263
      for (attempt = 0; attempt <= 1; ++attempt)
073263
      {
073263
  	if (attempt > 0 && patc == pat)
073263
  	    break;	/* there was no anchor, no need to try again */
073263
! 	prog = vim_regcomp(patc + attempt * 11, RE_MAGIC);
073263
! 	if (prog == NULL)
073263
  	{
073263
  	    if (patc != pat)
073263
  		vim_free(patc);
073263
--- 2376,2387 ----
073263
       */
073263
      for (attempt = 0; attempt <= 1; ++attempt)
073263
      {
073263
+ 	regmatch_T	regmatch;
073263
+ 
073263
  	if (attempt > 0 && patc == pat)
073263
  	    break;	/* there was no anchor, no need to try again */
073263
! 	regmatch.regprog = vim_regcomp(patc + attempt * 11, RE_MAGIC);
073263
! 	if (regmatch.regprog == NULL)
073263
  	{
073263
  	    if (patc != pat)
073263
  		vim_free(patc);
073263
***************
073263
*** 2397,2403 ****
073263
  	    {
073263
  		if (!buf->b_p_bl)	/* skip unlisted buffers */
073263
  		    continue;
073263
! 		p = buflist_match(prog, buf, p_wic);
073263
  		if (p != NULL)
073263
  		{
073263
  		    if (round == 1)
073263
--- 2399,2405 ----
073263
  	    {
073263
  		if (!buf->b_p_bl)	/* skip unlisted buffers */
073263
  		    continue;
073263
! 		p = buflist_match(&regmatch, buf, p_wic);
073263
  		if (p != NULL)
073263
  		{
073263
  		    if (round == 1)
073263
***************
073263
*** 2419,2432 ****
073263
  		*file = (char_u **)alloc((unsigned)(count * sizeof(char_u *)));
073263
  		if (*file == NULL)
073263
  		{
073263
! 		    vim_regfree(prog);
073263
  		    if (patc != pat)
073263
  			vim_free(patc);
073263
  		    return FAIL;
073263
  		}
073263
  	    }
073263
  	}
073263
! 	vim_regfree(prog);
073263
  	if (count)		/* match(es) found, break here */
073263
  	    break;
073263
      }
073263
--- 2421,2434 ----
073263
  		*file = (char_u **)alloc((unsigned)(count * sizeof(char_u *)));
073263
  		if (*file == NULL)
073263
  		{
073263
! 		    vim_regfree(regmatch.regprog);
073263
  		    if (patc != pat)
073263
  			vim_free(patc);
073263
  		    return FAIL;
073263
  		}
073263
  	    }
073263
  	}
073263
! 	vim_regfree(regmatch.regprog);
073263
  	if (count)		/* match(es) found, break here */
073263
  	    break;
073263
      }
073263
***************
073263
*** 2445,2461 ****
073263
   * Check for a match on the file name for buffer "buf" with regprog "prog".
073263
   */
073263
      static char_u *
073263
! buflist_match(prog, buf, ignore_case)
073263
!     regprog_T	*prog;
073263
      buf_T	*buf;
073263
      int		ignore_case;  /* when TRUE ignore case, when FALSE use 'fic' */
073263
  {
073263
      char_u	*match;
073263
  
073263
      /* First try the short file name, then the long file name. */
073263
!     match = fname_match(prog, buf->b_sfname, ignore_case);
073263
      if (match == NULL)
073263
! 	match = fname_match(prog, buf->b_ffname, ignore_case);
073263
  
073263
      return match;
073263
  }
073263
--- 2447,2463 ----
073263
   * Check for a match on the file name for buffer "buf" with regprog "prog".
073263
   */
073263
      static char_u *
073263
! buflist_match(rmp, buf, ignore_case)
073263
!     regmatch_T	*rmp;
073263
      buf_T	*buf;
073263
      int		ignore_case;  /* when TRUE ignore case, when FALSE use 'fic' */
073263
  {
073263
      char_u	*match;
073263
  
073263
      /* First try the short file name, then the long file name. */
073263
!     match = fname_match(rmp, buf->b_sfname, ignore_case);
073263
      if (match == NULL)
073263
! 	match = fname_match(rmp, buf->b_ffname, ignore_case);
073263
  
073263
      return match;
073263
  }
073263
***************
073263
*** 2465,2491 ****
073263
   * Return "name" when there is a match, NULL when not.
073263
   */
073263
      static char_u *
073263
! fname_match(prog, name, ignore_case)
073263
!     regprog_T	*prog;
073263
      char_u	*name;
073263
      int		ignore_case;  /* when TRUE ignore case, when FALSE use 'fic' */
073263
  {
073263
      char_u	*match = NULL;
073263
      char_u	*p;
073263
-     regmatch_T	regmatch;
073263
  
073263
      if (name != NULL)
073263
      {
073263
- 	regmatch.regprog = prog;
073263
  	/* Ignore case when 'fileignorecase' or the argument is set. */
073263
! 	regmatch.rm_ic = p_fic || ignore_case;
073263
! 	if (vim_regexec(&regmatch, name, (colnr_T)0))
073263
  	    match = name;
073263
  	else
073263
  	{
073263
  	    /* Replace $(HOME) with '~' and try matching again. */
073263
  	    p = home_replace_save(NULL, name);
073263
! 	    if (p != NULL && vim_regexec(&regmatch, p, (colnr_T)0))
073263
  		match = name;
073263
  	    vim_free(p);
073263
  	}
073263
--- 2467,2491 ----
073263
   * Return "name" when there is a match, NULL when not.
073263
   */
073263
      static char_u *
073263
! fname_match(rmp, name, ignore_case)
073263
!     regmatch_T	*rmp;
073263
      char_u	*name;
073263
      int		ignore_case;  /* when TRUE ignore case, when FALSE use 'fic' */
073263
  {
073263
      char_u	*match = NULL;
073263
      char_u	*p;
073263
  
073263
      if (name != NULL)
073263
      {
073263
  	/* Ignore case when 'fileignorecase' or the argument is set. */
073263
! 	rmp->rm_ic = p_fic || ignore_case;
073263
! 	if (vim_regexec(rmp, name, (colnr_T)0))
073263
  	    match = name;
073263
  	else
073263
  	{
073263
  	    /* Replace $(HOME) with '~' and try matching again. */
073263
  	    p = home_replace_save(NULL, name);
073263
! 	    if (p != NULL && vim_regexec(rmp, p, (colnr_T)0))
073263
  		match = name;
073263
  	    vim_free(p);
073263
  	}
073263
*** ../vim-7.4.518/src/regexp.c	2014-11-05 14:26:30.760758363 +0100
073263
--- src/regexp.c	2014-11-19 16:10:43.203390451 +0100
073263
***************
073263
*** 8163,8168 ****
073263
--- 8163,8169 ----
073263
  /*
073263
   * Match a regexp against a string.
073263
   * "rmp->regprog" is a compiled regexp as returned by vim_regcomp().
073263
+  * Note: "rmp->regprog" may be freed and changed.
073263
   * Uses curbuf for line count and 'iskeyword'.
073263
   * When "nl" is TRUE consider a "\n" in "line" to be a line break.
073263
   *
073263
***************
073263
*** 8203,8208 ****
073263
--- 8204,8232 ----
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
+     regprog_T	**prog;
073263
+     int		ignore_case;
073263
+     char_u	*line;
073263
+     colnr_T	col;
073263
+ {
073263
+     int r;
073263
+     regmatch_T regmatch;
073263
+ 
073263
+     regmatch.regprog = *prog;
073263
+     regmatch.rm_ic = ignore_case;
073263
+     r = vim_regexec_both(&regmatch, line, col, FALSE);
073263
+     *prog = regmatch.regprog;
073263
+     return r;
073263
+ }
073263
+ 
073263
+ /*
073263
+  * Note: "rmp->regprog" may be freed and changed.
073263
+  */
073263
      int
073263
  vim_regexec(rmp, line, col)
073263
      regmatch_T	*rmp;
073263
***************
073263
*** 8216,8221 ****
073263
--- 8240,8246 ----
073263
  	|| defined(FIND_REPLACE_DIALOG) || defined(PROTO)
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
   */
073263
      int
073263
  vim_regexec_nl(rmp, line, col)
073263
***************
073263
*** 8230,8235 ****
073263
--- 8255,8261 ----
073263
  /*
073263
   * Match a regexp against multiple lines.
073263
   * "rmp->regprog" is a compiled regexp as returned by vim_regcomp().
073263
+  * Note: "rmp->regprog" may be freed and changed.
073263
   * Uses curbuf for line count and 'iskeyword'.
073263
   *
073263
   * Return zero if there is no match.  Return number of lines contained in the
073263
*** ../vim-7.4.518/src/syntax.c	2014-06-12 12:20:50.191541385 +0200
073263
--- src/syntax.c	2014-11-19 15:39:08.493182536 +0100
073263
***************
073263
*** 992,1004 ****
073263
      linenr_T	lnum;
073263
  {
073263
      regmmatch_T regmatch;
073263
  
073263
      if (syn_block->b_syn_linecont_prog != NULL)
073263
      {
073263
  	regmatch.rmm_ic = syn_block->b_syn_linecont_ic;
073263
  	regmatch.regprog = syn_block->b_syn_linecont_prog;
073263
! 	return syn_regexec(&regmatch, lnum, (colnr_T)0,
073263
  				IF_SYN_TIME(&syn_block->b_syn_linecont_time));
073263
      }
073263
      return FALSE;
073263
  }
073263
--- 992,1007 ----
073263
      linenr_T	lnum;
073263
  {
073263
      regmmatch_T regmatch;
073263
+     int r;
073263
  
073263
      if (syn_block->b_syn_linecont_prog != NULL)
073263
      {
073263
  	regmatch.rmm_ic = syn_block->b_syn_linecont_ic;
073263
  	regmatch.regprog = syn_block->b_syn_linecont_prog;
073263
! 	r = syn_regexec(&regmatch, lnum, (colnr_T)0,
073263
  				IF_SYN_TIME(&syn_block->b_syn_linecont_time));
073263
+ 	syn_block->b_syn_linecont_prog = regmatch.regprog;
073263
+ 	return r;
073263
      }
073263
      return FALSE;
073263
  }
073263
***************
073263
*** 2075,2080 ****
073263
--- 2078,2085 ----
073263
  					    cur_si->si_cont_list, &spp->sp_syn,
073263
  					    spp->sp_flags & HL_CONTAINED))))
073263
  			{
073263
+ 			    int r;
073263
+ 
073263
  			    /* If we already tried matching in this line, and
073263
  			     * there isn't a match before next_match_col, skip
073263
  			     * this item. */
073263
***************
073263
*** 2089,2098 ****
073263
  
073263
  			    regmatch.rmm_ic = spp->sp_ic;
073263
  			    regmatch.regprog = spp->sp_prog;
073263
! 			    if (!syn_regexec(&regmatch,
073263
  					     current_lnum,
073263
  					     (colnr_T)lc_col,
073263
! 				             IF_SYN_TIME(&spp->sp_time)))
073263
  			    {
073263
  				/* no match in this line, try another one */
073263
  				spp->sp_startcol = MAXCOL;
073263
--- 2094,2105 ----
073263
  
073263
  			    regmatch.rmm_ic = spp->sp_ic;
073263
  			    regmatch.regprog = spp->sp_prog;
073263
! 			    r = syn_regexec(&regmatch,
073263
  					     current_lnum,
073263
  					     (colnr_T)lc_col,
073263
! 				             IF_SYN_TIME(&spp->sp_time));
073263
! 			    spp->sp_prog = regmatch.regprog;
073263
! 			    if (!r)
073263
  			    {
073263
  				/* no match in this line, try another one */
073263
  				spp->sp_startcol = MAXCOL;
073263
***************
073263
*** 2963,2968 ****
073263
--- 2970,2976 ----
073263
  	for (idx = start_idx; idx < syn_block->b_syn_patterns.ga_len; ++idx)
073263
  	{
073263
  	    int lc_col = matchcol;
073263
+ 	    int r;
073263
  
073263
  	    spp = &(SYN_ITEMS(syn_block)[idx]);
073263
  	    if (spp->sp_type != SPTYPE_END)	/* past last END pattern */
073263
***************
073263
*** 2973,2980 ****
073263
  
073263
  	    regmatch.rmm_ic = spp->sp_ic;
073263
  	    regmatch.regprog = spp->sp_prog;
073263
! 	    if (syn_regexec(&regmatch, startpos->lnum, lc_col,
073263
! 						  IF_SYN_TIME(&spp->sp_time)))
073263
  	    {
073263
  		if (best_idx == -1 || regmatch.startpos[0].col
073263
  					      < best_regmatch.startpos[0].col)
073263
--- 2981,2990 ----
073263
  
073263
  	    regmatch.rmm_ic = spp->sp_ic;
073263
  	    regmatch.regprog = spp->sp_prog;
073263
! 	    r = syn_regexec(&regmatch, startpos->lnum, lc_col,
073263
! 						  IF_SYN_TIME(&spp->sp_time));
073263
! 	    spp->sp_prog = regmatch.regprog;
073263
! 	    if (r)
073263
  	    {
073263
  		if (best_idx == -1 || regmatch.startpos[0].col
073263
  					      < best_regmatch.startpos[0].col)
073263
***************
073263
*** 3000,3013 ****
073263
  	if (spp_skip != NULL)
073263
  	{
073263
  	    int lc_col = matchcol - spp_skip->sp_offsets[SPO_LC_OFF];
073263
  
073263
  	    if (lc_col < 0)
073263
  		lc_col = 0;
073263
  	    regmatch.rmm_ic = spp_skip->sp_ic;
073263
  	    regmatch.regprog = spp_skip->sp_prog;
073263
! 	    if (syn_regexec(&regmatch, startpos->lnum, lc_col,
073263
! 					      IF_SYN_TIME(&spp_skip->sp_time))
073263
! 		    && regmatch.startpos[0].col
073263
  					     <= best_regmatch.startpos[0].col)
073263
  	    {
073263
  		/* Add offset to skip pattern match */
073263
--- 3010,3025 ----
073263
  	if (spp_skip != NULL)
073263
  	{
073263
  	    int lc_col = matchcol - spp_skip->sp_offsets[SPO_LC_OFF];
073263
+ 	    int r;
073263
  
073263
  	    if (lc_col < 0)
073263
  		lc_col = 0;
073263
  	    regmatch.rmm_ic = spp_skip->sp_ic;
073263
  	    regmatch.regprog = spp_skip->sp_prog;
073263
! 	    r = syn_regexec(&regmatch, startpos->lnum, lc_col,
073263
! 					      IF_SYN_TIME(&spp_skip->sp_time));
073263
! 	    spp_skip->sp_prog = regmatch.regprog;
073263
! 	    if (r && regmatch.startpos[0].col
073263
  					     <= best_regmatch.startpos[0].col)
073263
  	    {
073263
  		/* Add offset to skip pattern match */
073263
*** ../vim-7.4.518/src/spell.c	2014-09-19 16:04:08.050417797 +0200
073263
--- src/spell.c	2014-11-19 16:28:49.798964748 +0100
073263
***************
073263
*** 1154,1164 ****
073263
  	    if (capcol != NULL && wp->w_s->b_cap_prog != NULL)
073263
  	    {
073263
  		regmatch_T	regmatch;
073263
  
073263
  		/* Check for end of sentence. */
073263
  		regmatch.regprog = wp->w_s->b_cap_prog;
073263
  		regmatch.rm_ic = FALSE;
073263
! 		if (vim_regexec(&regmatch, ptr, 0))
073263
  		    *capcol = (int)(regmatch.endp[0] - ptr);
073263
  	    }
073263
  
073263
--- 1154,1167 ----
073263
  	    if (capcol != NULL && wp->w_s->b_cap_prog != NULL)
073263
  	    {
073263
  		regmatch_T	regmatch;
073263
+ 		int		r;
073263
  
073263
  		/* Check for end of sentence. */
073263
  		regmatch.regprog = wp->w_s->b_cap_prog;
073263
  		regmatch.rm_ic = FALSE;
073263
! 		r = vim_regexec(&regmatch, ptr, 0);
073263
! 		wp->w_s->b_cap_prog = regmatch.regprog;
073263
! 		if (r)
073263
  		    *capcol = (int)(regmatch.endp[0] - ptr);
073263
  	    }
073263
  
073263
***************
073263
*** 1786,1792 ****
073263
      char_u	*word;
073263
      char_u	*flags;
073263
  {
073263
-     regmatch_T	regmatch;
073263
  #ifdef FEAT_MBYTE
073263
      char_u	uflags[MAXWLEN * 2];
073263
      int		i;
073263
--- 1789,1794 ----
073263
***************
073263
*** 1808,1816 ****
073263
      else
073263
  #endif
073263
  	p = flags;
073263
!     regmatch.regprog = slang->sl_compprog;
073263
!     regmatch.rm_ic = FALSE;
073263
!     if (!vim_regexec(&regmatch, p, 0))
073263
  	return FALSE;
073263
  
073263
      /* Count the number of syllables.  This may be slow, do it last.  If there
073263
--- 1810,1816 ----
073263
      else
073263
  #endif
073263
  	p = flags;
073263
!     if (!vim_regexec_prog(&slang->sl_compprog, FALSE, p, 0))
073263
  	return FALSE;
073263
  
073263
      /* Count the number of syllables.  This may be slow, do it last.  If there
073263
***************
073263
*** 1930,1937 ****
073263
  {
073263
      int		prefcnt;
073263
      int		pidx;
073263
!     regprog_T	*rp;
073263
!     regmatch_T	regmatch;
073263
      int		prefid;
073263
  
073263
      prefid = (unsigned)flags >> 24;
073263
--- 1930,1936 ----
073263
  {
073263
      int		prefcnt;
073263
      int		pidx;
073263
!     regprog_T	**rp;
073263
      int		prefid;
073263
  
073263
      prefid = (unsigned)flags >> 24;
073263
***************
073263
*** 1950,1961 ****
073263
  
073263
  	/* Check the condition, if there is one.  The condition index is
073263
  	 * stored in the two bytes above the prefix ID byte.  */
073263
! 	rp = slang->sl_prefprog[((unsigned)pidx >> 8) & 0xffff];
073263
! 	if (rp != NULL)
073263
  	{
073263
! 	    regmatch.regprog = rp;
073263
! 	    regmatch.rm_ic = FALSE;
073263
! 	    if (!vim_regexec(&regmatch, word, 0))
073263
  		continue;
073263
  	}
073263
  	else if (cond_req)
073263
--- 1949,1958 ----
073263
  
073263
  	/* Check the condition, if there is one.  The condition index is
073263
  	 * stored in the two bytes above the prefix ID byte.  */
073263
! 	rp = &slang->sl_prefprog[((unsigned)pidx >> 8) & 0xffff];
073263
! 	if (*rp != NULL)
073263
  	{
073263
! 	    if (!vim_regexec_prog(rp, FALSE, word, 0))
073263
  		continue;
073263
  	}
073263
  	else if (cond_req)
073263
***************
073263
*** 6903,6909 ****
073263
      hashitem_T	*hi;
073263
      affheader_T	*ah;
073263
      affentry_T	*ae;
073263
-     regmatch_T	regmatch;
073263
      char_u	newword[MAXWLEN];
073263
      int		retval = OK;
073263
      int		i, j;
073263
--- 6900,6905 ----
073263
***************
073263
*** 6944,6958 ****
073263
  		     * When a previously added affix had CIRCUMFIX this one
073263
  		     * must have it too, if it had not then this one must not
073263
  		     * have one either. */
073263
- 		    regmatch.regprog = ae->ae_prog;
073263
- 		    regmatch.rm_ic = FALSE;
073263
  		    if ((xht != NULL || !affile->af_pfxpostpone
073263
  				|| ae->ae_chop != NULL
073263
  				|| ae->ae_flags != NULL)
073263
  			    && (ae->ae_chop == NULL
073263
  				|| STRLEN(ae->ae_chop) < wordlen)
073263
  			    && (ae->ae_prog == NULL
073263
! 				|| vim_regexec(&regmatch, word, (colnr_T)0))
073263
  			    && (((condit & CONDIT_CFIX) == 0)
073263
  				== ((condit & CONDIT_AFF) == 0
073263
  				    || ae->ae_flags == NULL
073263
--- 6940,6953 ----
073263
  		     * When a previously added affix had CIRCUMFIX this one
073263
  		     * must have it too, if it had not then this one must not
073263
  		     * have one either. */
073263
  		    if ((xht != NULL || !affile->af_pfxpostpone
073263
  				|| ae->ae_chop != NULL
073263
  				|| ae->ae_flags != NULL)
073263
  			    && (ae->ae_chop == NULL
073263
  				|| STRLEN(ae->ae_chop) < wordlen)
073263
  			    && (ae->ae_prog == NULL
073263
! 				|| vim_regexec_prog(&ae->ae_prog, FALSE,
073263
! 							    word, (colnr_T)0))
073263
  			    && (((condit & CONDIT_CFIX) == 0)
073263
  				== ((condit & CONDIT_AFF) == 0
073263
  				    || ae->ae_flags == NULL
073263
***************
073263
*** 10478,10483 ****
073263
--- 10473,10479 ----
073263
  		break;
073263
  	    }
073263
  	}
073263
+ 	curwin->w_s->b_cap_prog = regmatch.regprog;
073263
      }
073263
  
073263
      vim_free(line_copy);
073263
*** ../vim-7.4.518/src/ex_cmds2.c	2014-08-06 18:17:03.471147780 +0200
073263
--- src/ex_cmds2.c	2014-11-19 16:24:22.162013396 +0100
073263
***************
073263
*** 739,745 ****
073263
      struct debuggy *bp;
073263
      int		i;
073263
      linenr_T	lnum = 0;
073263
-     regmatch_T	regmatch;
073263
      char_u	*name = fname;
073263
      int		prev_got_int;
073263
  
073263
--- 739,744 ----
073263
***************
073263
*** 771,778 ****
073263
  #endif
073263
  		(bp->dbg_lnum > after && (lnum == 0 || bp->dbg_lnum < lnum)))))
073263
  	{
073263
- 	    regmatch.regprog = bp->dbg_prog;
073263
- 	    regmatch.rm_ic = FALSE;
073263
  	    /*
073263
  	     * Save the value of got_int and reset it.  We don't want a
073263
  	     * previous interruption cancel matching, only hitting CTRL-C
073263
--- 770,775 ----
073263
***************
073263
*** 780,786 ****
073263
  	     */
073263
  	    prev_got_int = got_int;
073263
  	    got_int = FALSE;
073263
! 	    if (vim_regexec(&regmatch, name, (colnr_T)0))
073263
  	    {
073263
  		lnum = bp->dbg_lnum;
073263
  		if (fp != NULL)
073263
--- 777,783 ----
073263
  	     */
073263
  	    prev_got_int = got_int;
073263
  	    got_int = FALSE;
073263
! 	    if (vim_regexec_prog(&bp->dbg_prog, FALSE, name, (colnr_T)0))
073263
  	    {
073263
  		lnum = bp->dbg_lnum;
073263
  		if (fp != NULL)
073263
*** ../vim-7.4.518/src/fileio.c	2014-11-12 15:15:34.983882077 +0100
073263
--- src/fileio.c	2014-11-19 15:57:01.496837984 +0100
073263
***************
073263
*** 7772,7777 ****
073263
--- 7772,7780 ----
073263
  static int do_autocmd_event __ARGS((event_T event, char_u *pat, int nested, char_u *cmd, int forceit, int group));
073263
  static int apply_autocmds_group __ARGS((event_T event, char_u *fname, char_u *fname_io, int force, int group, buf_T *buf, exarg_T *eap));
073263
  static void auto_next_pat __ARGS((AutoPatCmd *apc, int stop_at_last));
073263
+ #if defined(FEAT_AUTOCMD) || defined(FEAT_WILDIGN)
073263
+ static int match_file_pat __ARGS((char_u *pattern, regprog_T **prog, char_u *fname, char_u *sfname, char_u *tail, int allow_dirs));
073263
+ #endif
073263
  
073263
  
073263
  static event_T	last_event;
073263
***************
073263
*** 9640,9646 ****
073263
  	{
073263
  	    /* execution-condition */
073263
  	    if (ap->buflocal_nr == 0
073263
! 		    ? (match_file_pat(NULL, ap->reg_prog, apc->fname,
073263
  				      apc->sfname, apc->tail, ap->allow_dirs))
073263
  		    : ap->buflocal_nr == apc->arg_bufnr)
073263
  	    {
073263
--- 9643,9649 ----
073263
  	{
073263
  	    /* execution-condition */
073263
  	    if (ap->buflocal_nr == 0
073263
! 		    ? (match_file_pat(NULL, &ap->reg_prog, apc->fname,
073263
  				      apc->sfname, apc->tail, ap->allow_dirs))
073263
  		    : ap->buflocal_nr == apc->arg_bufnr)
073263
  	    {
073263
***************
073263
*** 9774,9780 ****
073263
      for (ap = first_autopat[(int)event]; ap != NULL; ap = ap->next)
073263
  	if (ap->pat != NULL && ap->cmds != NULL
073263
  	      && (ap->buflocal_nr == 0
073263
! 		? match_file_pat(NULL, ap->reg_prog,
073263
  					  fname, sfname, tail, ap->allow_dirs)
073263
  		: buf != NULL && ap->buflocal_nr == buf->b_fnum
073263
  	   ))
073263
--- 9777,9783 ----
073263
      for (ap = first_autopat[(int)event]; ap != NULL; ap = ap->next)
073263
  	if (ap->pat != NULL && ap->cmds != NULL
073263
  	      && (ap->buflocal_nr == 0
073263
! 		? match_file_pat(NULL, &ap->reg_prog,
073263
  					  fname, sfname, tail, ap->allow_dirs)
073263
  		: buf != NULL && ap->buflocal_nr == buf->b_fnum
073263
  	   ))
073263
***************
073263
*** 10035,10044 ****
073263
   * Used for autocommands and 'wildignore'.
073263
   * Returns TRUE if there is a match, FALSE otherwise.
073263
   */
073263
!     int
073263
  match_file_pat(pattern, prog, fname, sfname, tail, allow_dirs)
073263
      char_u	*pattern;		/* pattern to match with */
073263
!     regprog_T	*prog;			/* pre-compiled regprog or NULL */
073263
      char_u	*fname;			/* full path of file name */
073263
      char_u	*sfname;		/* short file name or NULL */
073263
      char_u	*tail;			/* tail of path */
073263
--- 10038,10047 ----
073263
   * Used for autocommands and 'wildignore'.
073263
   * Returns TRUE if there is a match, FALSE otherwise.
073263
   */
073263
!     static int
073263
  match_file_pat(pattern, prog, fname, sfname, tail, allow_dirs)
073263
      char_u	*pattern;		/* pattern to match with */
073263
!     regprog_T	**prog;			/* pre-compiled regprog or NULL */
073263
      char_u	*fname;			/* full path of file name */
073263
      char_u	*sfname;		/* short file name or NULL */
073263
      char_u	*tail;			/* tail of path */
073263
***************
073263
*** 10093,10099 ****
073263
  #endif
073263
      {
073263
  	if (prog != NULL)
073263
! 	    regmatch.regprog = prog;
073263
  	else
073263
  	    regmatch.regprog = vim_regcomp(pattern, RE_MAGIC);
073263
      }
073263
--- 10096,10102 ----
073263
  #endif
073263
      {
073263
  	if (prog != NULL)
073263
! 	    regmatch.regprog = *prog;
073263
  	else
073263
  	    regmatch.regprog = vim_regcomp(pattern, RE_MAGIC);
073263
      }
073263
***************
073263
*** 10119,10125 ****
073263
  		 || (!allow_dirs && vim_regexec(&regmatch, tail, (colnr_T)0)))))
073263
  	result = TRUE;
073263
  
073263
!     if (prog == NULL)
073263
  	vim_regfree(regmatch.regprog);
073263
      return result;
073263
  }
073263
--- 10122,10130 ----
073263
  		 || (!allow_dirs && vim_regexec(&regmatch, tail, (colnr_T)0)))))
073263
  	result = TRUE;
073263
  
073263
!     if (prog != NULL)
073263
! 	*prog = regmatch.regprog;
073263
!     else
073263
  	vim_regfree(regmatch.regprog);
073263
      return result;
073263
  }
073263
*** ../vim-7.4.518/src/proto/fileio.pro	2014-08-22 23:05:50.106606614 +0200
073263
--- src/proto/fileio.pro	2014-11-19 15:55:55.013602515 +0100
073263
***************
073263
*** 59,65 ****
073263
  char_u *get_event_name __ARGS((expand_T *xp, int idx));
073263
  int autocmd_supported __ARGS((char_u *name));
073263
  int au_exists __ARGS((char_u *arg));
073263
- int match_file_pat __ARGS((char_u *pattern, regprog_T *prog, char_u *fname, char_u *sfname, char_u *tail, int allow_dirs));
073263
  int match_file_list __ARGS((char_u *list, char_u *sfname, char_u *ffname));
073263
  char_u *file_pat_to_reg_pat __ARGS((char_u *pat, char_u *pat_end, char *allow_dirs, int no_bslash));
073263
  long read_eintr __ARGS((int fd, void *buf, size_t bufsize));
073263
--- 59,64 ----
073263
*** ../vim-7.4.518/src/proto/regexp.pro	2014-04-02 19:00:53.043644100 +0200
073263
--- src/proto/regexp.pro	2014-11-19 16:11:34.522800480 +0100
073263
***************
073263
*** 13,18 ****
073263
--- 13,19 ----
073263
  list_T *reg_submatch_list __ARGS((int no));
073263
  regprog_T *vim_regcomp __ARGS((char_u *expr_arg, int re_flags));
073263
  void vim_regfree __ARGS((regprog_T *prog));
073263
+ int vim_regexec_prog __ARGS((regprog_T **prog, int ignore_case, char_u *line, colnr_T col));
073263
  int vim_regexec __ARGS((regmatch_T *rmp, char_u *line, colnr_T col));
073263
  int vim_regexec_nl __ARGS((regmatch_T *rmp, char_u *line, colnr_T col));
073263
  long vim_regexec_multi __ARGS((regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col, proftime_T *tm));
073263
*** ../vim-7.4.518/src/os_unix.c	2014-10-11 14:47:22.829275547 +0200
073263
--- src/os_unix.c	2014-11-19 16:26:48.504346537 +0100
073263
***************
073263
*** 1610,1617 ****
073263
      static int
073263
  x_connect_to_server()
073263
  {
073263
-     regmatch_T	regmatch;
073263
- 
073263
  #if defined(FEAT_CLIENTSERVER)
073263
      if (x_force_connect)
073263
  	return TRUE;
073263
--- 1610,1615 ----
073263
***************
073263
*** 1622,1630 ****
073263
      /* Check for a match with "exclude:" from 'clipboard'. */
073263
      if (clip_exclude_prog != NULL)
073263
      {
073263
! 	regmatch.rm_ic = FALSE;		/* Don't ignore case */
073263
! 	regmatch.regprog = clip_exclude_prog;
073263
! 	if (vim_regexec(&regmatch, T_NAME, (colnr_T)0))
073263
  	    return FALSE;
073263
      }
073263
      return TRUE;
073263
--- 1620,1626 ----
073263
      /* Check for a match with "exclude:" from 'clipboard'. */
073263
      if (clip_exclude_prog != NULL)
073263
      {
073263
! 	if (vim_regexec_prog(&clip_exclude_prog, FALSE, T_NAME, (colnr_T)0))
073263
  	    return FALSE;
073263
      }
073263
      return TRUE;
073263
*** ../vim-7.4.518/src/version.c	2014-11-19 13:40:04.903715962 +0100
073263
--- src/version.c	2014-11-19 15:22:36.464620036 +0100
073263
***************
073263
*** 743,744 ****
073263
--- 743,746 ----
073263
  {   /* Add new patch number below this line */
073263
+ /**/
073263
+     519,
073263
  /**/
073263
073263
-- 
073263
BRIDGEKEEPER: What is your favorite editor?
073263
GAWAIN:       Emacs ...  No, Viiiiiiiiiiimmmmmmm!
073263
           "Monty Python and the Holy editor wars" PYTHON (MONTY) SOFTWARE LTD
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    ///