home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.3 / 7.3.1149 < prev    next >
Encoding:
Internet Message Format  |  2013-06-07  |  40.3 KB

  1. To: vim_dev@googlegroups.com
  2. Subject: Patch 7.3.1149
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.3.1149
  11. Problem:    New regexp engine: Matching plain text could be faster.
  12. Solution:   Detect a plain text match and handle it specifically.  Add
  13.         vim_regfree().
  14. Files:        src/regexp.c, src/regexp.h, src/regexp_nfa.c,
  15.         src/proto/regexp.pro, src/buffer.c, src/edit.c, src/eval.c,
  16.         src/ex_cmds.c, src/ex_cmds2.c, src/ex_docmd.c, src/ex_eval.c,
  17.         src/ex_getln.c, src/fileio.c, src/gui.c, src/misc1.c, src/misc2.c,
  18.         src/option.c, src/syntax.c, src/quickfix.c, src/search.c,
  19.         src/spell.c, src/tag.c, src/window.c, src/screen.c, src/macros.h,
  20.         src/testdir/test64.in, src/testdir/test64.ok
  21.  
  22.  
  23. *** ../vim-7.3.1148/src/regexp.c    2013-06-06 18:04:47.000000000 +0200
  24. --- src/regexp.c    2013-06-08 17:13:06.000000000 +0200
  25. ***************
  26. *** 1297,1303 ****
  27.       return p;
  28.   }
  29.   
  30. ! static regprog_T    *bt_regcomp __ARGS((char_u *expr, int re_flags));
  31.   
  32.   /*
  33.    * bt_regcomp() - compile a regular expression into internal code for the
  34. --- 1297,1304 ----
  35.       return p;
  36.   }
  37.   
  38. ! static regprog_T  *bt_regcomp __ARGS((char_u *expr, int re_flags));
  39. ! static void bt_regfree __ARGS((regprog_T *prog));
  40.   
  41.   /*
  42.    * bt_regcomp() - compile a regular expression into internal code for the
  43. ***************
  44. *** 1455,1460 ****
  45. --- 1456,1471 ----
  46.   }
  47.   
  48.   /*
  49. +  * Free a compiled regexp program, returned by bt_regcomp().
  50. +  */
  51. +     static void
  52. + bt_regfree(prog)
  53. +     regprog_T   *prog;
  54. + {
  55. +     vim_free(prog);
  56. + }
  57. + /*
  58.    * Setup to parse the regexp.  Used once to get the length and once to do it.
  59.    */
  60.       static void
  61. ***************
  62. *** 7876,7881 ****
  63. --- 7887,7893 ----
  64.   static regengine_T bt_regengine =
  65.   {
  66.       bt_regcomp,
  67. +     bt_regfree,
  68.       bt_regexec,
  69.   #if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \
  70.       || defined(FIND_REPLACE_DIALOG) || defined(PROTO)
  71. ***************
  72. *** 7893,7898 ****
  73. --- 7905,7911 ----
  74.   static regengine_T nfa_regengine =
  75.   {
  76.       nfa_regcomp,
  77. +     nfa_regfree,
  78.       nfa_regexec,
  79.   #if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \
  80.       || defined(FIND_REPLACE_DIALOG) || defined(PROTO)
  81. ***************
  82. *** 7920,7926 ****
  83.   
  84.   /*
  85.    * Compile a regular expression into internal code.
  86. !  * Returns the program in allocated memory.  Returns NULL for an error.
  87.    */
  88.       regprog_T *
  89.   vim_regcomp(expr_arg, re_flags)
  90. --- 7933,7941 ----
  91.   
  92.   /*
  93.    * Compile a regular expression into internal code.
  94. !  * Returns the program in allocated memory.
  95. !  * Use vim_regfree() to free the memory.
  96. !  * Returns NULL for an error.
  97.    */
  98.       regprog_T *
  99.   vim_regcomp(expr_arg, re_flags)
  100. ***************
  101. *** 7997,8002 ****
  102. --- 8012,8028 ----
  103.   }
  104.   
  105.   /*
  106. +  * Free a compiled regexp program, returned by vim_regcomp().
  107. +  */
  108. +     void
  109. + vim_regfree(prog)
  110. +     regprog_T   *prog;
  111. + {
  112. +     if (prog != NULL)
  113. +     prog->engine->regfree(prog);
  114. + }
  115. + /*
  116.    * Match a regexp against a string.
  117.    * "rmp->regprog" is a compiled regexp as returned by vim_regcomp().
  118.    * Uses curbuf for line count and 'iskeyword'.
  119. *** ../vim-7.3.1148/src/regexp.h    2013-06-07 16:31:45.000000000 +0200
  120. --- src/regexp.h    2013-06-08 15:43:33.000000000 +0200
  121. ***************
  122. *** 89,94 ****
  123. --- 89,95 ----
  124.   
  125.       int            reganch;    /* pattern starts with ^ */
  126.       int            regstart;    /* char at start of pattern */
  127. +     char_u        *match_text;    /* plain text to match with */
  128.   
  129.       int            has_zend;    /* pattern contains \ze */
  130.       int            has_backref;    /* pattern contains \1 .. \9 */
  131. ***************
  132. *** 147,152 ****
  133. --- 148,154 ----
  134.   struct regengine
  135.   {
  136.       regprog_T    *(*regcomp)(char_u*, int);
  137. +     void    (*regfree)(regprog_T *);
  138.       int        (*regexec)(regmatch_T*, char_u*, colnr_T);
  139.   #if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \
  140.       || defined(FIND_REPLACE_DIALOG) || defined(PROTO)
  141. *** ../vim-7.3.1148/src/regexp_nfa.c    2013-06-08 14:38:23.000000000 +0200
  142. --- src/regexp_nfa.c    2013-06-08 18:04:40.000000000 +0200
  143. ***************
  144. *** 270,275 ****
  145. --- 270,276 ----
  146.   static int nfa_regcomp_start __ARGS((char_u *expr, int re_flags));
  147.   static int nfa_get_reganch __ARGS((nfa_state_T *start, int depth));
  148.   static int nfa_get_regstart __ARGS((nfa_state_T *start, int depth));
  149. + static char_u *nfa_get_match_text __ARGS((nfa_state_T *start));
  150.   static int nfa_recognize_char_class __ARGS((char_u *start, char_u *end, int extra_newl));
  151.   static int nfa_emit_equi_class __ARGS((int c));
  152.   static int nfa_regatom __ARGS((void));
  153. ***************
  154. *** 295,300 ****
  155. --- 296,302 ----
  156.   static long nfa_regtry __ARGS((nfa_regprog_T *prog, colnr_T col));
  157.   static long nfa_regexec_both __ARGS((char_u *line, colnr_T col));
  158.   static regprog_T *nfa_regcomp __ARGS((char_u *expr, int re_flags));
  159. + static void nfa_regfree __ARGS((regprog_T *prog));
  160.   static int nfa_regexec __ARGS((regmatch_T *rmp, char_u *line, colnr_T col));
  161.   static long nfa_regexec_multi __ARGS((regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col, proftime_T *tm));
  162.   
  163. ***************
  164. *** 493,498 ****
  165. --- 495,546 ----
  166.   }
  167.   
  168.   /*
  169. +  * Figure out if the NFA state list contains just literal text and nothing
  170. +  * else.  If so return a string with what must match after regstart.
  171. +  * Otherwise return NULL.
  172. +  */
  173. +     static char_u *
  174. + nfa_get_match_text(start)
  175. +     nfa_state_T *start;
  176. + {
  177. +     nfa_state_T *p = start;
  178. +     int        len = 0;
  179. +     char_u    *ret;
  180. +     char_u    *s;
  181. +     if (p->c != NFA_MOPEN)
  182. +     return NULL; /* just in case */
  183. +     p = p->out;
  184. +     while (p->c > 0)
  185. +     {
  186. +     len += MB_CHAR2LEN(p->c);
  187. +     p = p->out;
  188. +     }
  189. +     if (p->c != NFA_MCLOSE || p->out->c != NFA_MATCH)
  190. +     return NULL;
  191. +     ret = alloc(len);
  192. +     if (ret != NULL)
  193. +     {
  194. +     len = 0;
  195. +     p = start->out->out; /* skip first char, it goes into regstart */
  196. +     s = ret;
  197. +     while (p->c > 0)
  198. +     {
  199. + #ifdef FEAT_MBYTE
  200. +         if (has_mbyte)
  201. +         s += (*mb_char2bytes)(p->c, s);
  202. +         else
  203. + #endif
  204. +         *s++ = p->c;
  205. +         p = p->out;
  206. +     }
  207. +     *s = NUL;
  208. +     }
  209. +     return ret;
  210. + }
  211. + /*
  212.    * Allocate more space for post_start.  Called when
  213.    * running above the estimated number of states.
  214.    */
  215. ***************
  216. *** 2280,2287 ****
  217.       {
  218.       nfa_print_state(debugf, prog->start);
  219.   
  220. !     fprintf(debugf, "reganch: %d\n", prog->reganch);
  221. !     fprintf(debugf, "regstart: %d\n", prog->regstart);
  222.   
  223.       fclose(debugf);
  224.       }
  225. --- 2328,2340 ----
  226.       {
  227.       nfa_print_state(debugf, prog->start);
  228.   
  229. !     if (prog->reganch)
  230. !         fprintf(debugf, "reganch: %d\n", prog->reganch);
  231. !     if (prog->regstart != NUL)
  232. !         fprintf(debugf, "regstart: %c (decimal: %d)\n",
  233. !                           prog->regstart, prog->regstart);
  234. !     if (prog->match_text != NULL)
  235. !         fprintf(debugf, "match_text: \"%s\"\n", prog->match_text);
  236.   
  237.       fclose(debugf);
  238.       }
  239. ***************
  240. *** 4154,4159 ****
  241. --- 4207,4213 ----
  242.   
  243.   static int failure_chance __ARGS((nfa_state_T *state, int depth));
  244.   static int skip_to_start __ARGS((int c, colnr_T *colp));
  245. + static long find_match_text __ARGS((colnr_T startcol, int regstart, char_u *match_text));
  246.   
  247.   /*
  248.    * Estimate the chance of a match with "state" failing.
  249. ***************
  250. *** 4331,4336 ****
  251. --- 4385,4453 ----
  252.   }
  253.   
  254.   /*
  255. +  * Check for a match with match_text.
  256. +  * Called after skip_to_start() has find regstart.
  257. +  * Returns zero for no match, 1 for a match.
  258. +  */
  259. +     static long
  260. + find_match_text(startcol, regstart, match_text)
  261. +     colnr_T startcol;
  262. +     int        regstart;
  263. +     char_u  *match_text;
  264. + {
  265. +     colnr_T col = startcol;
  266. +     int        c1, c2;
  267. +     int        len1, len2;
  268. +     int        match;
  269. +     for (;;)
  270. +     {
  271. +     match = TRUE;
  272. +     len2 = MB_CHAR2LEN(regstart); /* skip regstart */
  273. +     for (len1 = 0; match_text[len1] != NUL; len1 += MB_CHAR2LEN(c1))
  274. +     {
  275. +         c1 = PTR2CHAR(match_text + len1);
  276. +         c2 = PTR2CHAR(regline + col + len2);
  277. +         if (c1 != c2 && (!ireg_ic || MB_TOLOWER(c1) != MB_TOLOWER(c2)))
  278. +         {
  279. +         match = FALSE;
  280. +         break;
  281. +         }
  282. +         len2 += MB_CHAR2LEN(c2);
  283. +     }
  284. +     if (match
  285. + #ifdef FEAT_MBYTE
  286. +         /* check that no composing char follows */
  287. +         && !(enc_utf8
  288. +                && utf_iscomposing(PTR2CHAR(regline + col + len2)))
  289. + #endif
  290. +         )
  291. +     {
  292. +         cleanup_subexpr();
  293. +         if (REG_MULTI)
  294. +         {
  295. +         reg_startpos[0].lnum = reglnum;
  296. +         reg_startpos[0].col = col;
  297. +         reg_endpos[0].lnum = reglnum;
  298. +         reg_endpos[0].col = col + len2;
  299. +         }
  300. +         else
  301. +         {
  302. +         reg_startp[0] = regline + col;
  303. +         reg_endp[0] = regline + col + len2;
  304. +         }
  305. +         return 1L;
  306. +     }
  307. +     /* Try finding regstart after the current match. */
  308. +     col += MB_CHAR2LEN(regstart); /* skip regstart */
  309. +     if (skip_to_start(regstart, &col) == FAIL)
  310. +         break;
  311. +     }
  312. +     return 0L;
  313. + }
  314. + /*
  315.    * Main matching routine.
  316.    *
  317.    * Run NFA to determine whether it matches reginput.
  318. ***************
  319. *** 5584,5600 ****
  320.   #endif
  321.   
  322.       reginput = regline + col;
  323. -     need_clear_subexpr = TRUE;
  324. - #ifdef FEAT_SYN_HL
  325. -     /* Clear the external match subpointers if necessary. */
  326. -     if (prog->reghasz == REX_SET)
  327. -     {
  328. -     nfa_has_zsubexpr = TRUE;
  329. -     need_clear_zsubexpr = TRUE;
  330. -     }
  331. -     else
  332. -     nfa_has_zsubexpr = FALSE;
  333. - #endif
  334.   
  335.   #ifdef ENABLE_LOG
  336.       f = fopen(NFA_REGEXP_RUN_LOG, "a");
  337. --- 5701,5706 ----
  338. ***************
  339. *** 5764,5775 ****
  340. --- 5870,5900 ----
  341.       if (prog->reganch && col > 0)
  342.       return 0L;
  343.   
  344. +     need_clear_subexpr = TRUE;
  345. + #ifdef FEAT_SYN_HL
  346. +     /* Clear the external match subpointers if necessary. */
  347. +     if (prog->reghasz == REX_SET)
  348. +     {
  349. +     nfa_has_zsubexpr = TRUE;
  350. +     need_clear_zsubexpr = TRUE;
  351. +     }
  352. +     else
  353. +     nfa_has_zsubexpr = FALSE;
  354. + #endif
  355.       if (prog->regstart != NUL)
  356. +     {
  357.       /* Skip ahead until a character we know the match must start with.
  358.        * When there is none there is no match. */
  359.       if (skip_to_start(prog->regstart, &col) == FAIL)
  360.           return 0L;
  361.   
  362. +     /* If match_text is set it contains the full text that must match.
  363. +      * Nothing else to try. Doesn't handle combining chars well. */
  364. +     if (prog->match_text != NULL && !ireg_icombine)
  365. +         return find_match_text(col, prog->regstart, prog->match_text);
  366. +     }
  367.       /* If the start column is past the maximum column: no need to try. */
  368.       if (ireg_maxcol > 0 && col >= ireg_maxcol)
  369.       goto theend;
  370. ***************
  371. *** 5876,5881 ****
  372. --- 6001,6008 ----
  373.       prog->reganch = nfa_get_reganch(prog->start, 0);
  374.       prog->regstart = nfa_get_regstart(prog->start, 0);
  375.   
  376. +     prog->match_text = nfa_get_match_text(prog->start);
  377.   #ifdef ENABLE_LOG
  378.       nfa_postfix_dump(expr, OK);
  379.       nfa_dump(prog);
  380. ***************
  381. *** 5885,5891 ****
  382.       prog->reghasz = re_has_z;
  383.   #endif
  384.   #ifdef DEBUG
  385. !     prog->pattern = vim_strsave(expr); /* memory will leak */
  386.       nfa_regengine.expr = NULL;
  387.   #endif
  388.   
  389. --- 6012,6018 ----
  390.       prog->reghasz = re_has_z;
  391.   #endif
  392.   #ifdef DEBUG
  393. !     prog->pattern = vim_strsave(expr);
  394.       nfa_regengine.expr = NULL;
  395.   #endif
  396.   
  397. ***************
  398. *** 5907,5912 ****
  399. --- 6034,6055 ----
  400.       goto out;
  401.   }
  402.   
  403. + /*
  404. +  * Free a compiled regexp program, returned by nfa_regcomp().
  405. +  */
  406. +     static void
  407. + nfa_regfree(prog)
  408. +     regprog_T   *prog;
  409. + {
  410. +     if (prog != NULL)
  411. +     {
  412. +     vim_free(((nfa_regprog_T *)prog)->match_text);
  413. + #ifdef DEBUG
  414. +     vim_free(((nfa_regprog_T *)prog)->pattern);
  415. + #endif
  416. +     vim_free(prog);
  417. +     }
  418. + }
  419.   
  420.   /*
  421.    * Match a regexp against a string.
  422. *** ../vim-7.3.1148/src/proto/regexp.pro    2010-08-15 21:57:28.000000000 +0200
  423. --- src/proto/regexp.pro    2013-06-08 15:41:49.000000000 +0200
  424. ***************
  425. *** 2,17 ****
  426.   int re_multiline __ARGS((regprog_T *prog));
  427.   int re_lookbehind __ARGS((regprog_T *prog));
  428.   char_u *skip_regexp __ARGS((char_u *startp, int dirc, int magic, char_u **newp));
  429. - regprog_T *vim_regcomp __ARGS((char_u *expr, int re_flags));
  430.   int vim_regcomp_had_eol __ARGS((void));
  431.   void free_regexp_stuff __ARGS((void));
  432. - int vim_regexec __ARGS((regmatch_T *rmp, char_u *line, colnr_T col));
  433. - int vim_regexec_nl __ARGS((regmatch_T *rmp, char_u *line, colnr_T col));
  434. - long vim_regexec_multi __ARGS((regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col, proftime_T *tm));
  435.   reg_extmatch_T *ref_extmatch __ARGS((reg_extmatch_T *em));
  436.   void unref_extmatch __ARGS((reg_extmatch_T *em));
  437.   char_u *regtilde __ARGS((char_u *source, int magic));
  438.   int vim_regsub __ARGS((regmatch_T *rmp, char_u *source, char_u *dest, int copy, int magic, int backslash));
  439.   int vim_regsub_multi __ARGS((regmmatch_T *rmp, linenr_T lnum, char_u *source, char_u *dest, int copy, int magic, int backslash));
  440.   char_u *reg_submatch __ARGS((int no));
  441.   /* vim: set ft=c : */
  442. --- 2,18 ----
  443.   int re_multiline __ARGS((regprog_T *prog));
  444.   int re_lookbehind __ARGS((regprog_T *prog));
  445.   char_u *skip_regexp __ARGS((char_u *startp, int dirc, int magic, char_u **newp));
  446.   int vim_regcomp_had_eol __ARGS((void));
  447.   void free_regexp_stuff __ARGS((void));
  448.   reg_extmatch_T *ref_extmatch __ARGS((reg_extmatch_T *em));
  449.   void unref_extmatch __ARGS((reg_extmatch_T *em));
  450.   char_u *regtilde __ARGS((char_u *source, int magic));
  451.   int vim_regsub __ARGS((regmatch_T *rmp, char_u *source, char_u *dest, int copy, int magic, int backslash));
  452.   int vim_regsub_multi __ARGS((regmmatch_T *rmp, linenr_T lnum, char_u *source, char_u *dest, int copy, int magic, int backslash));
  453.   char_u *reg_submatch __ARGS((int no));
  454. + regprog_T *vim_regcomp __ARGS((char_u *expr_arg, int re_flags));
  455. + void vim_regfree __ARGS((regprog_T *prog));
  456. + int vim_regexec __ARGS((regmatch_T *rmp, char_u *line, colnr_T col));
  457. + int vim_regexec_nl __ARGS((regmatch_T *rmp, char_u *line, colnr_T col));
  458. + long vim_regexec_multi __ARGS((regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col, proftime_T *tm));
  459.   /* vim: set ft=c : */
  460. *** ../vim-7.3.1148/src/buffer.c    2013-06-07 20:17:06.000000000 +0200
  461. --- src/buffer.c    2013-06-08 16:06:38.000000000 +0200
  462. ***************
  463. *** 1898,1904 ****
  464.   #ifdef FEAT_SPELL
  465.       clear_string_option(&buf->b_s.b_p_spc);
  466.       clear_string_option(&buf->b_s.b_p_spf);
  467. !     vim_free(buf->b_s.b_cap_prog);
  468.       buf->b_s.b_cap_prog = NULL;
  469.       clear_string_option(&buf->b_s.b_p_spl);
  470.   #endif
  471. --- 1898,1904 ----
  472.   #ifdef FEAT_SPELL
  473.       clear_string_option(&buf->b_s.b_p_spc);
  474.       clear_string_option(&buf->b_s.b_p_spf);
  475. !     vim_regfree(buf->b_s.b_cap_prog);
  476.       buf->b_s.b_cap_prog = NULL;
  477.       clear_string_option(&buf->b_s.b_p_spl);
  478.   #endif
  479. ***************
  480. *** 2246,2252 ****
  481.               match = buf->b_fnum;    /* remember first match */
  482.               }
  483.   
  484. !         vim_free(prog);
  485.           if (match >= 0)            /* found one match */
  486.               break;
  487.           }
  488. --- 2246,2252 ----
  489.               match = buf->b_fnum;    /* remember first match */
  490.               }
  491.   
  492. !         vim_regfree(prog);
  493.           if (match >= 0)            /* found one match */
  494.               break;
  495.           }
  496. ***************
  497. *** 2355,2368 ****
  498.           *file = (char_u **)alloc((unsigned)(count * sizeof(char_u *)));
  499.           if (*file == NULL)
  500.           {
  501. !             vim_free(prog);
  502.               if (patc != pat)
  503.               vim_free(patc);
  504.               return FAIL;
  505.           }
  506.           }
  507.       }
  508. !     vim_free(prog);
  509.       if (count)        /* match(es) found, break here */
  510.           break;
  511.       }
  512. --- 2355,2368 ----
  513.           *file = (char_u **)alloc((unsigned)(count * sizeof(char_u *)));
  514.           if (*file == NULL)
  515.           {
  516. !             vim_regfree(prog);
  517.               if (patc != pat)
  518.               vim_free(patc);
  519.               return FAIL;
  520.           }
  521.           }
  522.       }
  523. !     vim_regfree(prog);
  524.       if (count)        /* match(es) found, break here */
  525.           break;
  526.       }
  527. *** ../vim-7.3.1148/src/edit.c    2013-05-19 21:15:08.000000000 +0200
  528. --- src/edit.c    2013-06-08 15:46:43.000000000 +0200
  529. ***************
  530. *** 3134,3140 ****
  531.   
  532.   theend:
  533.       p_scs = save_p_scs;
  534. !     vim_free(regmatch.regprog);
  535.       vim_free(buf);
  536.   }
  537.   
  538. --- 3134,3140 ----
  539.   
  540.   theend:
  541.       p_scs = save_p_scs;
  542. !     vim_regfree(regmatch.regprog);
  543.       vim_free(buf);
  544.   }
  545.   
  546. *** ../vim-7.3.1148/src/eval.c    2013-06-06 21:31:02.000000000 +0200
  547. --- src/eval.c    2013-06-08 15:48:23.000000000 +0200
  548. ***************
  549. *** 4560,4566 ****
  550.                   if (regmatch.regprog != NULL)
  551.                   {
  552.                   n1 = vim_regexec_nl(®match, s1, (colnr_T)0);
  553. !                 vim_free(regmatch.regprog);
  554.                   if (type == TYPE_NOMATCH)
  555.                       n1 = !n1;
  556.                   }
  557. --- 4560,4566 ----
  558.                   if (regmatch.regprog != NULL)
  559.                   {
  560.                   n1 = vim_regexec_nl(®match, s1, (colnr_T)0);
  561. !                 vim_regfree(regmatch.regprog);
  562.                   if (type == TYPE_NOMATCH)
  563.                       n1 = !n1;
  564.                   }
  565. ***************
  566. *** 13981,13987 ****
  567.           rettv->vval.v_number += (varnumber_T)(str - expr);
  568.           }
  569.       }
  570. !     vim_free(regmatch.regprog);
  571.       }
  572.   
  573.   theend:
  574. --- 13981,13987 ----
  575.           rettv->vval.v_number += (varnumber_T)(str - expr);
  576.           }
  577.       }
  578. !     vim_regfree(regmatch.regprog);
  579.       }
  580.   
  581.   theend:
  582. ***************
  583. *** 17214,17220 ****
  584.           str = regmatch.endp[0];
  585.       }
  586.   
  587. !     vim_free(regmatch.regprog);
  588.       }
  589.   
  590.       p_cpo = save_cpo;
  591. --- 17214,17220 ----
  592.           str = regmatch.endp[0];
  593.       }
  594.   
  595. !     vim_regfree(regmatch.regprog);
  596.       }
  597.   
  598.       p_cpo = save_cpo;
  599. ***************
  600. *** 21066,21072 ****
  601.                   list_func_head(fp, FALSE);
  602.               }
  603.           }
  604. !         vim_free(regmatch.regprog);
  605.           }
  606.       }
  607.       if (*p == '/')
  608. --- 21066,21072 ----
  609.                   list_func_head(fp, FALSE);
  610.               }
  611.           }
  612. !         vim_regfree(regmatch.regprog);
  613.           }
  614.       }
  615.       if (*p == '/')
  616. ***************
  617. *** 24220,24226 ****
  618.       if (ga.ga_data != NULL)
  619.           STRCPY((char *)ga.ga_data + ga.ga_len, tail);
  620.   
  621. !     vim_free(regmatch.regprog);
  622.       }
  623.   
  624.       ret = vim_strsave(ga.ga_data == NULL ? str : (char_u *)ga.ga_data);
  625. --- 24220,24226 ----
  626.       if (ga.ga_data != NULL)
  627.           STRCPY((char *)ga.ga_data + ga.ga_len, tail);
  628.   
  629. !     vim_regfree(regmatch.regprog);
  630.       }
  631.   
  632.       ret = vim_strsave(ga.ga_data == NULL ? str : (char_u *)ga.ga_data);
  633. *** ../vim-7.3.1148/src/ex_cmds.c    2013-05-30 11:43:11.000000000 +0200
  634. --- src/ex_cmds.c    2013-06-08 16:07:02.000000000 +0200
  635. ***************
  636. *** 571,577 ****
  637.       vim_free(nrs);
  638.       vim_free(sortbuf1);
  639.       vim_free(sortbuf2);
  640. !     vim_free(regmatch.regprog);
  641.       if (got_int)
  642.       EMSG(_(e_interr));
  643.   }
  644. --- 571,577 ----
  645.       vim_free(nrs);
  646.       vim_free(sortbuf1);
  647.       vim_free(sortbuf2);
  648. !     vim_regfree(regmatch.regprog);
  649.       if (got_int)
  650.       EMSG(_(e_interr));
  651.   }
  652. ***************
  653. *** 5261,5267 ****
  654.       changed_window_setting();
  655.   #endif
  656.   
  657. !     vim_free(regmatch.regprog);
  658.   }
  659.   
  660.   /*
  661. --- 5261,5267 ----
  662.       changed_window_setting();
  663.   #endif
  664.   
  665. !     vim_regfree(regmatch.regprog);
  666.   }
  667.   
  668.   /*
  669. ***************
  670. *** 5436,5442 ****
  671.       global_exe(cmd);
  672.   
  673.       ml_clearmarked();       /* clear rest of the marks */
  674. !     vim_free(regmatch.regprog);
  675.   }
  676.   
  677.   /*
  678. --- 5436,5442 ----
  679.       global_exe(cmd);
  680.   
  681.       ml_clearmarked();       /* clear rest of the marks */
  682. !     vim_regfree(regmatch.regprog);
  683.   }
  684.   
  685.   /*
  686. *** ../vim-7.3.1148/src/ex_cmds2.c    2013-06-06 14:01:35.000000000 +0200
  687. --- src/ex_cmds2.c    2013-06-08 15:49:57.000000000 +0200
  688. ***************
  689. *** 652,658 ****
  690.       while (gap->ga_len > 0)
  691.       {
  692.           vim_free(DEBUGGY(gap, todel).dbg_name);
  693. !         vim_free(DEBUGGY(gap, todel).dbg_prog);
  694.           --gap->ga_len;
  695.           if (todel < gap->ga_len)
  696.           mch_memmove(&DEBUGGY(gap, todel), &DEBUGGY(gap, todel + 1),
  697. --- 652,658 ----
  698.       while (gap->ga_len > 0)
  699.       {
  700.           vim_free(DEBUGGY(gap, todel).dbg_name);
  701. !         vim_regfree(DEBUGGY(gap, todel).dbg_prog);
  702.           --gap->ga_len;
  703.           if (todel < gap->ga_len)
  704.           mch_memmove(&DEBUGGY(gap, todel), &DEBUGGY(gap, todel + 1),
  705. ***************
  706. *** 1985,1991 ****
  707.               --match;
  708.           }
  709.   
  710. !         vim_free(regmatch.regprog);
  711.           vim_free(p);
  712.           if (!didone)
  713.           EMSG2(_(e_nomatch2), ((char_u **)new_ga.ga_data)[i]);
  714. --- 1985,1991 ----
  715.               --match;
  716.           }
  717.   
  718. !         vim_regfree(regmatch.regprog);
  719.           vim_free(p);
  720.           if (!didone)
  721.           EMSG2(_(e_nomatch2), ((char_u **)new_ga.ga_data)[i]);
  722. *** ../vim-7.3.1148/src/ex_docmd.c    2013-06-08 15:24:41.000000000 +0200
  723. --- src/ex_docmd.c    2013-06-08 15:50:07.000000000 +0200
  724. ***************
  725. *** 7779,7785 ****
  726.           curwin->w_cursor.col = (colnr_T)(regmatch.startp[0] - p);
  727.           else
  728.           EMSG(_(e_nomatch));
  729. !         vim_free(regmatch.regprog);
  730.       }
  731.       /* Move to the NUL, ignore any other arguments. */
  732.       eap->arg += STRLEN(eap->arg);
  733. --- 7779,7785 ----
  734.           curwin->w_cursor.col = (colnr_T)(regmatch.startp[0] - p);
  735.           else
  736.           EMSG(_(e_nomatch));
  737. !         vim_regfree(regmatch.regprog);
  738.       }
  739.       /* Move to the NUL, ignore any other arguments. */
  740.       eap->arg += STRLEN(eap->arg);
  741. *** ../vim-7.3.1148/src/ex_eval.c    2013-05-06 04:21:35.000000000 +0200
  742. --- src/ex_eval.c    2013-06-08 15:50:28.000000000 +0200
  743. ***************
  744. *** 1576,1582 ****
  745.               caught = vim_regexec_nl(®match, current_exception->value,
  746.                   (colnr_T)0);
  747.               got_int |= prev_got_int;
  748. !             vim_free(regmatch.regprog);
  749.           }
  750.           }
  751.       }
  752. --- 1576,1582 ----
  753.               caught = vim_regexec_nl(®match, current_exception->value,
  754.                   (colnr_T)0);
  755.               got_int |= prev_got_int;
  756. !             vim_regfree(regmatch.regprog);
  757.           }
  758.           }
  759.       }
  760. *** ../vim-7.3.1148/src/ex_getln.c    2013-06-08 15:24:41.000000000 +0200
  761. --- src/ex_getln.c    2013-06-08 15:51:13.000000000 +0200
  762. ***************
  763. *** 4717,4723 ****
  764.           }
  765.       }
  766.   
  767. !     vim_free(regmatch.regprog);
  768.   
  769.       return ret;
  770.   #endif /* FEAT_CMDL_COMPL */
  771. --- 4717,4723 ----
  772.           }
  773.       }
  774.   
  775. !     vim_regfree(regmatch.regprog);
  776.   
  777.       return ret;
  778.   #endif /* FEAT_CMDL_COMPL */
  779. ***************
  780. *** 5785,5791 ****
  781.       if (history[histype][idx].hisstr == NULL)
  782.           hisidx[histype] = -1;
  783.       }
  784. !     vim_free(regmatch.regprog);
  785.       return found;
  786.   }
  787.   
  788. --- 5785,5791 ----
  789.       if (history[histype][idx].hisstr == NULL)
  790.           hisidx[histype] = -1;
  791.       }
  792. !     vim_regfree(regmatch.regprog);
  793.       return found;
  794.   }
  795.   
  796. *** ../vim-7.3.1148/src/fileio.c    2013-05-06 04:50:26.000000000 +0200
  797. --- src/fileio.c    2013-06-08 15:52:10.000000000 +0200
  798. ***************
  799. *** 7921,7927 ****
  800.           if (ap->pat == NULL)
  801.           {
  802.           *prev_ap = ap->next;
  803. !         vim_free(ap->reg_prog);
  804.           vim_free(ap);
  805.           }
  806.           else
  807. --- 7921,7927 ----
  808.           if (ap->pat == NULL)
  809.           {
  810.           *prev_ap = ap->next;
  811. !         vim_regfree(ap->reg_prog);
  812.           vim_free(ap);
  813.           }
  814.           else
  815. ***************
  816. *** 10070,10076 ****
  817.       result = TRUE;
  818.   
  819.       if (prog == NULL)
  820. !     vim_free(regmatch.regprog);
  821.       return result;
  822.   }
  823.   #endif
  824. --- 10070,10076 ----
  825.       result = TRUE;
  826.   
  827.       if (prog == NULL)
  828. !     vim_regfree(regmatch.regprog);
  829.       return result;
  830.   }
  831.   #endif
  832. *** ../vim-7.3.1148/src/gui.c    2013-05-06 04:21:35.000000000 +0200
  833. --- src/gui.c    2013-06-08 15:52:24.000000000 +0200
  834. ***************
  835. *** 5319,5325 ****
  836.           }
  837.           else
  838.           MSG(_("No match at cursor, finding next"));
  839. !         vim_free(regmatch.regprog);
  840.       }
  841.       }
  842.   
  843. --- 5319,5325 ----
  844.           }
  845.           else
  846.           MSG(_("No match at cursor, finding next"));
  847. !         vim_regfree(regmatch.regprog);
  848.       }
  849.       }
  850.   
  851. *** ../vim-7.3.1148/src/misc1.c    2013-06-05 19:35:31.000000000 +0200
  852. --- src/misc1.c    2013-06-08 15:53:36.000000000 +0200
  853. ***************
  854. *** 456,463 ****
  855.           pos.coladd = 0;
  856.   #endif
  857.       }
  858.       }
  859. -     vim_free(regmatch.regprog);
  860.   
  861.       if (pos.lnum == 0 || *ml_get_pos(&pos) == NUL)
  862.       return -1;
  863. --- 456,463 ----
  864.           pos.coladd = 0;
  865.   #endif
  866.       }
  867. +     vim_regfree(regmatch.regprog);
  868.       }
  869.   
  870.       if (pos.lnum == 0 || *ml_get_pos(&pos) == NUL)
  871.       return -1;
  872. ***************
  873. *** 9751,9757 ****
  874.   # endif
  875.   #endif
  876.       vim_free(buf);
  877. !     vim_free(regmatch.regprog);
  878.       vim_free(matchname);
  879.   
  880.       matches = gap->ga_len - start_len;
  881. --- 9751,9757 ----
  882.   # endif
  883.   #endif
  884.       vim_free(buf);
  885. !     vim_regfree(regmatch.regprog);
  886.       vim_free(matchname);
  887.   
  888.       matches = gap->ga_len - start_len;
  889. ***************
  890. *** 9993,9999 ****
  891.       }
  892.   
  893.       vim_free(buf);
  894. !     vim_free(regmatch.regprog);
  895.   
  896.       matches = gap->ga_len - start_len;
  897.       if (matches > 0)
  898. --- 9993,9999 ----
  899.       }
  900.   
  901.       vim_free(buf);
  902. !     vim_regfree(regmatch.regprog);
  903.   
  904.       matches = gap->ga_len - start_len;
  905.       if (matches > 0)
  906. ***************
  907. *** 10358,10364 ****
  908.       vim_free(in_curdir);
  909.       }
  910.       ga_clear_strings(&path_ga);
  911. !     vim_free(regmatch.regprog);
  912.   
  913.       if (sort_again)
  914.       remove_duplicates(gap);
  915. --- 10358,10364 ----
  916.       vim_free(in_curdir);
  917.       }
  918.       ga_clear_strings(&path_ga);
  919. !     vim_regfree(regmatch.regprog);
  920.   
  921.       if (sort_again)
  922.       remove_duplicates(gap);
  923. *** ../vim-7.3.1148/src/misc2.c    2013-05-06 04:21:35.000000000 +0200
  924. --- src/misc2.c    2013-06-08 16:07:33.000000000 +0200
  925. ***************
  926. *** 1134,1140 ****
  927.       /* Free some global vars. */
  928.       vim_free(username);
  929.   # ifdef FEAT_CLIPBOARD
  930. !     vim_free(clip_exclude_prog);
  931.   # endif
  932.       vim_free(last_cmdline);
  933.   # ifdef FEAT_CMDHIST
  934. --- 1134,1140 ----
  935.       /* Free some global vars. */
  936.       vim_free(username);
  937.   # ifdef FEAT_CLIPBOARD
  938. !     vim_regfree(clip_exclude_prog);
  939.   # endif
  940.       vim_free(last_cmdline);
  941.   # ifdef FEAT_CMDHIST
  942. ***************
  943. *** 5008,5015 ****
  944.   #endif
  945.           {
  946.               /*
  947. !              * we don't have further wildcards to expand, so we have to
  948. !              * check for the final file now
  949.                */
  950.               for (i = stackp->ffs_filearray_cur;
  951.                         i < stackp->ffs_filearray_size; ++i)
  952. --- 5008,5015 ----
  953.   #endif
  954.           {
  955.               /*
  956. !              * We don't have further wildcards to expand, so we have to
  957. !              * check for the final file now.
  958.                */
  959.               for (i = stackp->ffs_filearray_cur;
  960.                         i < stackp->ffs_filearray_size; ++i)
  961. *** ../vim-7.3.1148/src/option.c    2013-06-04 22:13:45.000000000 +0200
  962. --- src/option.c    2013-06-08 16:30:58.000000000 +0200
  963. ***************
  964. *** 7491,7497 ****
  965.       clip_autoselect_plus = new_autoselect_plus;
  966.       clip_autoselectml = new_autoselectml;
  967.       clip_html = new_html;
  968. !     vim_free(clip_exclude_prog);
  969.       clip_exclude_prog = new_exclude_prog;
  970.   #ifdef FEAT_GUI_GTK
  971.       if (gui.in_use)
  972. --- 7491,7497 ----
  973.       clip_autoselect_plus = new_autoselect_plus;
  974.       clip_autoselectml = new_autoselectml;
  975.       clip_html = new_html;
  976. !     vim_regfree(clip_exclude_prog);
  977.       clip_exclude_prog = new_exclude_prog;
  978.   #ifdef FEAT_GUI_GTK
  979.       if (gui.in_use)
  980. ***************
  981. *** 7502,7508 ****
  982.   #endif
  983.       }
  984.       else
  985. !     vim_free(new_exclude_prog);
  986.   
  987.       return errmsg;
  988.   }
  989. --- 7502,7508 ----
  990.   #endif
  991.       }
  992.       else
  993. !     vim_regfree(new_exclude_prog);
  994.   
  995.       return errmsg;
  996.   }
  997. ***************
  998. *** 7529,7544 ****
  999.       if (re != NULL)
  1000.       {
  1001.           synblock->b_cap_prog = vim_regcomp(re, RE_MAGIC);
  1002.           if (synblock->b_cap_prog == NULL)
  1003.           {
  1004.           synblock->b_cap_prog = rp; /* restore the previous program */
  1005.           return e_invarg;
  1006.           }
  1007. -         vim_free(re);
  1008.       }
  1009.       }
  1010.   
  1011. !     vim_free(rp);
  1012.       return NULL;
  1013.   }
  1014.   #endif
  1015. --- 7529,7544 ----
  1016.       if (re != NULL)
  1017.       {
  1018.           synblock->b_cap_prog = vim_regcomp(re, RE_MAGIC);
  1019. +         vim_free(re);
  1020.           if (synblock->b_cap_prog == NULL)
  1021.           {
  1022.           synblock->b_cap_prog = rp; /* restore the previous program */
  1023.           return e_invarg;
  1024.           }
  1025.       }
  1026.       }
  1027.   
  1028. !     vim_regfree(rp);
  1029.       return NULL;
  1030.   }
  1031.   #endif
  1032. *** ../vim-7.3.1148/src/syntax.c    2013-06-08 15:24:41.000000000 +0200
  1033. --- src/syntax.c    2013-06-08 16:10:08.000000000 +0200
  1034. ***************
  1035. *** 3495,3501 ****
  1036.       block->b_syn_sync_maxlines = 0;
  1037.       block->b_syn_sync_linebreaks = 0;
  1038.   
  1039. !     vim_free(block->b_syn_linecont_prog);
  1040.       block->b_syn_linecont_prog = NULL;
  1041.       vim_free(block->b_syn_linecont_pat);
  1042.       block->b_syn_linecont_pat = NULL;
  1043. --- 3495,3501 ----
  1044.       block->b_syn_sync_maxlines = 0;
  1045.       block->b_syn_sync_linebreaks = 0;
  1046.   
  1047. !     vim_regfree(block->b_syn_linecont_prog);
  1048.       block->b_syn_linecont_prog = NULL;
  1049.       vim_free(block->b_syn_linecont_pat);
  1050.       block->b_syn_linecont_pat = NULL;
  1051. ***************
  1052. *** 3544,3550 ****
  1053.       curwin->w_s->b_syn_sync_maxlines = 0;
  1054.       curwin->w_s->b_syn_sync_linebreaks = 0;
  1055.   
  1056. !     vim_free(curwin->w_s->b_syn_linecont_prog);
  1057.       curwin->w_s->b_syn_linecont_prog = NULL;
  1058.       vim_free(curwin->w_s->b_syn_linecont_pat);
  1059.       curwin->w_s->b_syn_linecont_pat = NULL;
  1060. --- 3544,3550 ----
  1061.       curwin->w_s->b_syn_sync_maxlines = 0;
  1062.       curwin->w_s->b_syn_sync_linebreaks = 0;
  1063.   
  1064. !     vim_regfree(curwin->w_s->b_syn_linecont_prog);
  1065.       curwin->w_s->b_syn_linecont_prog = NULL;
  1066.       vim_free(curwin->w_s->b_syn_linecont_pat);
  1067.       curwin->w_s->b_syn_linecont_pat = NULL;
  1068. ***************
  1069. *** 3583,3589 ****
  1070.       int        i;
  1071.   {
  1072.       vim_free(SYN_ITEMS(block)[i].sp_pattern);
  1073. !     vim_free(SYN_ITEMS(block)[i].sp_prog);
  1074.       /* Only free sp_cont_list and sp_next_list of first start pattern */
  1075.       if (i == 0 || SYN_ITEMS(block)[i - 1].sp_type != SPTYPE_START)
  1076.       {
  1077. --- 3583,3589 ----
  1078.       int        i;
  1079.   {
  1080.       vim_free(SYN_ITEMS(block)[i].sp_pattern);
  1081. !     vim_regfree(SYN_ITEMS(block)[i].sp_prog);
  1082.       /* Only free sp_cont_list and sp_next_list of first start pattern */
  1083.       if (i == 0 || SYN_ITEMS(block)[i - 1].sp_type != SPTYPE_START)
  1084.       {
  1085. ***************
  1086. *** 4991,4997 ****
  1087.       /*
  1088.        * Something failed, free the allocated memory.
  1089.        */
  1090. !     vim_free(item.sp_prog);
  1091.       vim_free(item.sp_pattern);
  1092.       vim_free(syn_opt_arg.cont_list);
  1093.       vim_free(syn_opt_arg.cont_in_list);
  1094. --- 4991,4997 ----
  1095.       /*
  1096.        * Something failed, free the allocated memory.
  1097.        */
  1098. !     vim_regfree(item.sp_prog);
  1099.       vim_free(item.sp_pattern);
  1100.       vim_free(syn_opt_arg.cont_list);
  1101.       vim_free(syn_opt_arg.cont_in_list);
  1102. ***************
  1103. *** 5248,5254 ****
  1104.       {
  1105.           if (!success)
  1106.           {
  1107. !         vim_free(ppp->pp_synp->sp_prog);
  1108.           vim_free(ppp->pp_synp->sp_pattern);
  1109.           }
  1110.           vim_free(ppp->pp_synp);
  1111. --- 5248,5254 ----
  1112.       {
  1113.           if (!success)
  1114.           {
  1115. !         vim_regfree(ppp->pp_synp->sp_prog);
  1116.           vim_free(ppp->pp_synp->sp_pattern);
  1117.           }
  1118.           vim_free(ppp->pp_synp);
  1119. ***************
  1120. *** 6022,6028 ****
  1121.                   id = -1;        /* remember that we found one */
  1122.               }
  1123.               }
  1124. !             vim_free(regmatch.regprog);
  1125.           }
  1126.           }
  1127.           vim_free(name);
  1128. --- 6022,6028 ----
  1129.                   id = -1;        /* remember that we found one */
  1130.               }
  1131.               }
  1132. !             vim_regfree(regmatch.regprog);
  1133.           }
  1134.           }
  1135.           vim_free(name);
  1136. ***************
  1137. *** 6295,6301 ****
  1138.       curwin->w_p_spell = FALSE;    /* No spell checking */
  1139.       clear_string_option(&curwin->w_s->b_p_spc);
  1140.       clear_string_option(&curwin->w_s->b_p_spf);
  1141. !     vim_free(curwin->w_s->b_cap_prog);
  1142.       curwin->w_s->b_cap_prog = NULL;
  1143.       clear_string_option(&curwin->w_s->b_p_spl);
  1144.   #endif
  1145. --- 6295,6301 ----
  1146.       curwin->w_p_spell = FALSE;    /* No spell checking */
  1147.       clear_string_option(&curwin->w_s->b_p_spc);
  1148.       clear_string_option(&curwin->w_s->b_p_spf);
  1149. !     vim_regfree(curwin->w_s->b_cap_prog);
  1150.       curwin->w_s->b_cap_prog = NULL;
  1151.       clear_string_option(&curwin->w_s->b_p_spl);
  1152.   #endif
  1153. *** ../vim-7.3.1148/src/quickfix.c    2013-05-11 15:50:02.000000000 +0200
  1154. --- src/quickfix.c    2013-06-08 15:57:08.000000000 +0200
  1155. ***************
  1156. *** 863,869 ****
  1157.       for (fmt_ptr = fmt_first; fmt_ptr != NULL; fmt_ptr = fmt_first)
  1158.       {
  1159.       fmt_first = fmt_ptr->next;
  1160. !     vim_free(fmt_ptr->prog);
  1161.       vim_free(fmt_ptr);
  1162.       }
  1163.       qf_clean_dir_stack(&dir_stack);
  1164. --- 863,869 ----
  1165.       for (fmt_ptr = fmt_first; fmt_ptr != NULL; fmt_ptr = fmt_first)
  1166.       {
  1167.       fmt_first = fmt_ptr->next;
  1168. !     vim_regfree(fmt_ptr->prog);
  1169.       vim_free(fmt_ptr);
  1170.       }
  1171.       qf_clean_dir_stack(&dir_stack);
  1172. ***************
  1173. *** 3487,3493 ****
  1174.       vim_free(dirname_now);
  1175.       vim_free(dirname_start);
  1176.       vim_free(target_dir);
  1177. !     vim_free(regmatch.regprog);
  1178.   }
  1179.   
  1180.   /*
  1181. --- 3487,3493 ----
  1182.       vim_free(dirname_now);
  1183.       vim_free(dirname_start);
  1184.       vim_free(target_dir);
  1185. !     vim_regfree(regmatch.regprog);
  1186.   }
  1187.   
  1188.   /*
  1189. ***************
  1190. *** 4178,4184 ****
  1191.           }
  1192.       }
  1193.   
  1194. !     vim_free(regmatch.regprog);
  1195.   #ifdef FEAT_MBYTE
  1196.       if (vc.vc_type != CONV_NONE)
  1197.           convert_setup(&vc, NULL, NULL);
  1198. --- 4178,4184 ----
  1199.           }
  1200.       }
  1201.   
  1202. !     vim_regfree(regmatch.regprog);
  1203.   #ifdef FEAT_MBYTE
  1204.       if (vc.vc_type != CONV_NONE)
  1205.           convert_setup(&vc, NULL, NULL);
  1206. *** ../vim-7.3.1148/src/search.c    2013-05-06 04:21:35.000000000 +0200
  1207. --- src/search.c    2013-06-08 15:59:38.000000000 +0200
  1208. ***************
  1209. *** 972,978 ****
  1210.       }
  1211.       while (--count > 0 && found);   /* stop after count matches or no match */
  1212.   
  1213. !     vim_free(regmatch.regprog);
  1214.   
  1215.       called_emsg |= save_called_emsg;
  1216.   
  1217. --- 972,978 ----
  1218.       }
  1219.       while (--count > 0 && found);   /* stop after count matches or no match */
  1220.   
  1221. !     vim_regfree(regmatch.regprog);
  1222.   
  1223.       called_emsg |= save_called_emsg;
  1224.   
  1225. ***************
  1226. *** 4680,4686 ****
  1227.       }
  1228.   
  1229.       called_emsg |= save_called_emsg;
  1230. !     vim_free(regmatch.regprog);
  1231.       return result;
  1232.   }
  1233.   #endif /* FEAT_VISUAL */
  1234. --- 4680,4686 ----
  1235.       }
  1236.   
  1237.       called_emsg |= save_called_emsg;
  1238. !     vim_regfree(regmatch.regprog);
  1239.       return result;
  1240.   }
  1241.   #endif /* FEAT_VISUAL */
  1242. ***************
  1243. *** 5402,5410 ****
  1244.   
  1245.   fpip_end:
  1246.       vim_free(file_line);
  1247. !     vim_free(regmatch.regprog);
  1248. !     vim_free(incl_regmatch.regprog);
  1249. !     vim_free(def_regmatch.regprog);
  1250.   }
  1251.   
  1252.       static void
  1253. --- 5402,5410 ----
  1254.   
  1255.   fpip_end:
  1256.       vim_free(file_line);
  1257. !     vim_regfree(regmatch.regprog);
  1258. !     vim_regfree(incl_regmatch.regprog);
  1259. !     vim_regfree(def_regmatch.regprog);
  1260.   }
  1261.   
  1262.       static void
  1263. *** ../vim-7.3.1148/src/spell.c    2013-05-06 04:21:35.000000000 +0200
  1264. --- src/spell.c    2013-06-08 16:10:52.000000000 +0200
  1265. ***************
  1266. *** 2658,2664 ****
  1267.       ga_clear(gap);
  1268.   
  1269.       for (i = 0; i < lp->sl_prefixcnt; ++i)
  1270. !     vim_free(lp->sl_prefprog[i]);
  1271.       lp->sl_prefixcnt = 0;
  1272.       vim_free(lp->sl_prefprog);
  1273.       lp->sl_prefprog = NULL;
  1274. --- 2658,2664 ----
  1275.       ga_clear(gap);
  1276.   
  1277.       for (i = 0; i < lp->sl_prefixcnt; ++i)
  1278. !     vim_regfree(lp->sl_prefprog[i]);
  1279.       lp->sl_prefixcnt = 0;
  1280.       vim_free(lp->sl_prefprog);
  1281.       lp->sl_prefprog = NULL;
  1282. ***************
  1283. *** 2669,2675 ****
  1284.       vim_free(lp->sl_midword);
  1285.       lp->sl_midword = NULL;
  1286.   
  1287. !     vim_free(lp->sl_compprog);
  1288.       vim_free(lp->sl_comprules);
  1289.       vim_free(lp->sl_compstartflags);
  1290.       vim_free(lp->sl_compallflags);
  1291. --- 2669,2675 ----
  1292.       vim_free(lp->sl_midword);
  1293.       lp->sl_midword = NULL;
  1294.   
  1295. !     vim_regfree(lp->sl_compprog);
  1296.       vim_free(lp->sl_comprules);
  1297.       vim_free(lp->sl_compstartflags);
  1298.       vim_free(lp->sl_compallflags);
  1299. ***************
  1300. *** 5802,5808 ****
  1301.                       {
  1302.                           sprintf((char *)buf, "^%s",
  1303.                                 aff_entry->ae_cond);
  1304. !                         vim_free(aff_entry->ae_prog);
  1305.                           aff_entry->ae_prog = vim_regcomp(
  1306.                               buf, RE_MAGIC + RE_STRING);
  1307.                       }
  1308. --- 5802,5808 ----
  1309.                       {
  1310.                           sprintf((char *)buf, "^%s",
  1311.                                 aff_entry->ae_cond);
  1312. !                         vim_regfree(aff_entry->ae_prog);
  1313.                           aff_entry->ae_prog = vim_regcomp(
  1314.                               buf, RE_MAGIC + RE_STRING);
  1315.                       }
  1316. ***************
  1317. *** 6507,6513 ****
  1318.           --todo;
  1319.           ah = HI2AH(hi);
  1320.           for (ae = ah->ah_first; ae != NULL; ae = ae->ae_next)
  1321. !             vim_free(ae->ae_prog);
  1322.           }
  1323.       }
  1324.       if (ht == &aff->af_suff)
  1325. --- 6507,6513 ----
  1326.           --todo;
  1327.           ah = HI2AH(hi);
  1328.           for (ae = ah->ah_first; ae != NULL; ae = ae->ae_next)
  1329. !             vim_regfree(ae->ae_prog);
  1330.           }
  1331.       }
  1332.       if (ht == &aff->af_suff)
  1333. *** ../vim-7.3.1148/src/tag.c    2012-09-12 18:19:39.000000000 +0200
  1334. --- src/tag.c    2013-06-08 16:03:31.000000000 +0200
  1335. ***************
  1336. *** 2491,2497 ****
  1337.   
  1338.   findtag_end:
  1339.       vim_free(lbuf);
  1340. !     vim_free(orgpat.regmatch.regprog);
  1341.       vim_free(tag_fname);
  1342.   #ifdef FEAT_EMACS_TAGS
  1343.       vim_free(ebuf);
  1344. --- 2491,2497 ----
  1345.   
  1346.   findtag_end:
  1347.       vim_free(lbuf);
  1348. !     vim_regfree(orgpat.regmatch.regprog);
  1349.       vim_free(tag_fname);
  1350.   #ifdef FEAT_EMACS_TAGS
  1351.       vim_free(ebuf);
  1352. *** ../vim-7.3.1148/src/window.c    2013-05-18 20:55:31.000000000 +0200
  1353. --- src/window.c    2013-06-08 16:03:54.000000000 +0200
  1354. ***************
  1355. *** 6818,6824 ****
  1356.       wp->w_match_head = cur->next;
  1357.       else
  1358.       prev->next = cur->next;
  1359. !     vim_free(cur->match.regprog);
  1360.       vim_free(cur->pattern);
  1361.       vim_free(cur);
  1362.       redraw_later(SOME_VALID);
  1363. --- 6818,6824 ----
  1364.       wp->w_match_head = cur->next;
  1365.       else
  1366.       prev->next = cur->next;
  1367. !     vim_regfree(cur->match.regprog);
  1368.       vim_free(cur->pattern);
  1369.       vim_free(cur);
  1370.       redraw_later(SOME_VALID);
  1371. ***************
  1372. *** 6837,6843 ****
  1373.       while (wp->w_match_head != NULL)
  1374.       {
  1375.       m = wp->w_match_head->next;
  1376. !     vim_free(wp->w_match_head->match.regprog);
  1377.       vim_free(wp->w_match_head->pattern);
  1378.       vim_free(wp->w_match_head);
  1379.       wp->w_match_head = m;
  1380. --- 6837,6843 ----
  1381.       while (wp->w_match_head != NULL)
  1382.       {
  1383.       m = wp->w_match_head->next;
  1384. !     vim_regfree(wp->w_match_head->match.regprog);
  1385.       vim_free(wp->w_match_head->pattern);
  1386.       vim_free(wp->w_match_head);
  1387.       wp->w_match_head = m;
  1388. *** ../vim-7.3.1148/src/screen.c    2013-06-07 20:17:06.000000000 +0200
  1389. --- src/screen.c    2013-06-08 16:09:18.000000000 +0200
  1390. ***************
  1391. *** 7082,7088 ****
  1392.   {
  1393.       if (search_hl.rm.regprog != NULL)
  1394.       {
  1395. !     vim_free(search_hl.rm.regprog);
  1396.       search_hl.rm.regprog = NULL;
  1397.       }
  1398.   }
  1399. --- 7082,7088 ----
  1400.   {
  1401.       if (search_hl.rm.regprog != NULL)
  1402.       {
  1403. !     vim_regfree(search_hl.rm.regprog);
  1404.       search_hl.rm.regprog = NULL;
  1405.       }
  1406.   }
  1407. ***************
  1408. *** 7284,7290 ****
  1409.           if (shl == &search_hl)
  1410.           {
  1411.           /* don't free regprog in the match list, it's a copy */
  1412. !         vim_free(shl->rm.regprog);
  1413.           no_hlsearch = TRUE;
  1414.           }
  1415.           shl->rm.regprog = NULL;
  1416. --- 7284,7290 ----
  1417.           if (shl == &search_hl)
  1418.           {
  1419.           /* don't free regprog in the match list, it's a copy */
  1420. !         vim_regfree(shl->rm.regprog);
  1421.           no_hlsearch = TRUE;
  1422.           }
  1423.           shl->rm.regprog = NULL;
  1424. *** ../vim-7.3.1148/src/macros.h    2012-07-19 17:18:21.000000000 +0200
  1425. --- src/macros.h    2013-06-08 16:53:34.000000000 +0200
  1426. ***************
  1427. *** 272,277 ****
  1428. --- 272,278 ----
  1429.   
  1430.   # define MB_COPY_CHAR(f, t) if (has_mbyte) mb_copy_char(&f, &t); else *t++ = *f++
  1431.   # define MB_CHARLEN(p)        (has_mbyte ? mb_charlen(p) : (int)STRLEN(p))
  1432. + # define MB_CHAR2LEN(c)        (has_mbyte ? mb_char2len(c) : 1)
  1433.   # define PTR2CHAR(p)        (has_mbyte ? mb_ptr2char(p) : (int)*(p))
  1434.   #else
  1435.   # define MB_PTR2LEN(p)        1
  1436. ***************
  1437. *** 280,285 ****
  1438. --- 281,287 ----
  1439.   # define mb_ptr_back(s, p)    --p
  1440.   # define MB_COPY_CHAR(f, t)    *t++ = *f++
  1441.   # define MB_CHARLEN(p)        STRLEN(p)
  1442. + # define MB_CHAR2LEN(c)        1
  1443.   # define PTR2CHAR(p)        ((int)*(p))
  1444.   #endif
  1445.   
  1446. *** ../vim-7.3.1148/src/testdir/test64.in    2013-06-05 18:52:36.000000000 +0200
  1447. --- src/testdir/test64.in    2013-06-08 13:05:08.000000000 +0200
  1448. ***************
  1449. *** 260,265 ****
  1450. --- 260,267 ----
  1451.   :call add(tl, [2, '[^[:alpha:]]\+','abcccadfoij7787ysf287yrnccdu','7787'])
  1452.   :call add(tl, [2, '[-a]', '-', '-'])
  1453.   :call add(tl, [2, '[a-]', '-', '-'])
  1454. + :call add(tl, [2, '[a-f]*\c','ABCDEFGH','ABCDEF'])
  1455. + :call add(tl, [2, '[abc][xyz]\c','-af-AF-BY--','BY'])
  1456.   :" filename regexp
  1457.   :call add(tl, [2, '[-./[:alnum:]_~]\+', 'log13.file', 'log13.file'])
  1458.   :" special chars
  1459. ***************
  1460. *** 385,390 ****
  1461. --- 387,398 ----
  1462.   :call add(tl, [2, '\(<<\)\@2<=span.', 'xxspanxxxx<spanxx<<spanyyy', 'spany', '<<'])
  1463.   :call add(tl, [2, '\(foo\)\@<!bar.', 'xx foobar1 xbar2 xx', 'bar2'])
  1464.   :"
  1465. + :" look-behind match in front of a zero-width item
  1466. + :call add(tl, [2, '\v\C%(<Last Changed:\s+)@<=.*$', '" test header'])
  1467. + :call add(tl, [2, '\v\C%(<Last Changed:\s+)@<=.*$', '" Last Changed: 1970', '1970'])
  1468. + :call add(tl, [2, '\(foo\)\@<=\>', 'foobar'])
  1469. + :call add(tl, [2, '\(foo\)\@<=\>', 'barfoo', '', 'foo'])
  1470. + :"
  1471.   :""""" \@>
  1472.   :call add(tl, [2, '\(a*\)\@>a', 'aaaa'])
  1473.   :call add(tl, [2, '\(a*\)\@>b', 'aaab', 'aaab', 'aaa'])
  1474. *** ../vim-7.3.1148/src/testdir/test64.ok    2013-06-05 18:52:36.000000000 +0200
  1475. --- src/testdir/test64.ok    2013-06-08 13:16:59.000000000 +0200
  1476. ***************
  1477. *** 584,589 ****
  1478. --- 584,595 ----
  1479.   OK 0 - [a-]
  1480.   OK 1 - [a-]
  1481.   OK 2 - [a-]
  1482. + OK 0 - [a-f]*\c
  1483. + OK 1 - [a-f]*\c
  1484. + OK 2 - [a-f]*\c
  1485. + OK 0 - [abc][xyz]\c
  1486. + OK 1 - [abc][xyz]\c
  1487. + OK 2 - [abc][xyz]\c
  1488.   OK 0 - [-./[:alnum:]_~]\+
  1489.   OK 1 - [-./[:alnum:]_~]\+
  1490.   OK 2 - [-./[:alnum:]_~]\+
  1491. ***************
  1492. *** 872,877 ****
  1493. --- 878,895 ----
  1494.   OK 0 - \(foo\)\@<!bar.
  1495.   OK 1 - \(foo\)\@<!bar.
  1496.   OK 2 - \(foo\)\@<!bar.
  1497. + OK 0 - \v\C%(<Last Changed:\s+)@<=.*$
  1498. + OK 1 - \v\C%(<Last Changed:\s+)@<=.*$
  1499. + OK 2 - \v\C%(<Last Changed:\s+)@<=.*$
  1500. + OK 0 - \v\C%(<Last Changed:\s+)@<=.*$
  1501. + OK 1 - \v\C%(<Last Changed:\s+)@<=.*$
  1502. + OK 2 - \v\C%(<Last Changed:\s+)@<=.*$
  1503. + OK 0 - \(foo\)\@<=\>
  1504. + OK 1 - \(foo\)\@<=\>
  1505. + OK 2 - \(foo\)\@<=\>
  1506. + OK 0 - \(foo\)\@<=\>
  1507. + OK 1 - \(foo\)\@<=\>
  1508. + OK 2 - \(foo\)\@<=\>
  1509.   OK 0 - \(a*\)\@>a
  1510.   OK 1 - \(a*\)\@>a
  1511.   OK 2 - \(a*\)\@>a
  1512. *** ../vim-7.3.1148/src/version.c    2013-06-08 15:24:41.000000000 +0200
  1513. --- src/version.c    2013-06-08 18:09:41.000000000 +0200
  1514. ***************
  1515. *** 730,731 ****
  1516. --- 730,733 ----
  1517.   {   /* Add new patch number below this line */
  1518. + /**/
  1519. +     1149,
  1520.   /**/
  1521.  
  1522. -- 
  1523. FIXME and XXX are two common keywords used to mark broken or incomplete code
  1524. not only since XXX as a sex reference would grab everybody's attention but
  1525. simply due to the fact that Vim would highlight these words.
  1526.                     -- Hendrik Scholz
  1527.  
  1528.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  1529. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  1530. \\\  an exciting new programming language -- http://www.Zimbu.org        ///
  1531.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  1532.