changeset 11836:3795b80ba1de

(re_compile_fastmap): Undo previous change. (RESET_FAIL_STACK): New macro. (re_compile_fastmap): Use RESET_FAIL_STACK, not REGEX_FREE_STACK directly.
author Karl Heuer <kwzh@gnu.org>
date Wed, 17 May 1995 20:29:52 +0000
parents 175192b364b1
children 49c4d8910dfc
files src/regex.c
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/regex.c	Wed May 17 20:01:47 1995 +0000
+++ b/src/regex.c	Wed May 17 20:29:52 1995 +0000
@@ -1011,7 +1011,8 @@
 #define FAIL_STACK_FULL()      (fail_stack.avail == fail_stack.size)
 
 
-/* Initialize `fail_stack'.  Do `return -2' if the alloc fails.  */
+/* Define macros to initialize and free the failure stack.
+   Do `return -2' if the alloc fails.  */
 
 #ifdef MATCH_MAY_ALLOCATE
 #define INIT_FAIL_STACK()						\
@@ -1025,11 +1026,15 @@
     fail_stack.size = INIT_FAILURE_ALLOC;				\
     fail_stack.avail = 0;						\
   } while (0)
+
+#define RESET_FAIL_STACK()  REGEX_FREE_STACK (fail_stack.stack)
 #else
 #define INIT_FAIL_STACK()						\
   do {									\
     fail_stack.avail = 0;						\
   } while (0)
+
+#define RESET_FAIL_STACK()
 #endif
 
 
@@ -3080,7 +3085,7 @@
             {
               if (!PUSH_PATTERN_OP (p + j, fail_stack))
 		{
-		  REGEX_FREE_STACK (fail_stack.stack);
+		  RESET_FAIL_STACK ();
 		  return -2;
 		}
             }
@@ -3141,8 +3146,7 @@
   bufp->can_be_null |= path_can_be_null;
 
  done:
-  if (!FAIL_STACK_EMPTY ())
-     REGEX_FREE_STACK (fail_stack.stack);
+  RESET_FAIL_STACK ();
   return 0;
 } /* re_compile_fastmap */