diff options
| author | Paul Eggert | 2015-11-16 13:09:46 -0800 |
|---|---|---|
| committer | Paul Eggert | 2015-11-16 13:10:17 -0800 |
| commit | 8ff888a07d0500f1274723086469191aade0a33e (patch) | |
| tree | a21880c49d5eb2ad67084e1d74d81913b30ebf13 /src | |
| parent | 1f07a61ee36d01e85da146f0f32798b8933ea563 (diff) | |
| download | emacs-8ff888a07d0500f1274723086469191aade0a33e.tar.gz emacs-8ff888a07d0500f1274723086469191aade0a33e.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/syntax.c | 13 | ||||
| -rw-r--r-- | src/syntax.h | 7 |
2 files changed, 8 insertions, 12 deletions
diff --git a/src/syntax.c b/src/syntax.c index 687bef74a84..f939a76a2e6 100644 --- a/src/syntax.c +++ b/src/syntax.c | |||
| @@ -246,7 +246,7 @@ SETUP_SYNTAX_TABLE (ptrdiff_t from, ptrdiff_t count) | |||
| 246 | if (parse_sexp_lookup_properties) | 246 | if (parse_sexp_lookup_properties) |
| 247 | { | 247 | { |
| 248 | if (count > 0) | 248 | if (count > 0) |
| 249 | update_syntax_table_forward (from, true, true, Qnil); | 249 | update_syntax_table_forward (from, true, Qnil); |
| 250 | else if (from > BEGV) | 250 | else if (from > BEGV) |
| 251 | { | 251 | { |
| 252 | update_syntax_table (from - 1, count, true, Qnil); | 252 | update_syntax_table (from - 1, count, true, Qnil); |
| @@ -502,12 +502,12 @@ parse_sexp_propertize (ptrdiff_t charpos) | |||
| 502 | e_property_truncated, so the e_property_truncated flag may | 502 | e_property_truncated, so the e_property_truncated flag may |
| 503 | occasionally be left raised spuriously. This should be rare. */ | 503 | occasionally be left raised spuriously. This should be rare. */ |
| 504 | gl_state.e_property_truncated = false; | 504 | gl_state.e_property_truncated = false; |
| 505 | update_syntax_table_forward (charpos, false, true, Qnil); | 505 | update_syntax_table_forward (charpos, false, Qnil); |
| 506 | } | 506 | } |
| 507 | } | 507 | } |
| 508 | 508 | ||
| 509 | void | 509 | void |
| 510 | update_syntax_table_forward (ptrdiff_t charpos, bool init, bool propertize, | 510 | update_syntax_table_forward (ptrdiff_t charpos, bool init, |
| 511 | Lisp_Object object) | 511 | Lisp_Object object) |
| 512 | { | 512 | { |
| 513 | if (gl_state.e_property_truncated) | 513 | if (gl_state.e_property_truncated) |
| @@ -518,12 +518,9 @@ update_syntax_table_forward (ptrdiff_t charpos, bool init, bool propertize, | |||
| 518 | else | 518 | else |
| 519 | { | 519 | { |
| 520 | update_syntax_table (charpos, 1, init, object); | 520 | update_syntax_table (charpos, 1, init, object); |
| 521 | propertize &= (NILP (object) | 521 | if (NILP (object) && gl_state.e_property > syntax_propertize__done) |
| 522 | && gl_state.e_property > syntax_propertize__done); | 522 | parse_sexp_propertize (charpos); |
| 523 | } | 523 | } |
| 524 | |||
| 525 | if (propertize) | ||
| 526 | parse_sexp_propertize (charpos); | ||
| 527 | } | 524 | } |
| 528 | 525 | ||
| 529 | /* Returns true if char at CHARPOS is quoted. | 526 | /* Returns true if char at CHARPOS is quoted. |
diff --git a/src/syntax.h b/src/syntax.h index 01c92ae8da0..eb154e088c9 100644 --- a/src/syntax.h +++ b/src/syntax.h | |||
| @@ -27,7 +27,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 27 | INLINE_HEADER_BEGIN | 27 | INLINE_HEADER_BEGIN |
| 28 | 28 | ||
| 29 | extern void update_syntax_table (ptrdiff_t, EMACS_INT, bool, Lisp_Object); | 29 | extern void update_syntax_table (ptrdiff_t, EMACS_INT, bool, Lisp_Object); |
| 30 | extern void update_syntax_table_forward (ptrdiff_t, bool, bool, Lisp_Object); | 30 | extern void update_syntax_table_forward (ptrdiff_t, bool, Lisp_Object); |
| 31 | 31 | ||
| 32 | /* The standard syntax table is stored where it will automatically | 32 | /* The standard syntax table is stored where it will automatically |
| 33 | be used in all new buffers. */ | 33 | be used in all new buffers. */ |
| @@ -183,15 +183,14 @@ UPDATE_SYNTAX_TABLE_FORWARD (ptrdiff_t charpos) | |||
| 183 | { /* Performs just-in-time syntax-propertization. */ | 183 | { /* Performs just-in-time syntax-propertization. */ |
| 184 | if (parse_sexp_lookup_properties && charpos >= gl_state.e_property) | 184 | if (parse_sexp_lookup_properties && charpos >= gl_state.e_property) |
| 185 | update_syntax_table_forward (charpos + gl_state.offset, | 185 | update_syntax_table_forward (charpos + gl_state.offset, |
| 186 | false, true, gl_state.object); | 186 | false, gl_state.object); |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | INLINE void | 189 | INLINE void |
| 190 | UPDATE_SYNTAX_TABLE_FORWARD_FAST (ptrdiff_t charpos) | 190 | UPDATE_SYNTAX_TABLE_FORWARD_FAST (ptrdiff_t charpos) |
| 191 | { | 191 | { |
| 192 | if (parse_sexp_lookup_properties && charpos >= gl_state.e_property) | 192 | if (parse_sexp_lookup_properties && charpos >= gl_state.e_property) |
| 193 | update_syntax_table_forward (charpos + gl_state.offset, | 193 | update_syntax_table (charpos + gl_state.offset, 1, false, gl_state.object); |
| 194 | false, false, gl_state.object); | ||
| 195 | } | 194 | } |
| 196 | 195 | ||
| 197 | /* Make syntax table state (gl_state) good for CHARPOS, assuming it is | 196 | /* Make syntax table state (gl_state) good for CHARPOS, assuming it is |