Commit 8ff888a0 authored by Paul Eggert's avatar Paul Eggert

Improve fix for regex reentrancy abort

Suggested by Stefan Monnier (Bug#21688).
* src/syntax.c (update_syntax_table_forward):
Remove recently-added PROPERTIZE arg, and assume it is true.
All callers changed.
* src/syntax.h (UPDATE_SYNTAX_TABLE_FORWARD_FAST):
Invoke update_syntax_table directly.
parent 1f07a61e
......@@ -246,7 +246,7 @@ SETUP_SYNTAX_TABLE (ptrdiff_t from, ptrdiff_t count)
if (parse_sexp_lookup_properties)
{
if (count > 0)
update_syntax_table_forward (from, true, true, Qnil);
update_syntax_table_forward (from, true, Qnil);
else if (from > BEGV)
{
update_syntax_table (from - 1, count, true, Qnil);
......@@ -502,12 +502,12 @@ parse_sexp_propertize (ptrdiff_t charpos)
e_property_truncated, so the e_property_truncated flag may
occasionally be left raised spuriously. This should be rare. */
gl_state.e_property_truncated = false;
update_syntax_table_forward (charpos, false, true, Qnil);
update_syntax_table_forward (charpos, false, Qnil);
}
}
void
update_syntax_table_forward (ptrdiff_t charpos, bool init, bool propertize,
update_syntax_table_forward (ptrdiff_t charpos, bool init,
Lisp_Object object)
{
if (gl_state.e_property_truncated)
......@@ -518,12 +518,9 @@ update_syntax_table_forward (ptrdiff_t charpos, bool init, bool propertize,
else
{
update_syntax_table (charpos, 1, init, object);
propertize &= (NILP (object)
&& gl_state.e_property > syntax_propertize__done);
if (NILP (object) && gl_state.e_property > syntax_propertize__done)
parse_sexp_propertize (charpos);
}
if (propertize)
parse_sexp_propertize (charpos);
}
/* Returns true if char at CHARPOS is quoted.
......
......@@ -27,7 +27,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
INLINE_HEADER_BEGIN
extern void update_syntax_table (ptrdiff_t, EMACS_INT, bool, Lisp_Object);
extern void update_syntax_table_forward (ptrdiff_t, bool, bool, Lisp_Object);
extern void update_syntax_table_forward (ptrdiff_t, bool, Lisp_Object);
/* The standard syntax table is stored where it will automatically
be used in all new buffers. */
......@@ -183,15 +183,14 @@ UPDATE_SYNTAX_TABLE_FORWARD (ptrdiff_t charpos)
{ /* Performs just-in-time syntax-propertization. */
if (parse_sexp_lookup_properties && charpos >= gl_state.e_property)
update_syntax_table_forward (charpos + gl_state.offset,
false, true, gl_state.object);
false, gl_state.object);
}
INLINE void
UPDATE_SYNTAX_TABLE_FORWARD_FAST (ptrdiff_t charpos)
{
if (parse_sexp_lookup_properties && charpos >= gl_state.e_property)
update_syntax_table_forward (charpos + gl_state.offset,
false, false, gl_state.object);
update_syntax_table (charpos + gl_state.offset, 1, false, gl_state.object);
}
/* Make syntax table state (gl_state) good for CHARPOS, assuming it is
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment