diff src/regex.c @ 107366:14ff9accfbd3

Cleanup setup of gl_state in various parts of the code. * syntax.h (SETUP_BUFFER_SYNTAX_TABLE): New macro. (SETUP_SYNTAX_TABLE, SETUP_SYNTAX_TABLE_FOR_OBJECT): * syntax.c (find_defun_start, Fchar_syntax, Fmatching_paren, skip_chars): * regex.c (regex_compile): Use it. (re_compile_pattern): Don't set gl_state.current_syntax_table since it's now set in regex_compile when/if we need it.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 10 Mar 2010 09:45:21 -0500
parents a2b9cb6b7cb7
children 5582106cddf0
line wrap: on
line diff
--- a/src/regex.c	Wed Mar 10 23:16:06 2010 +0900
+++ b/src/regex.c	Wed Mar 10 09:45:21 2010 -0500
@@ -3070,7 +3070,7 @@
 			   syntax-table for ASCII chars, while the other chars
 			   will obey syntax-table properties.  It's not ideal,
 			   but it's the way it's been done until now.  */
-			SETUP_SYNTAX_TABLE (BEGV, 0);
+			SETUP_BUFFER_SYNTAX_TABLE ();
 
 			for (ch = 0; ch < 256; ++ch)
 			  {
@@ -4496,7 +4496,7 @@
   anchored_start = (bufp->buffer[0] == begline);
 
 #ifdef emacs
-  gl_state.object = re_match_object;
+  gl_state.object = re_match_object; /* Used by SYNTAX_TABLE_BYTE_TO_CHAR. */
   {
     int charpos = SYNTAX_TABLE_BYTE_TO_CHAR (POS_AS_IN_BUFFER (startpos));
 
@@ -5099,7 +5099,7 @@
 
 #ifdef emacs
   int charpos;
-  gl_state.object = re_match_object;
+  gl_state.object = re_match_object; /* Used by SYNTAX_TABLE_BYTE_TO_CHAR. */
   charpos = SYNTAX_TABLE_BYTE_TO_CHAR (POS_AS_IN_BUFFER (pos));
   SETUP_SYNTAX_TABLE_FOR_OBJECT (re_match_object, charpos, 1);
 #endif
@@ -6504,10 +6504,6 @@
 {
   reg_errcode_t ret;
 
-#ifdef emacs
-  gl_state.current_syntax_table = current_buffer->syntax_table;
-#endif
-
   /* GNU code is written to assume at least RE_NREGS registers will be set
      (and at least one extra will be -1).  */
   bufp->regs_allocated = REGS_UNALLOCATED;