Blob Blame History Raw
To: vim_dev@googlegroups.com
Subject: Patch 7.3.979
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.3.979
Problem:    Complex NFA regexp doesn't work.
Solution:   Set actual state stack end instead of using an arbitrary number.
	    (Yasuhiro Matsumoto)
Files:	    src/regexp_nfa.c


*** ../vim-7.3.978/src/regexp_nfa.c	2013-05-20 21:49:08.000000000 +0200
--- src/regexp_nfa.c	2013-05-20 21:53:24.000000000 +0200
***************
*** 17,24 ****
  #define	    NFA_BRACES_MAXLIMIT		    10
  /* For allocating space for the postfix representation */
  #define	    NFA_POSTFIX_MULTIPLIER	    (NFA_BRACES_MAXLIMIT + 2)*2
- /* Size of stack, used when converting the postfix regexp into NFA */
- #define	    NFA_STACK_SIZE		    1024
  
  enum
  {
--- 17,22 ----
***************
*** 2160,2168 ****
      if (nfa_calc_size == FALSE)
      {
  	/* Allocate space for the stack. Max states on the stack : nstate */
! 	stack = (Frag_T *) lalloc((nstate + 1)*sizeof(Frag_T), TRUE);
  	stackp = stack;
! 	stack_end = stack + NFA_STACK_SIZE;
      }
  
      for (p = postfix; p < end; ++p)
--- 2158,2166 ----
      if (nfa_calc_size == FALSE)
      {
  	/* Allocate space for the stack. Max states on the stack : nstate */
! 	stack = (Frag_T *) lalloc((nstate + 1) * sizeof(Frag_T), TRUE);
  	stackp = stack;
! 	stack_end = stack + (nstate + 1);
      }
  
      for (p = postfix; p < end; ++p)
*** ../vim-7.3.978/src/version.c	2013-05-20 21:49:08.000000000 +0200
--- src/version.c	2013-05-20 21:55:37.000000000 +0200
***************
*** 730,731 ****
--- 730,733 ----
  {   /* Add new patch number below this line */
+ /**/
+     979,
  /**/

-- 
   Another bucket of what can only be described as human ordure hits ARTHUR.
ARTHUR: ... Right!  (to the KNIGHTS) That settles it!
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///